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' and get messages

Former Member
0 Likes
11,469

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
Read only

former_member194669
Active Contributor
0 Likes
5,331

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

a®

10 REPLIES 10
Read only

Former Member
0 Likes
5,331

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.

Read only

0 Likes
5,331

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

Read only

0 Likes
5,331

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.

Read only

0 Likes
5,331

Hello,

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

Regards,

Mansi.

Read only

former_member194669
Active Contributor
0 Likes
5,331

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

a®

Read only

Former Member
0 Likes
5,331

hi,

use this statement .

SUBMIT zprogram

VIA JOB text-020 NUMBER l_jobcnt

AND RETURN.

hope it will work.

Read only

former_member194669
Active Contributor
0 Likes
5,332

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

a®

Read only

0 Likes
5,331

Thank you katigiri, Mansi, and a®s.

I can get messages.

I use ABAP memory EXPORT/IMPORT.

Thank you very mach!

Read only

Former Member
0 Likes
5,331

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

Read only

0 Likes
5,331

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