Loading

Program to Download all the IOS and Ruletypes for a particular transformation ID

Requirement:
We have developed this program to down load all the info objects fields and rule types into Excel sheet to compare the objects between two server, our aim was everything sd be sync between both the server.
This program will be helpful in many area.
The program follows below.

*&---------------------------------------------------------------------*
*& Report ZY_DATA_DOWNLOAD_TRANS
*& Author:Madhusmita Jena
*& Date:17/05/2011
REPORT ZY_DATA_DOWNLOAD_TRANS.
*tables:RSTRANFIELD,
* RSTRANRULE.


Include ZDATA_TOP_TRANS.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file .
PERFORM f_browse CHANGING p_file.
*&---------------------------------------------------------------------*
*& Form F_BROWSE
*&---------------------------------------------------------------------*
* text
*------------------------------------------------
----------------------*
* <--P_P_FILE text
*----------------------------------------------------------------------*
FORM F_BROWSE CHANGING P_P_FILE.
*
CREATE OBJECT lo_gui.
lv_title = 'Download of InfoProvider Data to Excel'.
lv_folder = 'C:'.
CALL METHOD lo_gui->directory_browse
EXPORTING
window_title = lv_title
initial_folder = lv_folder
CHANGING
selected_folder = lv_dir.
p_file = lv_dir.


ENDFORM.
START-OF-SELECTION.
PERFORM z_convert_excel.


*&---------------------------------------------------------------------*
*& Form Z_CONVERT_EXCEL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM Z_CONVERT_EXCEL .
v_filetype = '.xls'.
v_filename = p_file.
CONCATENATE p_file v_filetype INTO lv_filename.
select TRANID
OBJVERS
RULEID
PARAMTYPE
PARAMNM
FIELDNM

from RSTRANFIELD into table it_field
where TRANID eq p_TRANID
and objvers = 'A'.
if sy-subrc eq 0.
sort it_field by RULEID.
endif.
DELETE ADJACENT DUPLICATES FROM it_field COMPARING PARAMNM FIELDNM .
select TRANID OBJVERS RULEID RULETYPE from RSTRANRULE
into table it_rule

for all entries in it_field
where TRANID = p_tranid

AND RULEID = it_field-RULEID
AND OBJVERS = 'A'.
if sy-subrc eq 0.
sort it_rule by RULEID .
endif.
loop at it_field into wa_field .
Read table it_rule into wa_rule WITH KEY RULEID = wa_field-RULEID
BINARY SEARCH.
IF sy-subrc EQ 0.
wa_final-TRANID = wa_field-TRANID.
wa_final-OBJVERS = wa_field-OBJVERS.
wa_final-RULEID = wa_field-RULEID.
wa_final-PARAMTYPE = wa_field-PARAMTYPE .
wa_final-PARAMNM = wa_field-PARAMNM.
wa_final-FIELDNM = wa_field-FIELDNM.
wa_final-RULETYPE = wa_rule-RULETYPE.
ENDIF.
APPEND wa_final to it_final.
clear wa_final.
endloop.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = lv_filename
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = it_final
* FIELDNAMES = int_head
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform.

Include ZDATA_TOP_TRANS is as follows
*&---------------------------------------------------------------------*
*& Include ZDATA_TOP_TRANS
*&---------------------------------------------------------------------*
DATA: lo_gui TYPE REF TO cl_gui_frontend_services,
lv_title TYPE string,
lv_folder TYPE string,
lv_dir TYPE string,
v_filetype TYPE string,
v_filename TYPE string,
lv_filename TYPE string.
Types:begin of ty_field,
TRANID type RSTRANID,
OBJVERS type RSOBJVERS,
RULEID type RSTRAN_RULEID,
PARAMTYPE type RSTRAN_PARAMTYPE,
PARAMNM type RSFIELDNM,
FIELDNM type RSFIELDNM,
End of ty_field.

Types:begin of ty_rule,
TRANID type RSTRANID,
OBJVERS type RSOBJVERS,
RULEID type RSTRAN_RULEID,
RULETYPE type RSTRAN_RULETYPE,
End of ty_rule.

Types:begin of ty_final,
TRANID type RSTRANID,
OBJVERS type RSOBJVERS,
RULEID type RSTRAN_RULEID,
PARAMTYPE type RSTRAN_PARAMTYPE,
PARAMNM type RSFIELDNM,
FIELDNM type RSFIELDNM,
RULETYPE type RSTRAN_RULETYPE,
End of ty_final.
data:it_field type standard table of ty_field,
wa_field type ty_field,
it_rule type standard table of ty_rule,
wa_rule type ty_rule,
it_final type standard table of ty_final,
wa_final type ty_final.
PARAMETERS:p_TRANID type RSTRANFIELD-TRANID .
SELECTION-SCREEN BEGIN OF BLOCK screen .
PARAMETER p_file LIKE rlgrap-filename .
SELECTION-SCREEN END OF BLOCK screen.

once program ready in se38 just execute




then enter ur transformation ID , then give the path where u want to save ur excel
then execute.
Ur file wl be downloaded to desire location.