on 07-28-2005 7:55 AM
Is there any way to catch message after submitting report?
I mean any type of message, i.e. E,S,I and so on. And if it's possible, I need to suppress them. Maybe this can work with help of the system calls?
Hi,
If you want to see the transaction step-by-step,you can use 'A' mode.
'E' mode helps us to see the screen if the transaction encounters error.
'N' mode is for no display of screens.
Here is the sample code.
CALL TRANSACTION 'MEQ1' USING i_bdcdata MODE 'N'
MESSAGES INTO i_messtab.
IF NOT i_messtab IS INITIAL.
SORT i_messtab BY msgtyp.
* Check BDC message table for error
READ TABLE i_messtab INTO w_messtab WITH KEY msgtyp = c_e
BINARY SEARCH.
IF sy-subrc NE 0.
....
Endif.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Dom and Jayanthi!
Thank you, but I can't use Batch Input technology here, because I have one condition - no transaction creating at all. There may be many other reports, that I have to submit, so it's not possible too to create a transaction for each one. And guessing your farther answer - I can't use 'SE38'.
HI Vitaly,
You can try the 'SUBMIT VIA JOB' option and then read the job log and/or spool for any messages. Here is a rough code.
DATA: l_jobcount LIKE tbtcjob-jobcount.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = 'MYTESTJOB'
IMPORTING
jobcount = l_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
INTO i_return_messages-message.
i_return_messages-type = 'E'.
APPEND i_return_messages.
CLEAR i_return_messages.
EXIT.
ENDIF.
SUBMIT zbwm_sap_to_dsc_enr_rel_notice
WITH p_relno = release_nbr
USER sy-uname VIA JOB 'MYTESTJOB'
NUMBER l_jobcount AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_jobcount
jobname = 'MYTESTJOB'
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 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
INTO i_return_messages-message.
i_return_messages-type = 'E'.
APPEND i_return_messages.
CLEAR i_return_messages.
ENDIF.
After this, you will have to check if the job has completed or not(in a loop). To do that you can call the function module SHOW_JOBSTATE. This will tell the status of the job. Once the job status is 'FINISHED' or 'ABORTED', you can then call another function module BP_JOBLOG_READ to read the job log.
But again, you will have parse through the text to identify the message type, number, message text etc.
Hi Vitaly
I don't think so.
However, if you want the report to run entirely in the dark, assign a transaction code to it and CALL TRANSACTION...MODE 'N'...MESSAGES INTO LT_MSGTAB.
Then you won't get any messages on the screen.
Cheers
Dom
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vitaly,
there is a specific list of errors, which can be catched with 'CATCH', have a look in the help. But I doubt, that you can even catch everything inside of a submit - somehow it's not designed for this.
Anyway there are a lot of errors, which can't be catch - and you will never be able to catch a message X, unless you modify short dump creation.
If you want to have a program, which can still go on after some errors in a submitted report, place the submit in a asynchronous function call.
Regards,
Christian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.