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

Read Program code from another program

Former Member
0 Likes
1,392

Hi,

I would like have ABAP code which reads another program and displays the coding of it.

Regards,

Vijayakumar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
925

HI,

use this simple code.


DATA prog TYPE c LENGTH 30.
DATA:itab TYPE TABLE OF string,
     wa type string.

prog = 'ZEXAMPLE1'."here give the program name that u want to read in upper case

READ REPORT prog INTO itab.

LOOP AT itab INTO wa.
  WRITE:/ wa.
ENDLOOP.

rgds,

bharat.

4 REPLIES 4
Read only

Former Member
0 Likes
925

hi,

Make an include program and use it in your program ...

Regards,

Santosh

Read only

Former Member
0 Likes
926

HI,

use this simple code.


DATA prog TYPE c LENGTH 30.
DATA:itab TYPE TABLE OF string,
     wa type string.

prog = 'ZEXAMPLE1'."here give the program name that u want to read in upper case

READ REPORT prog INTO itab.

LOOP AT itab INTO wa.
  WRITE:/ wa.
ENDLOOP.

rgds,

bharat.

Read only

Former Member
0 Likes
925

Hi,

Here is a sample code to call another program using 'SUBMIT'

REPORT ZREP1.

write : 'x'.

-


REPORT ZREP2 NO STANDARD PAGE HEADING.

SUBMIT zrep1 VIA SELECTION-SCREEN

WITH PARAMET EQ 'Selection 1'

AND RETURN.

Read only

Former Member
0 Likes
925

HI,

The SUBMIT statement accesses an executable program rep. The executable program is executed as described under Calling Executable Reports.

The program name rep can either be specified directly or as the content of a character-like data object name. The data object name must contain the name of the program to be accessed in block capitals. If the program specified in name is not found, an irretrievable exception is generated.

The selscreen_options additions can be used to determine the selection screen for the program accessed and to supply it with values.

The list_options additions allow you to influence the output medium and the page size in the basic list for the program accessed.

You can schedule the program for background processing by specifying job_options.

Addition

... AND RETURN

Effect

The AND RETURN addition determines the object accessed by the runtime environment after program access is completed:

Without the AND RETURN addition, the internal session of the program accessed replaces the internal session of the calling program in the same position in the call sequence. Once program access is completed, the system returns to before the position from which the calling program was started.

As of Release 6.10, the content of the system field sy-calld at SUBMIT is copied by the calling program without AND RETURN. Before 6.10, the system entered the value "X", which was incorrect when the program was accessed from the first program in a call sequence.

The addition AND RETURN starts the executable program in a new internal session. The session for the calling program is retained. Once program access is completed, program execution for the calling program continues after the SUBMIT statement.

Note

When the SUBMIT statement is executed, the system runs an authorization check for the authorization group specified in the program attributes.

Regards,

Sunil Kumar Mutyala...................