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: 

Automate a >SUBMIT...AND RETURN< without any interaction?

Former Member
0 Kudos

Hi,

this has been all over SCN quite a few times. I have also found quite a few comments on the issue, but none that looks as simple as I imagine the thing to be - maybe it isn't since many SAP-things seem to be from a time when >simple< was not fashionable...

Anyway, here it is:

I have a program that calls a standard SAP report using the >SUBMIT...AND RETURN< command.

Currently, when that executes error-free, I have to hit >RETURN< - or F3 - to continue executing the calling program. The thing is, in case that report failed, it would give me an error message - or rather, the next function which I call right afterwards would give me an error message - that report writes a file to my harddisk, so if it failed, it wouldn't be there and the following function would pass me any of its numerous exceptions. Moreover, I can modify the SELscreen so that no false combination of parameters is possible and the report WILL be executed error-free in all probability.

So, if possible, I would like to automate the "...AND RETURN" part so I - or the user, whoever - doesn't have to hit F3, but the report just executes and then returns automatically to the calling program.

Is that possible?

Thanks a lot!

Best regards,

Sapperdapper

1 ACCEPTED SOLUTION

kesavadas_thekkillath
Active Contributor
0 Kudos

I think so I got your question wrong , to suppress the display of list "EXPORTING LIST TO MEMORY." should solve your problem as Rich explained in the thread given by Venkat. If you need program A to wait until B is over then you can try it with flags as I mentioned.

6 REPLIES 6

kesavadas_thekkillath
Active Contributor
0 Kudos

Submit works in a seperate internal session which the caller will not be interested in waiting for

May be a memory variable check after the submit statement will do.

data:submitted type c,

          run type c.

free memory id 'RUN'.

do.

import run from memory id 'RUN'.

if run = 'X'.

exit.

endif.

if submitted is initial.

submit zabc and return.

submitted = 'X'.

endif.

enddo.

set run = 'X' in zabc and export it in the end.

looks bad though

0 Kudos

Hi Kesavadas,

thanks very much! I am grateful for any trick helping me make my solution look better to the end-user.

The trick is actually very simple, you are proposing declaring that in the calling program with a BLANK, setting it to 'X' once the called report is executed and then querying it to decide whether it has been done.

That looks like it should work. I have copied the standard report and I'll have to edit it somehow anyway to get rid of a GUI confirmation screen which it calls and which I don't want - I want to avoid any redundant user interaction.

Best regards,

Sapperdapper

Venkat_Sesha
Advisor
Advisor
0 Kudos

Check this one.

http://scn.sap.com/thread/1184702

If you are passsing any Tables data to the Selection Screen of the Submit Program use RS_PAR

as shown below.

DATA: TB_RSPAR Type Standard Table of RSPARAMS,
        X_RSPAR
Type RSPARAMS.

Clear X_RSPAR.
      X_RSPAR-SELNAME      =
'S_MATNR'.
      X_RSPAR-KIND         =
'S'.
      X_RSPAR-
SIGN         = 'I'.
      X_RSPAR-OPTION       =
'EQ'.
      X_RSPAR-LOW          = X_DISPLAY_IM-MATNR.
     
Append X_RSPAR TO TB_RSPAR.

Similarly for the Other fields you want.

Hope this helps.

Former Member
0 Kudos

Hi,

why dont you create a job and provide that submit statement as a job step so that it will not require any user intervention. after that you can check for the job completion using show jobstate FM.

ex:

SUBMIT sdbilldl
            VIA JOB lv_jobname
            NUMBER gv_jobcount
            WITH p_vkorg  = p_sorg
            WITH p_fkdat = space
            WITH p_fkdab = p_bildat
            WITH s_vbeln IN so_vbeln "vbeln
            WITH p_allea = zif_sd_constants=>gc_true
            WITH p_allel = zif_sd_constants=>gc_space3
            WITH p_samml = zif_sd_constants=>gc_true
            WITH p_utasy = zif_sd_constants=>gc_true
            AND RETURN.

which I am using in one of my requirements and which will not need any F3 or some other input to continue executing the first program.

thanks.


kesavadas_thekkillath
Active Contributor
0 Kudos

I think so I got your question wrong , to suppress the display of list "EXPORTING LIST TO MEMORY." should solve your problem as Rich explained in the thread given by Venkat. If you need program A to wait until B is over then you can try it with flags as I mentioned.

0 Kudos

Hi Kesavadas,

that was exactly what I was looking for. The "child-report" is called and executed without any need for the user to press a button to return to the main program. That report does not produce anything really necessary, that was just a sort of confirmation of what the report had done. Since I'm trying to make it as hard as possible for the user to mess things up at this stage (by, like, forcing him to ignore all that's written on a user_dialog to achieve that ;-), that report should not fail actually...

Now I have one less point where user-interaction is required. There is still one GUI call I have to get rid of, but that's hidden somewhere in a standard report.

Thanks a lot!

Best regards,

Sapperdapper