Application Development 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: 

Calling selection screen from another selecton screen.

Former Member
0 Kudos

Hi guys,

I want to call default selection screen of one program from default selection screen of another program.

Is that possible . would appreciate some helpful answers.

Thanks,

Venkat.

3 REPLIES 3

0 Kudos

Hi,

You can use SUBMIT keyword to call another program.

Or else you can use CALL TRNASACTION to call that report.

Regards,

Sesh

Former Member
0 Kudos

it is possiable.

1.submit

2. call transcation t_code.

Syntax

SUBMIT <prog>.

For more information about the SUBMIT statement, see Calling Executable Programs (Reports)

Assume the following simple report:

REPORT ZDYN3.

WRITE / 'Dynamic Program!'.

The following executable program (report) starts, modifies, and restarts ZDYN3:

REPORT ZMASTER1.

DATA CODE(72) OCCURS 10.

DATA LIN TYPE I.

READ REPORT 'ZDYN3' INTO CODE.

SUBMIT ZDYN3 AND RETURN.

DESCRIBE TABLE CODE LINES LIN.

MODIFY CODE INDEX LIN FROM

'WRITE / ''Dynamic Program Changed!''.'.

INSERT REPORT 'ZDYN3' FROM CODE.

SUBMIT ZDYN3.

The output of this program is displayed on two subsequent output screens. The first screen displays:

Dynamic Program!

The second screen displays:

Dynamic Program Changed !

When you use the SUBMIT statement, all modifications made to a program during runtime take immediate effect before they are submitted. In the above example, ZDYN3 is submitted from ZMASTER1 first in its original and then in its modified form, generating different results.

This is not the case if you change the codes of include programs or subroutines dynamically.

Assume the following include program:

      • INCLUDE ZINCLUD1.

WRITE / 'Original INCLUDE program!'.

and an executable program (report) for modifying and including it:

REPORT ZMASTER2.

DATA CODE(72) OCCURS 10.

DATA LIN TYPE I.

READ REPORT 'ZINCLUD1' INTO CODE.

DESCRIBE TABLE CODE LINES LIN.

MODIFY CODE INDEX LIN FROM

'WRITE / ''Changed INCLUDE program!''.'.

INSERT REPORT 'ZINCLUD1' FROM CODE.

INCLUDE ZINCLUD1.

If you run ZMASTER2, the source code of include program ZINCLUD1 is changed and replaced in the system. However, the last line of ZMASTER2 executes the older version since the runtime object of ZMASTER2 is generated before ZINCLUD1 is modified. Only when ZMASTER2 is run a second time, does the system determine that ZINCLUD1 has been changed. Exactly the same is true if you dynamically modify the source code of a subroutine and call it from within the same program.

One way to solve this problem is to use the INCLUDE statement within an external subroutine that is called by the program. This allows you to create or modify include programs or subroutines and use the updated versions directly in the same program.

Assume the following include program:

      • INCLUDE ZINCLUD1.

WRITE / 'Original INCLUDE program!'.

and an external subroutine:

PROGRAM ZFORM1.

FORM SUB1.

INCLUDE ZINCLUD1.

ENDFORM.

The following program reads the include program, modifies it, enters it back into the system, and calls the subroutine.

REPORT ZMASTER3.

DATA CODE(72) OCCURS 10.

READ REPORT 'ZINCLUD1' INTO CODE.

APPEND 'WRITE / ''Extension of INCLUDE program!''.' TO CODE.

INSERT REPORT 'ZINCLUD1' FROM CODE.

PERFORM SUB1(ZFORM1).

This produces the following output:

Original INCLUDE program!

Extension of INCLUDE program!

In this case, the updated version of the include program is used in the subroutine because its time stamp is checked when the subroutine is called, and not when the calling program is generated.

Former Member
0 Kudos

Thanks guys that was helpful enough to solve my question.