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

Return value from the called program to the calling program in submit stmt

Former Member
0 Likes
293

Hi all,

I have a report_1 that is scheduled as a background job. this report is calling another report_2 through submit. Now there could be error or success of report_2 and then it gets updated in SM37.

SUBMIT report_2

WITH bill_no = gs_bill_no-vbeln

AND RETURN.

Currently SM37 is not getting updated but it shows the stauts finished even if its an error.

How do i return that error value to report_1.

Thanks.

1 REPLY 1
Read only

former_member195383
Active Contributor
0 Likes
268

hi...use job open and job close.....

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = wf_jobname

sdlstrtdt = sy-datlo

sdlstrttm = wf_timlo

IMPORTING

jobcount = wf_jobcount

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4

RAISING action_not_performed.

ENDIF.

:

:

:

SUBMIT ZPROGRAM

AND RETURN

VIA JOB wf_jobname NUMBER wf_jobcount

TO SAP-SPOOL WITHOUT SPOOL DYNPRO

KEEP IN SPOOL xflag_gc.

:

:

:

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = wf_jobcount

jobname = wf_jobname

sdlstrtdt = sy-datum

sdlstrttm = sy-uzeit

IMPORTING

job_was_released = wf_job_release

EXCEPTIONS

cant_start_immediate = 1

invalid_startdate = 2

jobname_missing = 3

job_close_failed = 4

job_nosteps = 5

job_notex = 6

lock_failed = 7

OTHERS = 8.

IF sy-subrc NE 0 OR

( sy-subrc EQ 0 AND wf_job_release NE xflag_gc ).

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4

RAISING action_not_performed.

ENDIF.

based on sy-subrc u can determine the success or failure...

Reward points if useful.....