I have a very simple problem, which i cannot solve it! i hope you ll help me.
All i want is to call a programm (report) or a transaction in a loop statement, and when an error occurs, i want to log it somewhere and go to the next line. How is this possible in ABAP?
Thanks in advance!
Errors are in place so that the transaction will not continue. What's the use in continuing if you have errors in data? (",)
With CALL TRANSACTION, you get to log all messages encountered by the call transaction statement.
You could also use SUBMIT (program) ... AND RETURN statement but I think this will only give you the last error message that terminated the call through SY-SUBRC check.
Also, if you are using LOOP statement to process a lot of transaction like
LOOP AT itab INTO wa. ... CALL TRANSACTION... IF sy-subrc IS INITIAL. "Transaction ended most probably successfully. ENDIF. "Check the iMessageTab for the messages encountered ENDLOOP.
The next line of the internal table itab gets processed anyway regardless if the previous call was successful or not.
Edited by: Michael.Sumaya on Feb 2, 2012 9:32 AM
You could try BDC calls using CALL TRANSACTION.
CALL TRANSACTION (tcode) USING (bdc_table) MODE 'N' UPDATE 'S' MESSAGES INTO i_lmesstab.
i_lmesstab contains the messages (error/status/etc) encountered during the BDC call.
i_lmesstab should be of TYPE STANDARD TABLE OF bdcmsgcoll.
Hope this helped.