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

Using SUBMIT in FM

Former Member
0 Likes
4,223

Hi,

I am working with BW/BPS and I am required to write an exit function, and this exit function is sepcified in the planning function to be called from BPS. My question is - I created a FM and it only has a SUBMIT statement in the FM, how can I get it to stay at the current screen after the FM finishes? I tried to use the AND RETURN, but I would get a grey screen instead of staying at the current screen.

Is there any other way to call an executable program from this function module?

Please advise,

RT

1 ACCEPTED SOLUTION
Read only

Former Member
2,255

Hai Rob

Check the following Link

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/submit.htm

SUBMIT

Basic form

SUBMIT rep.

Additions

1. ... LINE-SIZE col

2. ... LINE-COUNT lin

3. ... TO SAP-SPOOL

4. ... VIA SELECTION-SCREEN

5. ... AND RETURN

6. ... EXPORTING LIST TO MEMORY

7. ... USER user VIA JOB job NUMBER n

8. ... Various additions for parameter transfer to rep

9. ... USING SELECTION-SETS OF PROGRAM prog

Effect

Calls the report rep . Leaves the active program and starts the new report rep .

Addition 1

... LINE-SIZE col

Effect

Prints the report with the line width col .

Addition 2

... LINE-COUNT lin

Effect

Prints the report with lin lines (per page).

Addition 4

... VIA SELECTION-SCREEN

Effect

Displays the selection screen for the user. In this case, the selection screen is redisplayed after return from the report list display - the user's entries are retained.

Addition 5

... AND RETURN

Effect

Returns to the calling transaction or program after the called program has been executed. SUBMIT ... AND RETURN creates a new internal mode .

Addition 6

... EXPORTING LIST TO MEMORY

Effect

Does not display the output list of the called report, but saves it in SAP memory and leaves the called report immediately. Since the calling program can read the list from memory and process it further, you need to use the addition ... AND RETURN . Also, since the called report cannot be requested for printing, the addition ... TO SAP-SPOOL is not allowed here. You can read the saved list from SAP memory with the function module 'LIST_FROM_MEMORY' and then (for example) store it in the database with EXPORT . You can process this list further with the function modules 'WRITE_LIST' , 'DISPLAY_LIST' ... of the function group "SLST" .

Addition 7

... USER user VIA JOB job NUMBER n

Effect

Schedules the specified report in the job specified by the job name job and the job number n . The job runs under the user name user and you can omit the addition USER user . The assignment of the job number occurs via the function module JOB_OPEN (see also the documentation for the function modules JOB_CLOSE and JOB_SUBMIT . This addition can only be used with the addition ...AND RETURN .

Note

When scheduling a report with the SUBMIT ... VIA JOB job NUMBER n statement, you should always use the addition ...TO SAP-SPOOL to pass print and/or archive parameters. Otherwise, default values are used to generate the list and this disturbs operations in a production environment.

Addition 9

... USING SELECTION-SETS OF PROGRAM prog

Effect

Uses variants of the program prog when executing the program rep .

Note

Important

The programs prog and rep must have the same SELECT-OPTIONS and PARAMETER s. Otherwise, variants of the program prog may be destroyed.

Note

When using this addition, the specified variant vari of the program prog is taken in USING SELECTION-SET vari . On the other hand, all variant-related actions on the selection screen of rep (Get , Save as variant , Display , Delete ) refer to the variants of prog .

Example

SUBMIT REPORT01

VIA SELECTION-SCREEN

USING SELECTION-SET 'VARIANT1'

USING SELECTION-SETS OF PROGRAM 'REPORT00'

AND RETURN.

Effect

Executes the program REPORT01 with the variant VARIANT1 of the program REPORT00 .

Note

Runtime errors

LOAD_PROGRAM_NOT_FOUND : The specified program was not found.

SUBMIT_WRONG_TYPE : The specified program is not a report.

SUBMIT_IMPORT_ONLY_PARAMETER : Only one value passed to a report parameter.

SUBMIT_WRONG_SIGN : Invalid value passed to a selection with the addition SIGN .

SUBMIT_IN_ITAB_ILL_STRUCTURE : Table passed to a selection with WITH sel IN itab had an unexpected structure.

Thanks & regards

Sreenivasulu P

10 REPLIES 10
Read only

Former Member
2,256

Hai Rob

Check the following Link

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/submit.htm

SUBMIT

Basic form

SUBMIT rep.

Additions

1. ... LINE-SIZE col

2. ... LINE-COUNT lin

3. ... TO SAP-SPOOL

4. ... VIA SELECTION-SCREEN

5. ... AND RETURN

6. ... EXPORTING LIST TO MEMORY

7. ... USER user VIA JOB job NUMBER n

8. ... Various additions for parameter transfer to rep

9. ... USING SELECTION-SETS OF PROGRAM prog

Effect

Calls the report rep . Leaves the active program and starts the new report rep .

Addition 1

... LINE-SIZE col

Effect

Prints the report with the line width col .

Addition 2

... LINE-COUNT lin

Effect

Prints the report with lin lines (per page).

Addition 4

... VIA SELECTION-SCREEN

Effect

Displays the selection screen for the user. In this case, the selection screen is redisplayed after return from the report list display - the user's entries are retained.

Addition 5

... AND RETURN

Effect

Returns to the calling transaction or program after the called program has been executed. SUBMIT ... AND RETURN creates a new internal mode .

Addition 6

... EXPORTING LIST TO MEMORY

Effect

Does not display the output list of the called report, but saves it in SAP memory and leaves the called report immediately. Since the calling program can read the list from memory and process it further, you need to use the addition ... AND RETURN . Also, since the called report cannot be requested for printing, the addition ... TO SAP-SPOOL is not allowed here. You can read the saved list from SAP memory with the function module 'LIST_FROM_MEMORY' and then (for example) store it in the database with EXPORT . You can process this list further with the function modules 'WRITE_LIST' , 'DISPLAY_LIST' ... of the function group "SLST" .

Addition 7

... USER user VIA JOB job NUMBER n

Effect

Schedules the specified report in the job specified by the job name job and the job number n . The job runs under the user name user and you can omit the addition USER user . The assignment of the job number occurs via the function module JOB_OPEN (see also the documentation for the function modules JOB_CLOSE and JOB_SUBMIT . This addition can only be used with the addition ...AND RETURN .

Note

When scheduling a report with the SUBMIT ... VIA JOB job NUMBER n statement, you should always use the addition ...TO SAP-SPOOL to pass print and/or archive parameters. Otherwise, default values are used to generate the list and this disturbs operations in a production environment.

Addition 9

... USING SELECTION-SETS OF PROGRAM prog

Effect

Uses variants of the program prog when executing the program rep .

Note

Important

The programs prog and rep must have the same SELECT-OPTIONS and PARAMETER s. Otherwise, variants of the program prog may be destroyed.

Note

When using this addition, the specified variant vari of the program prog is taken in USING SELECTION-SET vari . On the other hand, all variant-related actions on the selection screen of rep (Get , Save as variant , Display , Delete ) refer to the variants of prog .

Example

SUBMIT REPORT01

VIA SELECTION-SCREEN

USING SELECTION-SET 'VARIANT1'

USING SELECTION-SETS OF PROGRAM 'REPORT00'

AND RETURN.

Effect

Executes the program REPORT01 with the variant VARIANT1 of the program REPORT00 .

Note

Runtime errors

LOAD_PROGRAM_NOT_FOUND : The specified program was not found.

SUBMIT_WRONG_TYPE : The specified program is not a report.

SUBMIT_IMPORT_ONLY_PARAMETER : Only one value passed to a report parameter.

SUBMIT_WRONG_SIGN : Invalid value passed to a selection with the addition SIGN .

SUBMIT_IN_ITAB_ILL_STRUCTURE : Table passed to a selection with WITH sel IN itab had an unexpected structure.

Thanks & regards

Sreenivasulu P

Read only

Former Member
0 Likes
2,255

Hi,

Use leave to list-processing

Regards

Amole

Read only

Former Member
0 Likes
2,255

I believe this is happening because its a remote one. Probably you can check this by commenting the submit and writing the code there.

rgds,

TM

Read only

Former Member
0 Likes
2,255

Hi,

Try this,

SUBMIT rep_name VIA SELECTION-SCREEN AND RETURN .

When u do submit program it executes the report directly.

But when u use VIA SELECTION-SCREEN it stops at the screen .

Hope It helps

<b>Please Mark Helpful Answers</b>

regards

Read only

0 Likes
2,255

Hi,

Thanks to all. Here is my call and it brought me to the selecion screen of the executable program. I had to try the arrows several times to get back to he BPS screen.

SUBMIT Z_BPS_TEST VIA SELECTION-SCREEN

WITH P_AREA = I_AREA

WITH P_LEVEL = I_PLEVEL

WITH P_PCKGE = I_PACKAGE

AND RETURN.

I would think it should work because the executable program is in the same system. If there are no other options then I would have to addd the code in the FM. The problem that I having is the executable program updates all my tables but when BPS call the FM, all my updates are not processing.

Any other ideas?

Thanks,

RT

Read only

0 Likes
2,255

Hi Thomas,

Can u explain the flow so i can try to help.

where u wnt to save the data .

what u have do in the submit Program.

Contact

manoj.baijnath@wipro.com

Read only

0 Likes
2,255

Hi Manoj,

Thanks for the offer. Actually it would be nice to have this working for me, but I have another solution to this.

Here is my code

SUBMIT Z_BPS_TEST VIA SELECTION-SCREEN

WITH P_AREA = I_AREA

WITH P_LEVEL = I_PLEVEL

WITH P_PCKGE = I_PACKAGE

AND RETURN.

COMMIT WORK.

I ran this FM from the BPS planning function but it kept routing me to the program Z_BPS_TEST selection screen.

Thanks to all.

Regards,

RT

Read only

Former Member
0 Likes
2,255

Hi Thomas,

I think ur problem was solved ; may i know what is ur problem is can help u.

Is there any issue.

Try <b>Commit Work</b> in the FM.

Regards

Message was edited by: Manoj Gupta

Read only

0 Likes
2,255

Hi Manoj,

It doesn't seem to work when I put the commit work statement; I think I have to add the code to the FM.

Thanks,

RT

Read only

0 Likes
2,255

Try adding commit work inside Z_BPS_TEST.

REgards

Sridhar