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: 

using 'SUBMIT' and get messages

Former Member
0 Kudos

Hi, all.

I created 2 addon programs.

1 program call another program by 'SUBMIT'.

but I don't get messages outputed by called program.

Is it impossinble?

please let me know.

thanks.

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos

In my earlier reply i pointed that in the called program

if error

export sy-subrc to memory

endif

after submit in the calling program

import from memory

10 REPLIES 10

Former Member
0 Kudos

Hello,

Please can u elaborate?

Is it that you want messages from the called program to be appended in the joblog of the calling program?

Coz when you run in foreground you will see messages of both, only in background both the called and calling programs will have seperate joblogs.

Regards,

Mansi.

0 Kudos

Hello,

In Background, If you want to append messages from called program into calling program, then, in the calling program after the submit stmt, you will have to read the joblog for called program looping at the joblog table of called program using write stmt print all the msg .

Then if u see joblog of calling program , it will have messages of called program also.

Check the code below to get pointers:


"Call the functin module to read the job log of called program in the calling program after the SUBMIT stmt 

    CALL FUNCTION 'BP_JOBLOG_READ'
      EXPORTING
        client                = sy-mandt
        jobcount              = g_jcount
        jobname               = g_jbname
      TABLES
        joblogtbl             = g_t_joblogtbl
      EXCEPTIONS
        cant_read_joblog      = 1
        jobcount_missing      = 2
        joblog_does_not_exist = 3
        joblog_is_empty       = 4
        joblog_name_missing   = 5
        jobname_missing       = 6
        job_does_not_exist    = 7
        OTHERS                = 8.
    IF sy-subrc EQ 0.

* Looping at the internal table for the joblog the messages are reported
* to build the joblog in CLOCO
      LOOP AT g_t_joblogtbl INTO g_wa_joblogtbl.
        MESSAGE g_wa_joblogtbl-text TYPE 'I'.
endloop. 
endif.

Regards,

Mansi.

Edited by: SAP USER on Apr 17, 2009 6:42 AM

0 Kudos

thank you Mansi and a®s.

A calling proglam is executed in foreground.

I don't want to display message on screen.

I want to get messages in a calling program...

or, I want to get a return code (status Error, Success, Warning).

is it impossible??

Regards.

Rie.

0 Kudos

Hello,

After the Submit stmt, check for the sy-subrc value and accordingly you can report message that 'Sucess/ Error/ Falied ' etc.

Regards,

Mansi.

former_member194669
Active Contributor
0 Kudos

in the called program while in submit write error messages to spool or list to memory and then after submit read spool using sy-spono or list from memory

Former Member
0 Kudos

hi,

use this statement .

SUBMIT zprogram

VIA JOB text-020 NUMBER l_jobcnt

AND RETURN.

hope it will work.

former_member194669
Active Contributor
0 Kudos

In my earlier reply i pointed that in the called program

if error

export sy-subrc to memory

endif

after submit in the calling program

import from memory

0 Kudos

Thank you katigiri, Mansi, and a®s.

I can get messages.

I use ABAP memory EXPORT/IMPORT.

Thank you very mach!

Former Member
0 Kudos

Hello all,

I read this thread and I have the same sort of problem, but with a small twist. I have a custom program that is doing a SUBMIT ...AND RETURN to an SAP standard program. So, although I want to get the messages, I cannot change the code of the submitted program to put the messages in MEMORY.

When I am in debug, after the return from the submitted program, the message is displayed on the bottom of the screen, but I can't figure out how to capture it so that I can add logic to react to the message.

Do any of you smart people have any ideas for me?

Katherine Reader

0 Kudos

Hi, Katherine.

try this...

SUBMIT xxxxxx

VIA JOB (JOBNAME)

NUMBER (JOBCOUNT)

AND RETURN.

CALL FUNCTION "BP_JOBLOG_READ".

Mansi answered about this FM.

I hope it will work...

Rie