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

Submit statement

Former Member
0 Likes
1,668

Hi Experts,

I want to call two programs into main program.

Program1 having 5 fields on the selection screen and

Program2 is having 7 fields on the selection screen.

Main program selection screen is having three fields (three select-option fields), which are common selection fields in the program1 and program2.

My requirement is to pass the three selection screen fields from the main program to program1 and program2 and return some data say itab from program1 and say xtab from program2.

Please help me in writing a submit statement for this.

Regards,

Venkat

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,614

Hi Aman,

I did in the same way you described with an example in the above thread. Logic. But still it was displaying the program1 list output.

Actually the progra1 and program2 are two separate program with ALV list display.

Even I did in the same way as you given in the sample example, because the program1 is having ALV display statements;After submit statement in the main program it is printing the ALV of program1 and then it is coming back to the main program.

Regards,

Venkat

15 REPLIES 15
Read only

Former Member
0 Likes
1,614

report main program

SUBMIT program1 USING SELECTION-SCREEN 'nnnn'

WITH SELECTION-TABLE rspar_tab1(selection parameter of main program)

WITH SELECTION-TABLE rspar_tab2(selection parameter of main program)

WITH SELECTION-TABLE rspar_tab3(selection parameter of main program) "same selection field for both the programs

WITH selcrit2 IN range_tab " for different field.

AND RETURN.

Read only

Former Member
0 Likes
1,614

Try this.

>DATA: seltab LIKE rsparams OCCURS 0.

>

>AT SELECTION-SCREEN.

>* perform user-commands on screen

> CASE sy-ucomm.

>* Submit Report .

> WHEN 'SUBMIT'. "Submit Report

> CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'

> EXPORTING

> curr_report = 'ZMAIN_PROGRAM'

> TABLES

> selection_table = seltab.

> SUBMIT zprogram1 AND RETURN WITH SELECTION-TABLE seltab.

> ENDCASE.

Read only

Former Member
0 Likes
1,614

Hi Experts,

Can you explain in more detail please...

Regards,

Venkat

Read only

0 Likes
1,614

The seltab will have all the parameters from the main program and will be passed on to the next program which got submitted from it.

Other way you can export the parameters to memory and retrieve from another program.

PLease check statement EXPORT to MEMORY as well.

hope this helps.

A

Read only

Former Member
0 Likes
1,614

Hi Aman,

Thank you very much for the quick response.

How to return the data from program1 and program2?

I need to consolidate the data of both the programs in the main program.

Regards,

Venkat

Read only

0 Likes
1,614

Use Export to memory and Import from memory statements.

A

Read only

Former Member
0 Likes
1,614

Hi Aman,

I did in the same way as you suggested.

I am able to read the internal table values from program1.

But it is displaying the program1 list output first, then the control is coming back to the main program with required data of program1.

I don’t want to display the program1 output; I need only the data from it.

Regards,

Venkat

Read only

0 Likes
1,614

Try this way.

> SUBMIT zp_adp_number_check

> AND RETURN WITH SELECTION-TABLE seltab

> EXPORTING LIST TO MEMORY.

To retrieve the list u can use

>DATA list_tab TYPE TABLE OF abaplist.

>CALL FUNCTION 'LIST_FROM_MEMORY'

> TABLES

> listobject = list_tab

> EXCEPTIONS

> not_found = 1

> OTHERS = 2.

>

>IF sy-subrc = 0.

> CALL FUNCTION 'WRITE_LIST'

> TABLES

> listobject = list_tab.

>ENDIF.

Read only

Former Member
0 Likes
1,614

Hi Aman,

The program is going to dump.

Please correct me if I am wrong from the following code:

SUBMIT program1 WITH s_matnr IN s_matnr

WITH s_ersda IN s_ersda

AND RETURN

EXPORTING LIST TO MEMORY.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = list_tab

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc = 0.

CALL FUNCTION 'WRITE_LIST'

TABLES

listobject = list_tab.

ENDIF.

Regards,

Venkat

Read only

0 Likes
1,614

Sample code.

REPORT 1.

REPORT zsubmit_main.

DATA: lv_pernr TYPE persno.

DATA: seltab LIKE rsparams OCCURS 0.

DATA: itab TYPE TABLE OF pa0000.

SELECT-OPTIONS pernr FOR lv_pernr.

CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'

EXPORTING

curr_report = 'ZSUBMIT_MAIN'

TABLES

selection_table = seltab.

SUBMIT zsubmit_main1 AND RETURN WITH SELECTION-TABLE seltab .

IMPORT itab FROM MEMORY ID 'pernr'.

BREAK-POINT.

REPORT 2.

DATA: itab TYPE TABLE OF pa0000,

lv_pernr TYPE persno.

SELECT-OPTIONS pernr FOR lv_pernr.

BREAK-POINT.

SELECT * FROM pa0000 INTO TABLE itab WHERE pernr IN pernr.

EXPORT itab TO MEMORY ID 'pernr'.

Read only

Former Member
0 Likes
1,614

Hi Aman,

Still It is displaynig the list output of the program1 before control goes to main program.

Can you correct me in the following code?

SUBMIT program1 WITH s_matnr IN s_matnr

WITH s_ersda IN s_ersda

AND RETURN

EXPORTING LIST TO MEMORY.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = list_tab

EXCEPTIONS

not_found = 1

OTHERS = 2.

Regards,

Venkat

Read only

0 Likes
1,614

Use my previous thread logic.

Thanks

A

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Apr 21, 2008 5:49 PM

Read only

Former Member
0 Likes
1,615

Hi Aman,

I did in the same way you described with an example in the above thread. Logic. But still it was displaying the program1 list output.

Actually the progra1 and program2 are two separate program with ALV list display.

Even I did in the same way as you given in the sample example, because the program1 is having ALV display statements;After submit statement in the main program it is printing the ALV of program1 and then it is coming back to the main program.

Regards,

Venkat

Read only

0 Likes
1,614

If Program 2 is called from a submit statement from the main program, avoid printing. you can pass a flag which would assume this program is called from another program and you can avoid printing. If you need to retrieve the table of program 1 and 2 in main program use Export to memory statement. I hope this is clear.

A

Read only

Former Member
0 Likes
1,614

Hi Aman,

It is working now.

Thank you very much for your quick response and for the perfect solution.

Regards,

Venkat