Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

copying certain lines

Former Member
0 Likes
705

hi

i am developing a report that will read another report code.

here i want to copy certain lines of code once again i.e. if there is upload function called in the report i want to copy all the parameters that are there in the report.

can some one tell me how can i copy code that is there in between 18 and 48(sy-tabix) of a report ?

thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
610

If you have data in internal table use:

Loop at itab inot ws_itab.

If ws_itab CS  'CAll FUNCTION'         
Set the flag
ENDIF.

IF flag = 'X'.

copy the codes.

elseif flag = 'X' and ws_itab CS 'ENDIF'.
flag = 'X'.

Endif.

Else:

Use :SCAN-ABAP SOURCE STATEMENT.

[SCAN-ABAP|http://help.sap.com/abapdocu/en/ABAPSCAN.htm]

Regards,

Gurpreet

4 REPLIES 4
Read only

Former Member
0 Likes
611

If you have data in internal table use:

Loop at itab inot ws_itab.

If ws_itab CS  'CAll FUNCTION'         
Set the flag
ENDIF.

IF flag = 'X'.

copy the codes.

elseif flag = 'X' and ws_itab CS 'ENDIF'.
flag = 'X'.

Endif.

Else:

Use :SCAN-ABAP SOURCE STATEMENT.

[SCAN-ABAP|http://help.sap.com/abapdocu/en/ABAPSCAN.htm]

Regards,

Gurpreet

Read only

Former Member
0 Likes
610

USE BELOW SYNTAX.

DATA: IT TYPE TABLE OF STRING.

READ REPORT 'REPORT NAME' INTO TABLE IT.

LOOP AT IT INTO WA.

HERE YOU CAN CHECK FOR THE CALL FUNCTION STATEMENT.

YOU CAN USE 'SEARCH' KEYWORD FOR IT..

ENDLOOP.

Read only

Former Member
0 Likes
610

Assume the following simple report:

REPORT ZSTRUC1.

WRITE / 'Hello, I am a little structure!'.

and the following lines of another program:

DATA CODE(72) OCCURS 10.

READ REPORT 'ZSTRUC1' INTO CODE.

APPEND 'SKIP.' TO CODE.

APPEND 'WRITE / ''and I am a dynamic extension!''.' TO CODE.

INSERT REPORT 'ZDYN2' FROM CODE.

so in this way u can copy lines and edit from one report to other..

Regards,

Anirban.

Read only

Former Member
0 Likes
610

thanks alot got it