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

Change a program programatically

Former Member
0 Likes
833

Hi ,

i have generated program with Z name and i want to modifty some things in it. Is this possible doing programatically ?

warm regards,

Sowmya

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
789

Create 2 reports. ZREPORT1 and ZREPORT2. Keep ZREPORT2 blank. Write any code in ZREPORT1.

Execute the code below.

REPORT  ZSUM_T1.

DATA: CODE(72) TYPE C OCCURS 0,
CODE1 LIKE LINE OF CODE,
CODE2(72) TYPE C OCCURS 0.
PARAMETERS: PROGRAM LIKE SY-REPID.

START-OF-SELECTION.
  READ REPORT 'ZREPORT1' INTO CODE.         " READS CODE OF ZREPORT1
  IF SY-SUBRC NE 0.
    MESSAGE 'Report does not exist!' TYPE 'E'.
  ENDIF.

  LOOP AT CODE INTO CODE1.
    APPEND CODE1 TO CODE2.
  ENDLOOP.


  INSERT REPORT 'ZREPORT2' FROM CODE2.  " INSERT CODE OF ZREPORT1 INTO ZREPORT2.

REGARDS,

SUMIT NENE

4 REPLIES 4
Read only

Former Member
0 Likes
789

you are talking about the prestep af an ABAP virus?

Read only

Former Member
0 Likes
790

Create 2 reports. ZREPORT1 and ZREPORT2. Keep ZREPORT2 blank. Write any code in ZREPORT1.

Execute the code below.

REPORT  ZSUM_T1.

DATA: CODE(72) TYPE C OCCURS 0,
CODE1 LIKE LINE OF CODE,
CODE2(72) TYPE C OCCURS 0.
PARAMETERS: PROGRAM LIKE SY-REPID.

START-OF-SELECTION.
  READ REPORT 'ZREPORT1' INTO CODE.         " READS CODE OF ZREPORT1
  IF SY-SUBRC NE 0.
    MESSAGE 'Report does not exist!' TYPE 'E'.
  ENDIF.

  LOOP AT CODE INTO CODE1.
    APPEND CODE1 TO CODE2.
  ENDLOOP.


  INSERT REPORT 'ZREPORT2' FROM CODE2.  " INSERT CODE OF ZREPORT1 INTO ZREPORT2.

REGARDS,

SUMIT NENE

Read only

Former Member
0 Likes
789

thanks sumit.

do u have any idea how i can execute the code in code2 as per u r logic?

Read only

0 Likes
789

After INSERT statement,

use--

SUBMIT REPORT ZREPORT2.

    • what exactly is that you are trying to achieve here?

Regards,

Sumit