2016 Sep 28 6:34 AM
Hi Experts,
I need to find in the report where any sort are present inside the loop,we have almost 500 developments so it is impossible to look into it manually.
So we are writing a report to display the list.
Can anyone provide me some sample code for this .
Thanks in advance.
Hi Experts,
I need to find in the report where any sort are present inside the loop,we have almost 500 developments so it is impossible to look into it manually.
So we are writing a report to display the list.
Can anyone provide me some sample code for this .
Thanks in advance.
2016 Sep 28 6:43 AM
2016 Sep 28 7:12 AM
Hi Raymond Giuseppi,
If we are using standard reports/T-Codes it is displaying all the records of sorts even if it is not inside the loop.
As suggested i had got all the coding lines of the report by using read report after that once this is successfully we are planning it to extend for select inside loop etc.we don't want to run many times to loops the same internal table.
we are searching for the better way.we are planning to code by using of Keyword:Find all occurence of regex
Thanks.
2016 Sep 28 6:49 AM
2016 Sep 28 8:31 AM
Hi Vinay,
You could try with below code:
TYPES : BEGIN OF gx_comm,
name TYPE char15,
start TYPE int4,
end TYPE int4,
END OF gx_comm,
BEGIN OF abapsource,
line TYPE char255,
END OF abapsource.
DATA : lt_command TYPE TABLE OF gx_comm,
lt_loop TYPE TABLE OF gx_comm,
lt_read TYPE TABLE OF gx_comm,
wa_command LIKE LINE OF lt_command,
wa_read LIKE LINE OF lt_read,
wa_loop LIKE LINE OF lt_loop,
lv_line TYPE int4,
lv_counter TYPE int4,
lv_found TYPE char1,
lt_source TYPE TABLE OF abapsource,
wa_source LIKE LINE OF lt_source.
FIELD-SYMBOLS : <loop> LIKE LINE OF lt_command.
PARAMETERS : p_report TYPE sobj_name.
READ REPORT p_report INTO lt_source.
LOOP AT lt_source INTO wa_source.
lv_line = sy-tabix.
IF wa_source-line CS 'SORT'.
wa_read-name = 'SORT'.
wa_read-start = sy-tabix.
APPEND wa_read TO lt_read.
ELSEIF wa_source-line CS 'LOOP AT'.
wa_command-name = 'LOOP'.
wa_command-start = sy-tabix.
APPEND wa_command TO lt_command.
lv_counter = lv_counter + 1.
ELSEIF wa_source-line CS 'ENDLOOP'.
READ TABLE lt_command ASSIGNING <loop> INDEX lv_counter.
IF sy-subrc EQ 0.
<loop>-end = lv_line.
APPEND <loop> TO lt_loop.
DELETE lt_command INDEX lv_counter.
lv_counter = lv_counter - 1.
ENDIF.
ENDIF.
ENDLOOP.
LOOP AT lt_read INTO wa_read.
LOOP AT lt_loop INTO wa_loop WHERE start LT wa_read-start
AND end GT wa_read-start.
EXIT.
ENDLOOP.
IF sy-subrc EQ 0.
lv_found = 'X'.
EXIT.
ENDIF.
ENDLOOP.
Reagrds,
Pranav