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 not working in Background

former_member224444
Participant
0 Likes
3,568

Dear All,

I am using Submit statement to get stock value from MC.9 report and using LIST_FROM_MEMORY i am  getting the values. Everything is working fine in foreground, but when i run my report in background, am not getting any values from submit statement. Below is my coding:

SUBMIT ZRMCB0300

                   WITH SL_WERKS IN R_CHE

                   WITH SL_SPMON IN R_SPMON

*                   with sl_matnr in r_matnr

                   WITH SL_MTART IN R_MTART

                   AND RETURN   EXPORTING LIST TO MEMORY .

check sy-subrc eq 0.

CALL FUNCTION 'LIST_FROM_MEMORY'

   TABLES

   LISTOBJECT = ABAPLIST

   EXCEPTIONS

   NOT_FOUND = 1

   OTHERS = 2.

call function 'LIST_TO_ASCI'

   tables

   listobject = ABAPLIST

   listasci = INT_S000

   exceptions

   empty_list = 1

   list_index_invalid = 2

   others = 3.

Am not getting any values in ABAPLIST if i run my program in background.


Please suggest what will be the problem.

Regards,

Rithika.

13 REPLIES 13
Read only

JonathanM
Contributor
0 Likes
2,120

Hi,

Did you try to run your program ZRMCB0300 directly in background to check that you have results with your selection?

Best regards,

Jonathan

Read only

0 Likes
2,120

Dear Jonathan,

Execute in Background option is missing in my ZRMCB0300, whereas if if run MC.9 directly i can see that. What should i do.

Regards,

Rithika.

Read only

Former Member
0 Likes
2,120

Hi Rithika,

Put Submit between JOB_OPEN & JOB_CLOSE and use submit via job.

Hope this helps.

Thanks,

Tooshar Bendale

Read only

0 Likes
2,120

Hello Rithika,

Please follow tooshar suggestion he is rite.

Regards

Suresh Nair

Read only

0 Likes
2,120

Dear Tooshar,

I have used submit via job, but still am not able to see any values in ABAPLIST  variable. Below is my coding:

CALL FUNCTION 'JOB_OPEN'

   EXPORTING

*   DELANFREP              = ' '

*   JOBGROUP               = ' '

     JOBNAME                = GV_JOBNAME

*   SDLSTRTDT              = NO_DATE

*   SDLSTRTTM              = NO_TIME

*   JOBCLASS               =

  IMPORTING

    JOBCOUNT               = GV_JOBCOUNT

* CHANGING

*   RET                    =

* EXCEPTIONS

*   CANT_CREATE_JOB        = 1

*   INVALID_JOB_DATA       = 2

*   JOBNAME_MISSING        = 3

*   OTHERS                 = 4

           .

IF SY-SUBRC <> 0.

* Implement suitable error handling here

ENDIF.

       SUBMIT ZRMCB0300

                   WITH SL_WERKS IN R_WERKS

                   WITH SL_MTART IN R_MTART

                   WITH SL_SPMON IN R_SPMON

                   VIA JOB GV_JOBNAME

                   NUMBER GV_JOBCOUNT

                   AND RETURN

CALL FUNCTION 'JOB_CLOSE'

   EXPORTING

     JOBCOUNT                          = GV_JOBCOUNT

     JOBNAME                           = GV_JOBNAME.

IF SY-SUBRC <> 0.

* Implement suitable error handling here

ENDIF.

check sy-subrc eq 0.

CALL FUNCTION 'LIST_FROM_MEMORY'

   TABLES

   LISTOBJECT = ABAPLIST

   EXCEPTIONS

   NOT_FOUND = 1

   OTHERS = 2.

call function 'LIST_TO_ASCI'

   tables

   listobject = ABAPLIST

   listasci = INT_S000

   exceptions

   empty_list = 1

   list_index_invalid = 2

   others = 3.

Regards,

Rithika

Read only

0 Likes
2,120

Hi,

Remove the return statement from submit and debug to know what is happening in the called program.

Read only

0 Likes
2,120

Hi Rithika,

Use SUBMIT using RETURN EXPORTING LIST TO MEMORY. 

Just by return it will not return the output in the list format.

Hope this helps.

Thanks,

Tooshar Bendale

Read only

0 Likes
2,120

Dear Tooshar,

If i use RETURN EXPORTING LIST TO MEMORY it will show error The addition "EXPORTING LIST TO MEMORY" cannot be used with the addition "VIA JOB".   I have already tried it.

Regards,

Rithika.

Read only

0 Likes
2,120

Hi,

Have you checked the job using the transaction SM37 ? Check the job log and also if the job has an output it will be seen in spool.

Thanks,

Tooshar Bendale

Read only

Former Member
0 Likes
2,120

I dont know if this will work or not. But try

SUBMIT ZRMCB0300

                   WITH SL_WERKS IN R_CHE

                   WITH SL_SPMON IN R_SPMON

*                   with sl_matnr in r_matnr

                   WITH SL_MTART IN R_MTART

                    EXPORTING LIST TO MEMORY

                   AND RETURN  .

Read only

0 Likes
2,120

Dear Suruchi,

I have this statement already in the program which works fine in foreground but not in background.

Regards,

Rithika.

Read only

0 Likes
2,120

I mean use  EXPORTING LIST TO MEMORY before Return.

You were using After return.

I hav used the same in my program also...It worked fine...

Read only

0 Likes
2,120

Dear Suruchi,

I have used below coding the same code as you said still am not getting value in background:

SUBMIT ZRMCB0300 "USING "SELECTION-SCREEN 1000

                   WITH SL_WERKS IN R_WERKS

                   WITH SL_SPMON IN R_SPMON

                   WITH SL_MTART IN R_MTART

                    EXPORTING LIST TO MEMORY AND RETURN .

Regards,

Rithika