Neler Yeni
Hos Geldiniz,

SAPOfis Türkiye üzerinde yer alan içeriklere erişim sağlayabilmek, projelerinizde karşılaştığınız sorunlara birlikte çözüm üretebilmek adına üye olunuz. Unutmayalım ki, bilgi paylaşıldıkça değer kazanır.

SAP BLOG Tool to list down the Looked-up Tables in any Transformation in SAP BI

SAP Blog

Kayıtlı Üye
Katılım
22 Ara 2017
Mesajlar
283
Beğeniler
2
Puanları
6
#1
Hello SAP Friends,

Greetings !!

I’ve created quite a handy tool that would save you all a lot of time and effort in doing several small things at work. This tool might interest you much as I’ve coded a tool that lists down the Objects that are being looked-up in any Transformation (including 2 level Include Programs i.e. upto an Include Program in an Include Program used in either of Field/ Expert/ Start/ End Routine) so that you get to know which Objects shall be loaded before-hand i.e. before executing the DTPs that load using the said Transformation.



Summary :

This tool lists down the list of objects being looked-up in a Transformation by providing either Source Info-object or Target Info-object or Transformation ID.

Author: Rishabh Agarwal

Company: Accenture Services Pvt. Ltd.

Created on: 8th March 2018



Author Bio :

Rishabh Agarwal, working with Accenture Services Pvt. Ltd. as a SAP BI Technical Consultant, has an experience of more than 7 years in SAP BW/BI both Onsite and Offshore. He has been a part of multiple Production Support, Development and Implementation Projects.



Utility :

This tool will let us know the Objects (Tables/ DSOs etc.) that are being looked-up, their ABAP Code IDs or Include Program Name and the Type of Routine (be it Field/ Expert/ Start/ End Routine or Include Program in Field/ Expert/ Start/ End Routine).



How Tool Works :



  1. Execute the Program post implementation in the system (Code placed below). Below screen would then come up –

Tool to list down the Looked-up Tables in any Transformation in SAP BI



  1. Maintain all/ either entries at respective places –

Tool to list down the Looked-up Tables in any Transformation in SAP BI




  1. Then press Execute and you would get the output as shown, if all the checks go successful, showing up the Looked-up Tables, the ABAP Code IDs and the Routine Type –

Tool to list down the Looked-up Tables in any Transformation in SAP BI




Coding Part :



ABAP Program –





REPORT zbw_trfn_lookup_objs.

TYPE-POOLS : slis.

************************** Begin of Types declaration **************************

TYPES : BEGIN OF ty_rstran,
sourcename TYPE sobj_name,
sourcetype TYPE rstlogo,
targetname TYPE sobj_name,
targettype TYPE rstlogo,
tranid TYPE rstranid,
END OF ty_rstran,

BEGIN OF ty_rout,
tranid TYPE rstranid,
startroutine TYPE rssguid25,
endroutine TYPE rssguid25,
expert TYPE rssguid25,
END OF ty_rout,

BEGIN OF ty_fld_rout,
tranid TYPE rstranid,
codeid TYPE rssguid25,
END OF ty_fld_rout,

BEGIN OF ty_code,
line_no TYPE rslineno,
line TYPE edpline,
END OF ty_code,

BEGIN OF ty_dd02l,
tabname TYPE tabname,
END OF ty_dd02l,

BEGIN OF ty_output,
sourcename TYPE sobj_name,
sourcetype TYPE rstlogo,
targetname TYPE sobj_name,
targettype TYPE rstlogo,
tranid TYPE rstranid,
lkd_up_objs TYPE sobj_name,
codeid TYPE c LENGTH 60,
rout_type TYPE c LENGTH 60,
line_no TYPE rslineno,
END OF ty_output.

************************** End of Types declaration ***************************

************************** Begin of Data declaration **************************

DATA : gv_str1 TYPE string, gv_str2 TYPE string, gv_str3 TYPE string,
gv_str4 TYPE string, gv_str5 TYPE string, gv_str6 TYPE string,
gv_str7 TYPE string, gv_str8 TYPE string, gv_str9 TYPE string,
gv_str10 TYPE string, gv_str11 TYPE string, gv_str12 TYPE string,
gv_str13 TYPE string, gv_str14 TYPE string, gv_str15 TYPE string,
it_temp TYPE TABLE OF string,
wa_temp LIKE LINE OF it_temp.

DATA : gv_lkp_tab TYPE c LENGTH 20,
gv_prog_name TYPE c LENGTH 60,
gv_rout_type TYPE c LENGTH 60,
gv_line_no TYPE i,
gv_rout_type2 TYPE c LENGTH 60.

DATA : gt_fcat TYPE slis_t_fieldcat_alv,
gwa_fcat LIKE LINE OF gt_fcat,
gv_rstranid TYPE rstranid,
gv_sobj_name TYPE sobj_name.

DATA : it_rstran TYPE STANDARD TABLE OF ty_rstran,
wa_rstran TYPE ty_rstran,
it_rstran2 TYPE STANDARD TABLE OF ty_rstran,
wa_rstran2 TYPE ty_rstran,
it_rout TYPE STANDARD TABLE OF ty_rout,
wa_rout TYPE ty_rout,
it_fld_rout TYPE STANDARD TABLE OF ty_fld_rout,
wa_fld_rout TYPE ty_fld_rout,
it_rsaabap TYPE STANDARD TABLE OF ty_code,
wa_rsaabap TYPE ty_code,
it_include TYPE STANDARD TABLE OF ty_code,
wa_include TYPE ty_code,
it_include2 TYPE STANDARD TABLE OF ty_code,
wa_include2 TYPE ty_code,
it_dd02l TYPE STANDARD TABLE OF ty_dd02l,
wa_dd02l TYPE ty_dd02l,
it_output TYPE STANDARD TABLE OF ty_output,
wa_output TYPE ty_output.

DATA : wa_s_trfnid TYPE rstranid,
wa_s_source TYPE sobj_name,
wa_s_target TYPE sobj_name,
lv_strlen TYPE i,
lv_flag TYPE i.

************************** End of Data declaration *************************************

************************** Begin of Selection Screen ***********************************

SELECTION-SCREEN BEGIN OF BLOCK b0 WITH FRAME NO INTERVALS.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS : s_trfnid FOR gv_rstranid.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
SELECT-OPTIONS : s_source FOR gv_sobj_name.
SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME.
SELECT-OPTIONS : s_target FOR gv_sobj_name.
SELECTION-SCREEN END OF BLOCK b3.

SELECTION-SCREEN END OF BLOCK b0.

AT SELECTION-SCREEN OUTPUT.
MESSAGE ‘Kindly input values with 4 or more characters.’ TYPE ‘S’.

************************** End of Selection Screen *************************************

START-OF-SELECTION.

REFRESH : it_rstran, it_rstran2, it_rout, it_fld_rout, it_output, it_rsaabap, it_dd02l, it_include, it_include2.
CLEAR: wa_rstran, wa_rstran2, wa_rout, wa_fld_rout, wa_output, wa_rsaabap, wa_dd02l, wa_include, wa_include2.
CLEAR: wa_s_source, wa_s_trfnid, wa_s_target, lv_flag, lv_strlen.

” Fetching Source & Target Infobject Names and Types along with Tranformation ID
” from RSTRAN Table for the inputs provided at the selection screen.

IF s_trfnid IS INITIAL AND s_source IS INITIAL AND s_target IS INITIAL.
MESSAGE ‘Error: Processing not possible. Please provide some input selection.’ TYPE ‘I’.
LEAVE LIST-PROCESSING.
ENDIF.

IF s_trfnid IS NOT INITIAL.

LOOP AT s_trfnid INTO wa_s_trfnid.
IF strlen( wa_s_trfnid ) LT 7. ” Checking if the input value is atleast of 4 chars.
DELETE s_trfnid[] INDEX sy-tabix.
lv_flag = 1.
ENDIF.
ENDLOOP.
IF lv_flag IS NOT INITIAL.
CLEAR: lv_flag.
MESSAGE ‘Note – Input value with less than 4 chars in “Transformation ID” have been ignored.’ TYPE ‘I’.
ENDIF.

IF s_trfnid[] IS NOT INITIAL.
SELECT sourcename sourcetype targetname targettype tranid
FROM rstran INTO TABLE it_rstran
WHERE tranid IN s_trfnid[]
AND objvers EQ ‘A’.
IF it_rstran IS INITIAL.
MESSAGE ‘Transformation with given name is invalid.’ TYPE ‘I’.
ELSE.
APPEND LINES OF it_rstran[] TO it_rstran2[].
CLEAR it_rstran.
ENDIF.
ELSE.
MESSAGE ‘No valid input is available in “Transformation ID” field.’ TYPE ‘I’.
ENDIF.

ENDIF.

IF s_source IS NOT INITIAL.

LOOP AT s_source INTO wa_s_source.
IF strlen( wa_s_source ) LT 7. ” Checking if the input value is atleast of 4 chars.
DELETE s_source[] INDEX sy-tabix.
lv_flag = 1.
ENDIF.
ENDLOOP.
IF lv_flag IS NOT INITIAL.
CLEAR: lv_flag.
MESSAGE ‘Note – Input value with less than 4 chars in “Source Infoprovider” have been ignored.’ TYPE ‘I’.
ENDIF.

IF s_source[] IS NOT INITIAL.
SELECT sourcename sourcetype targetname targettype tranid
FROM rstran INTO TABLE it_rstran
WHERE sourcename IN s_source[]
AND objvers EQ ‘A’.

IF it_rstran IS INITIAL.

” Logic to fetch the details for Datasources as their names are concatenated with Sourcesystem name in RSTRAN Table.
CLEAR : wa_s_source.
LOOP AT s_source[] INTO wa_s_source.
IF strlen( wa_s_source ) GE 7.
CLEAR: lv_strlen.
CONCATENATE wa_s_source ‘*’ INTO wa_s_source.
lv_strlen = strlen( wa_s_source ).
s_source-low = wa_s_source+3(lv_strlen).
s_source-option = ‘CP’.
MODIFY s_source[] INDEX sy-tabix FROM s_source.
ENDIF.
ENDLOOP.

SELECT sourcename sourcetype targetname targettype tranid
FROM rstran INTO TABLE it_rstran
WHERE sourcename IN s_source[]
AND objvers EQ ‘A’
AND sourcetype EQ ‘RSDS’.
IF it_rstran IS INITIAL.
MESSAGE ‘Source Infoprovider with given name is invalid.’ TYPE ‘I’.
ELSE.
APPEND LINES OF it_rstran[] TO it_rstran2[].
CLEAR it_rstran.
ENDIF.
ELSE.
APPEND LINES OF it_rstran[] TO it_rstran2[].
CLEAR it_rstran.
ENDIF.
ELSE.
MESSAGE ‘No valid input is available in “Source Infoprovider” field.’ TYPE ‘I’.
ENDIF.
ENDIF.

IF s_target IS NOT INITIAL.

LOOP AT s_target INTO wa_s_target.
IF strlen( wa_s_target ) LT 7. ” Checking if the input value is atleast of 4 chars.
DELETE s_target[] INDEX sy-tabix.
lv_flag = 1.
ENDIF.
ENDLOOP.
IF lv_flag IS NOT INITIAL.
CLEAR: lv_flag.
MESSAGE ‘Note – Input value with less than 4 chars in “Target Infoprovider” have been ignored.’ TYPE ‘I’.
ENDIF.

IF s_target[] IS NOT INITIAL.
SELECT sourcename sourcetype targetname targettype tranid
FROM rstran INTO TABLE it_rstran
WHERE targetname IN s_target[]
AND objvers EQ ‘A’.
IF it_rstran IS INITIAL.
MESSAGE ‘Target Infoprovider with given name is invalid.’ TYPE ‘I’.
ELSE.
APPEND LINES OF it_rstran[] TO it_rstran2[].
CLEAR it_rstran.
ENDIF.
ELSE.
MESSAGE ‘No valid input is available in “Target Infoprovider” field.’ TYPE ‘I’.
ENDIF.

ENDIF.

IF s_trfnid[] IS INITIAL AND s_source[] IS INITIAL AND s_target[] IS INITIAL.
MESSAGE ‘Error: Processing not possible. Please provide input selections with atleast 4 characters in either of the fields.’ TYPE ‘I’.
LEAVE LIST-PROCESSING.
ENDIF.

SORT it_rstran2 BY sourcename sourcetype targetname targettype tranid.
DELETE ADJACENT DUPLICATES FROM it_rstran2 COMPARING tranid.

IF it_rstran2 IS INITIAL.
MESSAGE ‘No data found for given selection.’ TYPE ‘I’.
LEAVE LIST-PROCESSING.

ELSE.

MESSAGE ‘Data displayed only for the valid selections provided.’ TYPE ‘S’.

” Fetching the list of all the Tables and Views existing in the system in Active form, from SAP standard table DD02L.
SELECT tabname FROM dd02l INTO TABLE it_dd02l
WHERE as4local = ‘A’
AND ( tabclass = ‘TRANSP’ OR tabclass = ‘VIEW’ ).
SORT it_dd02l.

” Logic to lookup the Routine ID(s) and fetch the objects being looked-up in the respective code in TRFN.
LOOP AT it_rstran2 INTO wa_rstran2.

” Fetching the Start/ End/ Expert Routine IDs from Table RSTRAN for the given Transformation(s).
SELECT tranid startroutine endroutine expert
FROM rstran INTO TABLE it_rout
WHERE tranid = wa_rstran2-tranid
AND objvers = ‘A’.

SORT it_rout.
DELETE it_rout WHERE startroutine IS INITIAL
AND endroutine IS INITIAL
AND expert IS INITIAL.

IF it_rout IS NOT INITIAL.

LOOP AT it_rout INTO wa_rout.

IF wa_rout-startroutine IS NOT INITIAL.
wa_output-codeid = wa_rout-startroutine.
wa_output-rout_type = ‘Start Routine’.

SELECT line_no line
FROM rsaabap INTO TABLE it_rsaabap
WHERE codeid = wa_output-codeid
AND objvers = ‘A’.

PERFORM fetch_lookedup_objs TABLES it_rsaabap.

CLEAR wa_output.
ENDIF.

IF wa_rout-endroutine IS NOT INITIAL.
wa_output-codeid = wa_rout-endroutine.
wa_output-rout_type = ‘End Routine’.

SELECT line_no line
FROM rsaabap INTO TABLE it_rsaabap
WHERE codeid = wa_output-codeid
AND objvers = ‘A’.

PERFORM fetch_lookedup_objs TABLES it_rsaabap.
CLEAR wa_output.
ENDIF.

IF wa_rout-expert IS NOT INITIAL.
wa_output-codeid = wa_rout-expert.
wa_output-rout_type = ‘Expert Routine’.

SELECT line_no line
FROM rsaabap INTO TABLE it_rsaabap
WHERE codeid = wa_output-codeid
AND objvers = ‘A’.

PERFORM fetch_lookedup_objs TABLES it_rsaabap.
CLEAR wa_output.
ENDIF.

ENDLOOP.
ENDIF.

” Fetching the Field Routine(s) ID from Table RSTRANSTEPROUT for the given Transformation(s).
SELECT tranid codeid FROM rstransteprout
INTO TABLE it_fld_rout
WHERE tranid = wa_rstran2-tranid
AND objvers = ‘A’.

SORT it_fld_rout BY tranid codeid.
DELETE it_fld_rout WHERE codeid IS INITIAL.

IF it_fld_rout IS NOT INITIAL.
LOOP AT it_fld_rout INTO wa_fld_rout.
wa_output-codeid = wa_fld_rout-codeid.
wa_output-rout_type = ‘Field Routine’.

SELECT line_no line
FROM rsaabap INTO TABLE it_rsaabap
WHERE codeid = wa_output-codeid
AND objvers = ‘A’.

PERFORM fetch_lookedup_objs TABLES it_rsaabap.
CLEAR wa_output.
ENDLOOP.
ENDIF.

ENDLOOP.

ENDIF.

CLEAR gwa_fcat.

IF it_output IS INITIAL.
MESSAGE ‘No Look-up objects exist in the Transformation(s) for given selection.’ TYPE ‘I’.
LEAVE LIST-PROCESSING.

ELSE.
SORT it_output.
DELETE ADJACENT DUPLICATES FROM it_output COMPARING sourcename sourcetype targetname targettype tranid lkd_up_objs codeid.

************************** Begin of Creation of Output Table **************************

gwa_fcat-fieldname = ‘SOURCENAME’.
gwa_fcat-tabname = ‘IT_OUTPUT’.
gwa_fcat-ref_fieldname = ‘EXPERT’.
gwa_fcat-ref_tabname = ‘RSTRAN’.
gwa_fcat-seltext_l = ‘Source Object Name’.
gwa_fcat-seltext_m = ‘Source Object’.
gwa_fcat-seltext_s = ‘Source Object’.
APPEND gwa_fcat TO gt_fcat.
CLEAR gwa_fcat.

gwa_fcat-fieldname = ‘SOURCETYPE’.
gwa_fcat-tabname = ‘IT_OUTPUT’.
gwa_fcat-seltext_l = ‘Source Object Type’.
gwa_fcat-seltext_m = ‘Source Obj Typ’.
gwa_fcat-seltext_s = ‘Src Obj Typ’.
APPEND gwa_fcat TO gt_fcat.
CLEAR gwa_fcat.

gwa_fcat-fieldname = ‘TARGETNAME’.
gwa_fcat-tabname = ‘IT_OUTPUT’.
gwa_fcat-seltext_l = ‘Target Object Name’.
gwa_fcat-seltext_m = ‘Target Object’.
gwa_fcat-seltext_s = ‘Tgt Obj’.
APPEND gwa_fcat TO gt_fcat.
CLEAR gwa_fcat.

gwa_fcat-fieldname = ‘TARGETTYPE’.
gwa_fcat-tabname = ‘IT_OUTPUT’.
gwa_fcat-seltext_l = ‘Target Object Type’.
gwa_fcat-seltext_m = ‘Target Obj Typ’.
gwa_fcat-seltext_s = ‘Tgt Obj Typ’.
APPEND gwa_fcat TO gt_fcat.
CLEAR gwa_fcat.

gwa_fcat-fieldname = ‘TRANID’.
gwa_fcat-tabname = ‘IT_OUTPUT’.
gwa_fcat-ref_fieldname = ‘TRANID’.
gwa_fcat-ref_tabname = ‘RSTRAN’.
gwa_fcat-seltext_l = ‘Transformation ID’.
gwa_fcat-seltext_m = ‘Trfn ID’.
gwa_fcat-seltext_s = ‘Trfn ID’.
APPEND gwa_fcat TO gt_fcat.
CLEAR gwa_fcat.

gwa_fcat-fieldname = ‘LKD_UP_OBJS’.
gwa_fcat-tabname = ‘IT_OUTPUT’.
gwa_fcat-ref_fieldname = ‘EXPERT’.
gwa_fcat-ref_tabname = ‘RSTRAN’.
gwa_fcat-seltext_l = ‘Looked-up Tables’.
gwa_fcat-seltext_m = ‘Looked-up Tables’.
gwa_fcat-seltext_s = ‘Lkd-up Tables’.
APPEND gwa_fcat TO gt_fcat.
CLEAR gwa_fcat.

gwa_fcat-fieldname = ‘CODEID’.
gwa_fcat-tabname = ‘IT_OUTPUT’.
gwa_fcat-ref_fieldname = ‘EXPERT’.
gwa_fcat-ref_tabname = ‘RSTRAN’.
gwa_fcat-seltext_l = ‘ABAP Code ID’.
gwa_fcat-seltext_m = ‘ABAP Code ID’.
gwa_fcat-seltext_s = ‘ABAP Code ID’.
APPEND gwa_fcat TO gt_fcat.
CLEAR gwa_fcat.

gwa_fcat-fieldname = ‘ROUT_TYPE’.
gwa_fcat-tabname = ‘IT_OUTPUT’.
gwa_fcat-ref_fieldname = ‘EXPERT’.
gwa_fcat-ref_tabname = ‘RSTRAN’.
gwa_fcat-seltext_l = ‘Routine Type’.
gwa_fcat-seltext_m = ‘Routine Type’.
gwa_fcat-seltext_s = ‘Routine Type’.
APPEND gwa_fcat TO gt_fcat.
CLEAR gwa_fcat.

* gwa_fcat-fieldname = ‘LINE_NO’.
* gwa_fcat-tabname = ‘IT_OUTPUT’.
* gwa_fcat-ref_fieldname = ‘VERSION_CUR’.
* gwa_fcat-ref_tabname = ‘RSTRAN’.
* gwa_fcat-seltext_l = ‘Line No. in Include Program’.
* gwa_fcat-seltext_m = ‘Line No. in Include’.
* gwa_fcat-seltext_s = ‘Line No.’.
* APPEND gwa_fcat TO gt_fcat.
* CLEAR gwa_fcat.

* FM -ALV display
CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
EXPORTING
* i_callback_program = g_repid
* is_layout = gw_layout
* i_callback_top_of_page = ‘TOP_OF_PAGE’
it_fieldcat = gt_fcat
* i_save = ‘A’
TABLES
t_outtab = it_output
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDIF.
************************** End of Creation of Output Table ****************************

************************************ Begin of FORMS ************************************
*&———————————————————————*
*& Form fetch_lookedup_objs
*&———————————————————————*
* To fetch the list of looked-up objects in TRFN.
*———————————————————————-*
FORM fetch_lookedup_objs TABLES it_code LIKE it_rsaabap.

DATA: lv_idx_code TYPE i,
wa_code TYPE ty_code.

FIELD-SYMBOLS: <fs_code> TYPE ty_code.

CLEAR: lv_idx_code, wa_code.

DELETE it_code[] WHERE line IS INITIAL.
SORT it_code[] BY line_no line.

” Deleting the table entries i.e. the lines of code which actually are comments.
DELETE it_code[] WHERE line+0(1) EQ ‘*’ OR line+0(1) EQ ‘”‘ OR line+0(1) EQ ‘.’.
DELETE it_code[] WHERE line CS `ENDSELECT`
OR line CS `INCLUDE:`
OR line CS `INCLUDE STRUCTURE`
OR line CS `INCLUDE TYPE`.

IF it_code[] IS NOT INITIAL.
LOOP AT it_code[] ASSIGNING <fs_code>.
SHIFT <fs_code>-line RIGHT DELETING TRAILING space.
SHIFT <fs_code>-line LEFT DELETING LEADING space.
TRANSLATE <fs_code>-line TO UPPER CASE.
ENDLOOP.

LOOP AT it_code[] INTO wa_code.
lv_idx_code = sy-tabix.

IF wa_code-line CS ‘SELECT’.
gv_prog_name = wa_output-codeid.
gv_rout_type = wa_output-rout_type.

PERFORM read_select_code TABLES it_code
USING wa_code
lv_idx_code.

ELSEIF wa_code-line CS ‘INCLUDE’.
CONCATENATE `Include Program in ` wa_output-rout_type INTO wa_output-rout_type.

PERFORM read_include_program TABLES it_code
USING wa_code
lv_idx_code.

ELSE.
CONTINUE.
ENDIF.

ENDLOOP.

ENDIF.

ENDFORM. “fetch_lookedup_objs

*&———————————————————————*
*& Form read_select_code
*&———————————————————————*
* text
*———————————————————————-*
* –> p1 text
* <– p2 text
*———————————————————————-*
FORM read_select_code TABLES it_code2 LIKE it_rsaabap
USING wa_code2 LIKE LINE OF it_rsaabap
lv_idx_code2 TYPE i.

DATA: lv_idx_temp TYPE i,
lv_idx_rsaabap2 TYPE i,
lv_len_rsaabap2 TYPE i,
it_rsaabap2 TYPE STANDARD TABLE OF ty_code,
wa_rsaabap2 TYPE ty_code.

CLEAR: lv_idx_temp, lv_idx_rsaabap2, lv_len_rsaabap2, wa_rsaabap2.
REFRESH: it_rsaabap2.

wa_rsaabap2-line_no = wa_code2-line_no.
wa_rsaabap2-line = wa_code2-line.
APPEND wa_rsaabap2 TO it_rsaabap2.

WHILE wa_code2-line NS ‘.’.
lv_idx_code2 = lv_idx_code2 + 1.
READ TABLE it_code2 INDEX lv_idx_code2 INTO wa_code2.

wa_rsaabap2-line_no = wa_code2-line_no.
wa_rsaabap2-line = wa_code2-line.
APPEND wa_rsaabap2 TO it_rsaabap2.
ENDWHILE.

IF it_rsaabap2 IS NOT INITIAL.
CLEAR: lv_idx_code2.
LOOP AT it_rsaabap2 INTO wa_rsaabap2.
lv_idx_rsaabap2 = sy-tabix.

IF wa_rsaabap2-line CS ‘FROM’.
lv_len_rsaabap2 = strlen( wa_rsaabap2-line ).
lv_len_rsaabap2 = lv_len_rsaabap2 – 4.

IF wa_rsaabap2-line+lv_len_rsaabap2(4) EQ ‘FROM’.
lv_idx_rsaabap2 = lv_idx_rsaabap2 + 1.
READ TABLE it_rsaabap2 INDEX lv_idx_rsaabap2 INTO wa_rsaabap2.

REFRESH it_temp.
CLEAR: gv_str1, gv_str2, gv_str3, gv_str4, gv_str5, gv_str6, gv_str7, gv_str8, gv_str9,
gv_str10, gv_str11, gv_str12, gv_str13, gv_str14, gv_str15, wa_temp.

” Splitting the line of code word by word to different rows in a table.
SPLIT wa_rsaabap2-line AT space
INTO: gv_str1 gv_str2 gv_str3 gv_str4 gv_str5 gv_str6 gv_str7 gv_str8
gv_str9 gv_str10 gv_str11 gv_str12 gv_str13 gv_str14 gv_str15,
TABLE it_temp.

READ TABLE it_dd02l INTO wa_dd02l WITH KEY tabname = gv_str1.
IF sy-subrc IS NOT INITIAL.
CONTINUE.
ELSE.
gv_lkp_tab = gv_str1.
gv_line_no = wa_rsaabap2-line_no.
ENDIF.

ELSEIF wa_rsaabap2-line+0(4) EQ ‘FROM’.
READ TABLE it_rsaabap2 INDEX lv_idx_rsaabap2 INTO wa_rsaabap2.

REFRESH it_temp.
CLEAR: gv_str1, gv_str2, gv_str3, gv_str4, gv_str5, gv_str6, gv_str7, gv_str8, gv_str9,
gv_str10, gv_str11, gv_str12, gv_str13, gv_str14, gv_str15, wa_temp.

” Splitting the line of code word by word to different rows in a table.
SPLIT wa_rsaabap2-line AT space
INTO: gv_str1 gv_str2 gv_str3 gv_str4 gv_str5 gv_str6 gv_str7 gv_str8
gv_str9 gv_str10 gv_str11 gv_str12 gv_str13 gv_str14 gv_str15,
TABLE it_temp.

READ TABLE it_dd02l INTO wa_dd02l WITH KEY tabname = gv_str2.
IF sy-subrc IS NOT INITIAL.
CONTINUE.
ELSE.
gv_lkp_tab = gv_str2.
gv_line_no = wa_rsaabap2-line_no.
ENDIF.

ELSE.
READ TABLE it_rsaabap2 INDEX lv_idx_rsaabap2 INTO wa_rsaabap2.

REFRESH it_temp.
CLEAR: gv_str1, gv_str2, gv_str3, gv_str4, gv_str5, gv_str6, gv_str7, gv_str8, gv_str9,
gv_str10, gv_str11, gv_str12, gv_str13, gv_str14, gv_str15, wa_temp.

” Splitting the line of code word by word to different rows in a table.
SPLIT wa_rsaabap2-line AT space
INTO: gv_str1 gv_str2 gv_str3 gv_str4 gv_str5 gv_str6 gv_str7 gv_str8
gv_str9 gv_str10 gv_str11 gv_str12 gv_str13 gv_str14 gv_str15,
TABLE it_temp.

READ TABLE it_temp INTO wa_temp WITH KEY table_line = ‘FROM’.
IF sy-subrc IS INITIAL.
lv_idx_temp = sy-tabix + 1.
READ TABLE it_temp INDEX lv_idx_temp INTO wa_temp.
IF wa_temp IS NOT INITIAL.
READ TABLE it_dd02l INTO wa_dd02l WITH KEY tabname = wa_temp.
IF sy-subrc IS NOT INITIAL.
CONTINUE.
ELSE.
gv_lkp_tab = wa_temp.
gv_line_no = wa_rsaabap2-line_no.
ENDIF.
ENDIF.
ENDIF.

ENDIF.
ELSE.
CONTINUE.
ENDIF.

****************************** Creating the final output work area ******************************
” Populating the Work Area with values fetched from RSTRAN Table for the given user inputs.
wa_output-sourcename = wa_rstran2-sourcename.
wa_output-sourcetype = wa_rstran2-sourcetype.
wa_output-targetname = wa_rstran2-targetname.
wa_output-targettype = wa_rstran2-targettype.
wa_output-tranid = wa_rstran2-tranid.

” Populating the Work Area with values derived from logics implemented.
wa_output-lkd_up_objs = gv_lkp_tab.
wa_output-codeid = gv_prog_name.
wa_output-rout_type = gv_rout_type.
wa_output-line_no = gv_line_no. ” this line no. is from the RSAABAP Table and is not the one as seen in TRFN.

APPEND wa_output TO it_output.
ENDLOOP.
ENDIF.
ENDFORM. ” read_select_code

*&———————————————————————*
*& Form read_include_program
*&———————————————————————*
* text
*———————————————————————-*
* –> p1 text
* <– p2 text
*———————————————————————-*
FORM read_include_program TABLES it_code3 LIKE it_rsaabap
USING wa_code3 LIKE LINE OF it_rsaabap
lv_idx_code3 TYPE i.

DATA: lv_idx_temp TYPE i,
lv_idx_temp2 TYPE i,
lv_idx_rsaabap2 TYPE i,
lv_len_rsaabap2 TYPE i,
it_rsaabap2 TYPE STANDARD TABLE OF ty_code,
wa_rsaabap2 TYPE ty_code,
it_temp2 TYPE TABLE OF string.

FIELD-SYMBOLS: <fs_temp2> LIKE LINE OF it_temp2.

CLEAR: lv_idx_temp, lv_idx_temp2, lv_idx_rsaabap2, lv_len_rsaabap2, wa_rsaabap2.
REFRESH: it_rsaabap2.

wa_rsaabap2-line_no = wa_code3-line_no.
wa_rsaabap2-line = wa_code3-line.
APPEND wa_rsaabap2 TO it_rsaabap2.

WHILE wa_code3-line NS `IF FOUND.`.
lv_idx_code3 = lv_idx_code3 + 1.
READ TABLE it_code3 INDEX lv_idx_code3 INTO wa_code3.

wa_rsaabap2-line_no = wa_code3-line_no.
wa_rsaabap2-line = wa_code3-line.
APPEND wa_rsaabap2 TO it_rsaabap2.
ENDWHILE.

IF it_rsaabap2 IS NOT INITIAL.
CLEAR: lv_idx_code3.
LOOP AT it_rsaabap2 INTO wa_rsaabap2.
lv_idx_rsaabap2 = sy-tabix.

IF wa_rsaabap2-line CS ‘INCLUDE’.
lv_len_rsaabap2 = strlen( wa_rsaabap2-line ).
lv_len_rsaabap2 = lv_len_rsaabap2 – 7.

IF wa_rsaabap2-line+lv_len_rsaabap2(7) EQ ‘INCLUDE’.
lv_idx_rsaabap2 = lv_idx_rsaabap2 + 1.
READ TABLE it_rsaabap2 INDEX lv_idx_rsaabap2 INTO wa_rsaabap2.

REFRESH it_temp.
CLEAR: gv_str1, gv_str2, gv_str3, gv_str4, gv_str5, gv_str6, gv_str7, gv_str8, gv_str9,
gv_str10, gv_str11, gv_str12, gv_str13, gv_str14, gv_str15, wa_temp.

” Splitting the line of code word by word to different rows in a table.
SPLIT wa_rsaabap2-line AT space
INTO: gv_str1 gv_str2 gv_str3 gv_str4 gv_str5 gv_str6 gv_str7 gv_str8
gv_str9 gv_str10 gv_str11 gv_str12 gv_str13 gv_str14 gv_str15,
TABLE it_temp.

IF it_temp IS NOT INITIAL.
gv_prog_name = gv_str1.
ENDIF.

ELSEIF wa_rsaabap2-line+0(7) EQ ‘INCLUDE’.
READ TABLE it_rsaabap2 INDEX lv_idx_rsaabap2 INTO wa_rsaabap2.

REFRESH it_temp.
CLEAR: gv_str1, gv_str2, gv_str3, gv_str4, gv_str5, gv_str6, gv_str7, gv_str8, gv_str9,
gv_str10, gv_str11, gv_str12, gv_str13, gv_str14, gv_str15, wa_temp.

” Splitting the line of code word by word to different rows in a table.
SPLIT wa_rsaabap2-line AT space
INTO: gv_str1 gv_str2 gv_str3 gv_str4 gv_str5 gv_str6 gv_str7 gv_str8
gv_str9 gv_str10 gv_str11 gv_str12 gv_str13 gv_str14 gv_str15,
TABLE it_temp.

IF it_temp IS NOT INITIAL.
gv_prog_name = gv_str2.
ENDIF.

ELSE.
READ TABLE it_rsaabap2 INDEX lv_idx_rsaabap2 INTO wa_rsaabap2.

REFRESH it_temp.
CLEAR: gv_str1, gv_str2, gv_str3, gv_str4, gv_str5, gv_str6, gv_str7, gv_str8, gv_str9,
gv_str10, gv_str11, gv_str12, gv_str13, gv_str14, gv_str15, wa_temp.

” Splitting the line of code word by word to different rows in a table.
SPLIT wa_rsaabap2-line AT space
INTO: gv_str1 gv_str2 gv_str3 gv_str4 gv_str5 gv_str6 gv_str7 gv_str8
gv_str9 gv_str10 gv_str11 gv_str12 gv_str13 gv_str14 gv_str15,
TABLE it_temp.

READ TABLE it_temp INTO wa_temp WITH KEY table_line = ‘INCLUDE’.
IF sy-subrc IS INITIAL.
lv_idx_temp = sy-tabix + 1.
READ TABLE it_temp INDEX lv_idx_temp INTO wa_temp.
IF it_temp IS NOT INITIAL.
gv_prog_name = wa_temp.
ENDIF.
ENDIF.
ENDIF.

READ REPORT gv_prog_name INTO it_temp2.
IF it_temp2 IS NOT INITIAL.
CLEAR: wa_include.
REFRESH: it_include.
LOOP AT it_temp2 ASSIGNING <fs_temp2>.
SHIFT <fs_temp2> RIGHT DELETING TRAILING space.
SHIFT <fs_temp2> LEFT DELETING LEADING space.
TRANSLATE <fs_temp2> TO UPPER CASE.

lv_idx_temp2 = sy-tabix.
wa_include-line_no = lv_idx_temp2.
wa_include-line = <fs_temp2>.

APPEND wa_include TO it_include.
ENDLOOP.
ENDIF.

wa_output-codeid = gv_prog_name.
PERFORM fetch_lookedup_objs_include TABLES it_include.

ELSE.
CONTINUE.
ENDIF.

ENDLOOP.
ENDIF.
ENDFORM. ” read_include_program

*&———————————————————————*
*& Form FETCH_LOOKEDUP_OBJS_INCLUDE
*&———————————————————————*
* text
*———————————————————————-*
* –>P_IT_INCLUDE text
*———————————————————————-*
FORM fetch_lookedup_objs_include TABLES it_code4 LIKE it_include.

DATA: lv_idx_code4 TYPE i,
wa_code4 TYPE ty_code.

FIELD-SYMBOLS: <fs_code4> TYPE ty_code.

CLEAR: lv_idx_code4, wa_code4.

DELETE it_code4[] WHERE line IS INITIAL.
SORT it_code4[] BY line_no line.

” Deleting the table entries i.e. the lines of code which actually are comments.
DELETE it_code4[] WHERE line+0(1) EQ ‘*’ OR line+0(1) EQ ‘”‘ OR line+0(1) EQ ‘.’.
DELETE it_code4[] WHERE line CS `ENDSELECT`
OR line CS `INCLUDE:`
OR line CS `INCLUDE STRUCTURE`
OR line CS `INCLUDE TYPE`.

IF it_code4[] IS NOT INITIAL.
LOOP AT it_code4[] ASSIGNING <fs_code4>.
SHIFT <fs_code4>-line RIGHT DELETING TRAILING space.
SHIFT <fs_code4>-line LEFT DELETING LEADING space.
TRANSLATE <fs_code4>-line TO UPPER CASE.
ENDLOOP.

LOOP AT it_code4[] INTO wa_code4.
lv_idx_code4 = sy-tabix.

IF wa_code4-line CS ‘SELECT’.
gv_prog_name = wa_output-codeid.
gv_rout_type = wa_output-rout_type.

PERFORM read_select_code_include TABLES it_code4
USING wa_code4
lv_idx_code4.

ELSEIF wa_code4-line CS ‘INCLUDE’.
CONCATENATE `Include Program in ` wa_output-rout_type INTO wa_output-rout_type.

PERFORM read_inc_include_program TABLES it_code4
USING wa_code4
lv_idx_code4.

ELSE.
CONTINUE.
ENDIF.

ENDLOOP.

ENDIF.
ENDFORM. ” FETCH_LOOKEDUP_OBJS_INCLUDE

*&———————————————————————*
*& Form READ_SELECT_CODE_INCLUDE
*&———————————————————————*
* text
*———————————————————————-*
* –>P_IT_CODE4 text
* –>P_WA_CODE4 text
* –>P_LV_IDX_CODE4 text
*———————————————————————-*
FORM read_select_code_include TABLES it_code5 LIKE it_rsaabap
USING wa_code5 LIKE LINE OF it_rsaabap
lv_idx_code5 TYPE i.

DATA: lv_idx_temp TYPE i,
lv_idx_rsaabap2 TYPE i,
lv_len_rsaabap2 TYPE i,
it_rsaabap2 TYPE STANDARD TABLE OF ty_code,
wa_rsaabap2 TYPE ty_code.

CLEAR: lv_idx_temp, lv_idx_rsaabap2, lv_len_rsaabap2, wa_rsaabap2.
REFRESH: it_rsaabap2.

wa_rsaabap2-line_no = wa_code5-line_no.
wa_rsaabap2-line = wa_code5-line.
APPEND wa_rsaabap2 TO it_rsaabap2.

WHILE wa_code5-line NS ‘.’.
lv_idx_code5 = lv_idx_code5 + 1.
READ TABLE it_code5 INDEX lv_idx_code5 INTO wa_code5.

wa_rsaabap2-line_no = wa_code5-line_no.
wa_rsaabap2-line = wa_code5-line.
APPEND wa_rsaabap2 TO it_rsaabap2.
ENDWHILE.

IF it_rsaabap2 IS NOT INITIAL.
CLEAR: lv_idx_code5.
LOOP AT it_rsaabap2 INTO wa_rsaabap2.
lv_idx_rsaabap2 = sy-tabix.

IF wa_rsaabap2-line CS ‘FROM’.
lv_len_rsaabap2 = strlen( wa_rsaabap2-line ).
lv_len_rsaabap2 = lv_len_rsaabap2 – 4.

IF wa_rsaabap2-line+lv_len_rsaabap2(4) EQ ‘FROM’.
lv_idx_rsaabap2 = lv_idx_rsaabap2 + 1.
READ TABLE it_rsaabap2 INDEX lv_idx_rsaabap2 INTO wa_rsaabap2.

REFRESH it_temp.
CLEAR: gv_str1, gv_str2, gv_str3, gv_str4, gv_str5, gv_str6, gv_str7, gv_str8, gv_str9,
gv_str10, gv_str11, gv_str12, gv_str13, gv_str14, gv_str15, wa_temp.

” Splitting the line of code word by word to different rows in a table.
SPLIT wa_rsaabap2-line AT space
INTO: gv_str1 gv_str2 gv_str3 gv_str4 gv_str5 gv_str6 gv_str7 gv_str8
gv_str9 gv_str10 gv_str11 gv_str12 gv_str13 gv_str14 gv_str15,
TABLE it_temp.

READ TABLE it_dd02l INTO wa_dd02l WITH KEY tabname = gv_str1.
IF sy-subrc IS NOT INITIAL.
CONTINUE.
ELSE.
gv_lkp_tab = gv_str1.
gv_line_no = wa_rsaabap2-line_no.
ENDIF.

ELSEIF wa_rsaabap2-line+0(4) EQ ‘FROM’.
READ TABLE it_rsaabap2 INDEX lv_idx_rsaabap2 INTO wa_rsaabap2.

REFRESH it_temp.
CLEAR: gv_str1, gv_str2, gv_str3, gv_str4, gv_str5, gv_str6, gv_str7, gv_str8, gv_str9,
gv_str10, gv_str11, gv_str12, gv_str13, gv_str14, gv_str15, wa_temp.

” Splitting the line of code word by word to different rows in a table.
SPLIT wa_rsaabap2-line AT space
INTO: gv_str1 gv_str2 gv_str3 gv_str4 gv_str5 gv_str6 gv_str7 gv_str8
gv_str9 gv_str10 gv_str11 gv_str12 gv_str13 gv_str14 gv_str15,
TABLE it_temp.

READ TABLE it_dd02l INTO wa_dd02l WITH KEY tabname = gv_str2.
IF sy-subrc IS NOT INITIAL.
CONTINUE.
ELSE.
gv_lkp_tab = gv_str2.
gv_line_no = wa_rsaabap2-line_no.
ENDIF.

ELSE.
READ TABLE it_rsaabap2 INDEX lv_idx_rsaabap2 INTO wa_rsaabap2.

REFRESH it_temp.
CLEAR: gv_str1, gv_str2, gv_str3, gv_str4, gv_str5, gv_str6, gv_str7, gv_str8, gv_str9,
gv_str10, gv_str11, gv_str12, gv_str13, gv_str14, gv_str15, wa_temp.

” Splitting the line of code word by word to different rows in a table.
SPLIT wa_rsaabap2-line AT space
INTO: gv_str1 gv_str2 gv_str3 gv_str4 gv_str5 gv_str6 gv_str7 gv_str8
gv_str9 gv_str10 gv_str11 gv_str12 gv_str13 gv_str14 gv_str15,
TABLE it_temp.

READ TABLE it_temp INTO wa_temp WITH KEY table_line = ‘FROM’.
IF sy-subrc IS INITIAL.
lv_idx_temp = sy-tabix + 1.
READ TABLE it_temp INDEX lv_idx_temp INTO wa_temp.
IF wa_temp IS NOT INITIAL.
READ TABLE it_dd02l INTO wa_dd02l WITH KEY tabname = wa_temp.
IF sy-subrc IS NOT INITIAL.
CONTINUE.
ELSE.
gv_lkp_tab = wa_temp.
gv_line_no = wa_rsaabap2-line_no.
ENDIF.
ENDIF.
ENDIF.

ENDIF.
ELSE.
CONTINUE.
ENDIF.

****************************** Creating the final output work area ******************************
” Populating the Work Area with values fetched from RSTRAN Table for the given user inputs.
wa_output-sourcename = wa_rstran2-sourcename.
wa_output-sourcetype = wa_rstran2-sourcetype.
wa_output-targetname = wa_rstran2-targetname.
wa_output-targettype = wa_rstran2-targettype.
wa_output-tranid = wa_rstran2-tranid.

” Populating the Work Area with values derived from logics implemented.
wa_output-lkd_up_objs = gv_lkp_tab.
wa_output-codeid = gv_prog_name.
wa_output-rout_type = gv_rout_type.
wa_output-line_no = gv_line_no.

APPEND wa_output TO it_output.
ENDLOOP.
ENDIF.
ENDFORM. ” READ_SELECT_CODE_INCLUDE
*&———————————————————————*
*& Form READ_INC_INCLUDE_PROGRAM
*&———————————————————————*
* text
*———————————————————————-*
* –>P_IT_CODE4 text
* –>P_WA_CODE4 text
* –>P_LV_IDX_CODE4 text
*———————————————————————-*
FORM read_inc_include_program TABLES it_code6 LIKE it_rsaabap
USING wa_code6 LIKE LINE OF it_rsaabap
lv_idx_code6 TYPE i.

DATA: lv_idx_temp TYPE i,
lv_idx_temp2 TYPE i,
lv_idx_rsaabap2 TYPE i,
lv_len_rsaabap2 TYPE i,
it_rsaabap2 TYPE STANDARD TABLE OF ty_code,
wa_rsaabap2 TYPE ty_code,
it_temp2 TYPE TABLE OF string.

FIELD-SYMBOLS: <fs_temp2> LIKE LINE OF it_temp2.

CLEAR: lv_idx_temp, lv_idx_temp2, lv_idx_rsaabap2, lv_len_rsaabap2, wa_rsaabap2.
REFRESH: it_rsaabap2.

wa_rsaabap2-line_no = wa_code6-line_no.
wa_rsaabap2-line = wa_code6-line.
APPEND wa_rsaabap2 TO it_rsaabap2.

WHILE wa_code6-line NS `IF FOUND.`.
lv_idx_code6 = lv_idx_code6 + 1.
READ TABLE it_code6 INDEX lv_idx_code6 INTO wa_code6.

wa_rsaabap2-line_no = wa_code6-line_no.
wa_rsaabap2-line = wa_code6-line.
APPEND wa_rsaabap2 TO it_rsaabap2.
ENDWHILE.

IF it_rsaabap2 IS NOT INITIAL.
CLEAR: lv_idx_code6.
LOOP AT it_rsaabap2 INTO wa_rsaabap2.
lv_idx_rsaabap2 = sy-tabix.

IF wa_rsaabap2-line CS ‘INCLUDE’.
lv_len_rsaabap2 = strlen( wa_rsaabap2-line ).
lv_len_rsaabap2 = lv_len_rsaabap2 – 7.

IF wa_rsaabap2-line+lv_len_rsaabap2(7) EQ ‘INCLUDE’.
lv_idx_rsaabap2 = lv_idx_rsaabap2 + 1.
READ TABLE it_rsaabap2 INDEX lv_idx_rsaabap2 INTO wa_rsaabap2.

REFRESH it_temp.
CLEAR: gv_str1, gv_str2, gv_str3, gv_str4, gv_str5, gv_str6, gv_str7, gv_str8, gv_str9,
gv_str10, gv_str11, gv_str12, gv_str13, gv_str14, gv_str15, wa_temp.

” Splitting the line of code word by word to different rows in a table.
SPLIT wa_rsaabap2-line AT space
INTO: gv_str1 gv_str2 gv_str3 gv_str4 gv_str5 gv_str6 gv_str7 gv_str8
gv_str9 gv_str10 gv_str11 gv_str12 gv_str13 gv_str14 gv_str15,
TABLE it_temp.

IF it_temp IS NOT INITIAL.
gv_prog_name = gv_str1.
ENDIF.

ELSEIF wa_rsaabap2-line+0(7) EQ ‘INCLUDE’.
READ TABLE it_rsaabap2 INDEX lv_idx_rsaabap2 INTO wa_rsaabap2.

REFRESH it_temp.
CLEAR: gv_str1, gv_str2, gv_str3, gv_str4, gv_str5, gv_str6, gv_str7, gv_str8, gv_str9,
gv_str10, gv_str11, gv_str12, gv_str13, gv_str14, gv_str15, wa_temp.

” Splitting the line of code word by word to different rows in a table.
SPLIT wa_rsaabap2-line AT space
INTO: gv_str1 gv_str2 gv_str3 gv_str4 gv_str5 gv_str6 gv_str7 gv_str8
gv_str9 gv_str10 gv_str11 gv_str12 gv_str13 gv_str14 gv_str15,
TABLE it_temp.

IF it_temp IS NOT INITIAL.
gv_prog_name = gv_str2.
ENDIF.

ELSE.
READ TABLE it_rsaabap2 INDEX lv_idx_rsaabap2 INTO wa_rsaabap2.

REFRESH it_temp.
CLEAR: gv_str1, gv_str2, gv_str3, gv_str4, gv_str5, gv_str6, gv_str7, gv_str8, gv_str9,
gv_str10, gv_str11, gv_str12, gv_str13, gv_str14, gv_str15, wa_temp.

” Splitting the line of code word by word to different rows in a table.
SPLIT wa_rsaabap2-line AT space
INTO: gv_str1 gv_str2 gv_str3 gv_str4 gv_str5 gv_str6 gv_str7 gv_str8
gv_str9 gv_str10 gv_str11 gv_str12 gv_str13 gv_str14 gv_str15,
TABLE it_temp.

READ TABLE it_temp INTO wa_temp WITH KEY table_line = ‘INCLUDE’.
IF sy-subrc IS INITIAL.
lv_idx_temp = sy-tabix + 1.
READ TABLE it_temp INDEX lv_idx_temp INTO wa_temp.
IF it_temp IS NOT INITIAL.
gv_prog_name = wa_temp.
ENDIF.
ENDIF.
ENDIF.

READ REPORT gv_prog_name INTO it_temp2.
IF it_temp2 IS NOT INITIAL.
CLEAR: wa_include2.
REFRESH: it_include2.
LOOP AT it_temp2 ASSIGNING <fs_temp2>.
SHIFT <fs_temp2> RIGHT DELETING TRAILING space.
SHIFT <fs_temp2> LEFT DELETING LEADING space.
TRANSLATE <fs_temp2> TO UPPER CASE.

lv_idx_temp2 = sy-tabix.
wa_include2-line_no = lv_idx_temp2.
wa_include2-line = <fs_temp2>.

APPEND wa_include2 TO it_include2.
ENDLOOP.
ENDIF.

wa_output-codeid = gv_prog_name.
PERFORM fetch_lookedup_objs_inc_inc TABLES it_include2.

ELSE.
CONTINUE.
ENDIF.

ENDLOOP.
ENDIF.
ENDFORM. ” READ_INC_INCLUDE_PROGRAM
*&———————————————————————*
*& Form FETCH_LOOKEDUP_OBJS_INC_INC
*&———————————————————————*
* text
*———————————————————————-*
* –>P_IT_INCLUDE text
*———————————————————————-*
FORM fetch_lookedup_objs_inc_inc TABLES it_code7 LIKE it_include.

DATA: lv_idx_code7 TYPE i,
wa_code7 TYPE ty_code.

FIELD-SYMBOLS: <fs_code7> TYPE ty_code.

CLEAR: lv_idx_code7, wa_code7.

DELETE it_code7[] WHERE line IS INITIAL.
SORT it_code7[] BY line_no line.

” Deleting the table entries i.e. the lines of code which actually are comments.
DELETE it_code7[] WHERE line+0(1) EQ ‘*’ OR line+0(1) EQ ‘”‘ OR line+0(1) EQ ‘.’.
DELETE it_code7[] WHERE line CS `ENDSELECT`
OR line CS `INCLUDE:`
OR line CS `INCLUDE STRUCTURE`
OR line CS `INCLUDE TYPE`.

IF it_code7[] IS NOT INITIAL.
LOOP AT it_code7[] ASSIGNING <fs_code7>.
SHIFT <fs_code7>-line RIGHT DELETING TRAILING space.
SHIFT <fs_code7>-line LEFT DELETING LEADING space.
TRANSLATE <fs_code7>-line TO UPPER CASE.
ENDLOOP.

LOOP AT it_code7[] INTO wa_code7.
lv_idx_code7 = sy-tabix.

IF wa_code7-line CS ‘SELECT’.
gv_prog_name = wa_output-codeid.
gv_rout_type = wa_output-rout_type.

PERFORM read_select_code_inc_inc TABLES it_code7
USING wa_code7
lv_idx_code7.
ELSE.
CONTINUE.
ENDIF.

ENDLOOP.

ENDIF.
ENDFORM. ” FETCH_LOOKEDUP_OBJS_INC_INC
*&———————————————————————*
*& Form READ_SELECT_CODE_INC_INC
*&———————————————————————*
* text
*———————————————————————-*
* –>P_IT_CODE7 text
* –>P_WA_CODE7 text
* –>P_LV_IDX_CODE7 text
*———————————————————————-*
FORM read_select_code_inc_inc TABLES it_code8 LIKE it_rsaabap
USING wa_code8 LIKE LINE OF it_rsaabap
lv_idx_code8 TYPE i.

DATA: lv_idx_temp TYPE i,
lv_idx_rsaabap2 TYPE i,
lv_len_rsaabap2 TYPE i,
it_rsaabap2 TYPE STANDARD TABLE OF ty_code,
wa_rsaabap2 TYPE ty_code.

CLEAR: lv_idx_temp, lv_idx_rsaabap2, lv_len_rsaabap2, wa_rsaabap2.
REFRESH: it_rsaabap2.

wa_rsaabap2-line_no = wa_code8-line_no.
wa_rsaabap2-line = wa_code8-line.
APPEND wa_rsaabap2 TO it_rsaabap2.

WHILE wa_code8-line NS ‘.’.
lv_idx_code8 = lv_idx_code8 + 1.
READ TABLE it_code8 INDEX lv_idx_code8 INTO wa_code8.

wa_rsaabap2-line_no = wa_code8-line_no.
wa_rsaabap2-line = wa_code8-line.
APPEND wa_rsaabap2 TO it_rsaabap2.
ENDWHILE.

IF it_rsaabap2 IS NOT INITIAL.
CLEAR: lv_idx_code8.
LOOP AT it_rsaabap2 INTO wa_rsaabap2.
lv_idx_rsaabap2 = sy-tabix.

IF wa_rsaabap2-line CS ‘FROM’.
lv_len_rsaabap2 = strlen( wa_rsaabap2-line ).
lv_len_rsaabap2 = lv_len_rsaabap2 – 4.

IF wa_rsaabap2-line+lv_len_rsaabap2(4) EQ ‘FROM’.
lv_idx_rsaabap2 = lv_idx_rsaabap2 + 1.
READ TABLE it_rsaabap2 INDEX lv_idx_rsaabap2 INTO wa_rsaabap2.

REFRESH it_temp.
CLEAR: gv_str1, gv_str2, gv_str3, gv_str4, gv_str5, gv_str6, gv_str7, gv_str8, gv_str9,
gv_str10, gv_str11, gv_str12, gv_str13, gv_str14, gv_str15, wa_temp.

” Splitting the line of code word by word to different rows in a table.
SPLIT wa_rsaabap2-line AT space
INTO: gv_str1 gv_str2 gv_str3 gv_str4 gv_str5 gv_str6 gv_str7 gv_str8
gv_str9 gv_str10 gv_str11 gv_str12 gv_str13 gv_str14 gv_str15,
TABLE it_temp.

READ TABLE it_dd02l INTO wa_dd02l WITH KEY tabname = gv_str1.
IF sy-subrc IS NOT INITIAL.
CONTINUE.
ELSE.
gv_lkp_tab = gv_str1.
gv_line_no = wa_rsaabap2-line_no.
ENDIF.

ELSEIF wa_rsaabap2-line+0(4) EQ ‘FROM’.
READ TABLE it_rsaabap2 INDEX lv_idx_rsaabap2 INTO wa_rsaabap2.

REFRESH it_temp.
CLEAR: gv_str1, gv_str2, gv_str3, gv_str4, gv_str5, gv_str6, gv_str7, gv_str8, gv_str9,
gv_str10, gv_str11, gv_str12, gv_str13, gv_str14, gv_str15, wa_temp.

” Splitting the line of code word by word to different rows in a table.
SPLIT wa_rsaabap2-line AT space
INTO: gv_str1 gv_str2 gv_str3 gv_str4 gv_str5 gv_str6 gv_str7 gv_str8
gv_str9 gv_str10 gv_str11 gv_str12 gv_str13 gv_str14 gv_str15,
TABLE it_temp.

READ TABLE it_dd02l INTO wa_dd02l WITH KEY tabname = gv_str2.
IF sy-subrc IS NOT INITIAL.
CONTINUE.
ELSE.
gv_lkp_tab = gv_str2.
gv_line_no = wa_rsaabap2-line_no.
ENDIF.

ELSE.
READ TABLE it_rsaabap2 INDEX lv_idx_rsaabap2 INTO wa_rsaabap2.

REFRESH it_temp.
CLEAR: gv_str1, gv_str2, gv_str3, gv_str4, gv_str5, gv_str6, gv_str7, gv_str8, gv_str9,
gv_str10, gv_str11, gv_str12, gv_str13, gv_str14, gv_str15, wa_temp.

” Splitting the line of code word by word to different rows in a table.
SPLIT wa_rsaabap2-line AT space
INTO: gv_str1 gv_str2 gv_str3 gv_str4 gv_str5 gv_str6 gv_str7 gv_str8
gv_str9 gv_str10 gv_str11 gv_str12 gv_str13 gv_str14 gv_str15,
TABLE it_temp.

READ TABLE it_temp INTO wa_temp WITH KEY table_line = ‘FROM’.
IF sy-subrc IS INITIAL.
lv_idx_temp = sy-tabix + 1.
READ TABLE it_temp INDEX lv_idx_temp INTO wa_temp.
IF wa_temp IS NOT INITIAL.
READ TABLE it_dd02l INTO wa_dd02l WITH KEY tabname = wa_temp.
IF sy-subrc IS NOT INITIAL.
CONTINUE.
ELSE.
gv_lkp_tab = wa_temp.
gv_line_no = wa_rsaabap2-line_no.
ENDIF.
ENDIF.
ENDIF.

ENDIF.
ELSE.
CONTINUE.
ENDIF.

****************************** Creating the final output work area ******************************
” Populating the Work Area with values fetched from RSTRAN Table for the given user inputs.
wa_output-sourcename = wa_rstran2-sourcename.
wa_output-sourcetype = wa_rstran2-sourcetype.
wa_output-targetname = wa_rstran2-targetname.
wa_output-targettype = wa_rstran2-targettype.
wa_output-tranid = wa_rstran2-tranid.

” Populating the Work Area with values derived from logics implemented.
wa_output-lkd_up_objs = gv_lkp_tab.
wa_output-codeid = gv_prog_name.
wa_output-rout_type = gv_rout_type.
wa_output-line_no = gv_line_no.

APPEND wa_output TO it_output.
ENDLOOP.
ENDIF.
ENDFORM. ” READ_SELECT_CODE_INC_INC

************************************ End of FORMS **************************************



Text Elements –

Tool to list down the Looked-up Tables in any Transformation in SAP BI


Hope the tool helps and brings you an easy life.

GOOD LUCK!!

Okumaya devam et...
 
Üst