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: 

nested submit program

0 Kudos

if i call program B from program A and then call program C from program B using submit program statement i.e.

A->submit program B->B->submit program C-> C

then how can i get execution sequence number for each program? i.e 1 for A, 2 for B etc

i didn't find any system field.

Please suggest.

1 ACCEPTED SOLUTION

wgerbert
Explorer

I solved this by adding a hidden parameter in the selection screen:

PARAMETERS: pa_mode TYPE char1 NO-DISPLAY.

Then you can get back your selection screen data and set the parameter for the next submit.

DATA: lt_sel TYPE TABLE OF rsparams.
FIELD-SYMBOLS: <rsparam> LIKE LINE OF lt_sel.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = sy-cprog
* IMPORTING
* SP =
TABLES
selection_table = lt_sel
* SELECTION_TABLE_255 =
EXCEPTIONS
not_found = 1
no_report = 2
OTHERS = 3
.
LOOP AT lt_sel ASSIGNING <rsparam> WHERE selname = 'PA_MODE'.
<rsparam>-low = 'X'.
ENDLOOP.
SUBMIT zreport WITH SELECTION-TABLE lt_sel AND RETURN.
7 REPLIES 7

satyapriyanka_vana
Active Participant

Hi,

I don't know whether there is such parameter exists to count the sequence. But you can calculate it in each program you are calling.

Eg.

In Prog A define count as 1 and export to memory.In the calling program B import the parameter from memory and add 1 to it. same procedure follows for the second calling prog as well. I am not sure whether this is an effective idea or not, but sharing my thought on this.

Regards,

Priyanka.

former_member182550
Active Contributor

There isn't one, but you can look at the system call stack using function module SYSTEM_CALLSTACK.

Rich

It works only for the current internal session (only the stack of all CALL and PERFORM in the current program). SUBMIT starts a new internal session.

wgerbert
Explorer

I solved this by adding a hidden parameter in the selection screen:

PARAMETERS: pa_mode TYPE char1 NO-DISPLAY.

Then you can get back your selection screen data and set the parameter for the next submit.

DATA: lt_sel TYPE TABLE OF rsparams.
FIELD-SYMBOLS: <rsparam> LIKE LINE OF lt_sel.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = sy-cprog
* IMPORTING
* SP =
TABLES
selection_table = lt_sel
* SELECTION_TABLE_255 =
EXCEPTIONS
not_found = 1
no_report = 2
OTHERS = 3
.
LOOP AT lt_sel ASSIGNING <rsparam> WHERE selname = 'PA_MODE'.
<rsparam>-low = 'X'.
ENDLOOP.
SUBMIT zreport WITH SELECTION-TABLE lt_sel AND RETURN.

matt
Active Contributor
0 Kudos

If you properly design your programs and move the data getting logic into a separate class or function module from the display logic, you don't need to use SUBMIT at all.

0 Kudos

You are corrrect . In this case I needed a new logical session though.

matt
Active Contributor
0 Kudos

CALL FUNCTION 'XXXX' DESTINATION 'NONE will give a new session, without the mixing of view and model coding.