2005 Aug 15 10:26 AM
Hi!
Please help me, I can't use submit via background job, because he can't handle message errors of type 'E'. When this kind of message occurs, all background processing stops and I get a report screen with this message in the status bar.
Is there any solution?
Hi!
Please help me, I can't use submit via background job, because he can't handle message errors of type 'E'. When this kind of message occurs, all background processing stops and I get a report screen with this message in the status bar.
Is there any solution?
2005 Aug 15 2:07 PM
2005 Aug 15 6:32 PM
Let me understand this. You have a program A from which you submit a program B in the background and if in program B an error is raised, your program A execution stops. Is this true?
Did you do a job close in your code. Here is a sample program ZTEST1 that submits another program ZTEST2 in the background. If there is an error message thrown out in ZTEST2, the job submitted is cancelled, with the job log showing the error message. The processing of ZTEST1 continues even after that.
I don't know why yours is not. Please let us know.
<u>Program ZTEST1</u>
REPORT ztest1 .
PARAMETERS: p_matnr1 LIKE mara-matnr.
DATA: v_jobcount LIKE tbtcjob-jobcount,
v_jobname LIKE tbtcjob-jobname.
START-OF-SELECTION.
v_jobname = 'TESTJOB'.
*-- open the job
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = v_jobname
IMPORTING
jobcount = v_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.
ENDIF.
*-- submit the report
SUBMIT ztest2 WITH p_matnr2 = p_matnr1
USER sy-uname VIA JOB v_jobname
NUMBER v_jobcount AND RETURN.
*-- close the job
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = v_jobcount
jobname = v_jobname
strtimmed = 'X'
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 <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
WRITE:/ 'Job submitted successfully.'.<u>Program ZTEST2</u>
REPORT ztest2 MESSAGE-ID zz.
PARAMETERS: p_matnr2 LIKE mara-matnr.
DATA: itab LIKE mara OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
SELECT * INTO TABLE itab FROM mara
WHERE matnr = p_matnr2.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'Invalid material number'.
ENDIF.
LOOP AT itab.
WRITE:/ itab-matnr.
ENDLOOP.
2005 Aug 16 5:15 PM
Thank you for your attention. I'm already found solution for this problem.
The question was how to get error message type 'E' from report called through SUBMIT VIA JOB. Everytime when this message occurs in report we got full terminate(right after SUBMIT VIA JOB) of the calling module(especially in RFC-call). So after all we got clear log and open job. But I need to handle all errors from report in a normal way, after 'JOB_CLOSE'. How could it be? I don't know.
But I found my own solution. I wrote additional FM where I put my SUBMIT VIA JOB. And then I replaced my SUBMIT-call with FM-call with addition "STARTING NEW TASK..." and "PERFORMING return_info ON END OF TASK". Where in return_info form I get all message errors(even type 'E') from message text of the exceptions COMMUNICATION_FAILURE and SYSTEM_FAILURE of the RECEIVE command.
After all of this, I want to say, that it was a really big trick, but IT WORKS! I'm really happy.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |