2023 Feb 24 7:22 AM
Dear SAP,
We use ABAP daemon for processing a huge amount of data and indeed can run for a couple of hours. It is a very heavy workload.
In the daemon, we call the function module BAPI_ACC_DOCUMENT_CHECK for checking invoices before they get booked.
Inside the BAPI_ACC_DOCUMENT_CHECK a functional module FI_COBL_CHECK gets called which can throw MESSAGE of type E as follows:
CASE SUBRC.
WHEN 0.
WHEN 1.
MESSAGE E165 WITH I_COBL-BUKRS RAISING COMPANY_CODE.
WHEN 2.
MESSAGE E162 WITH I_COBL-GSBER RAISING BUISNESS_AREA.
WHEN 3.
MESSAGE E505 WITH T001-KTOPL T001-BUKRS RAISING CHART_OF_ACCOUNT.
WHEN 4.
MESSAGE E507 WITH HKONT T001-KTOPL RAISING GL_ACCOUNT_A.
WHEN 5.
MESSAGE E506 WITH HKONT I_COBL-BUKRS RAISING GL_ACCOUNT_B.
WHEN 6.
MESSAGE E210 WITH I_COBL-BUKRS I_COBL-WAERS RAISING CURRENCY.
WHEN 7.
MESSAGE E508 WITH I_COBL-ANLN1 I_COBL-ANLN2 I_COBL-BUKRS
RAISING ASSET.
WHEN 8.
MESSAGE E562 WITH HKONT I_COBL-BUKRS.
WHEN 9.
MESSAGE E262(GZ) WITH I_COBL-RMVCT.
WHEN 10.
MESSAGE E098(GM) WITH I_COBL-FKBER.
WHEN 11.
MESSAGE E162 WITH I_COBL-PARGB RAISING BUISNESS_AREA.
WHEN 12. "note 1744468
MESSAGE E351 WITH HKONT I_COBL-BUKRS. "note 1744468
WHEN OTHERS.
According to the ABAP Daemons Programming Model documentation on
when an error occurs of type E/A/X message during the execution then the hook ON_ERROR will get called, and function module execution will be aborted immediately.
For us, it is important to get all the messages back from function module BAPI_ACC_DOCUMENT_CHECK which it is provided as a table parameter:
RETURN LIKE BAPIRET2 Return Parameter
for showing users what went wrong that they can take reaction.
The question is how to prevent the termination of the function module execution when a message of type E/A/X occurs inside the function module.
Best regards
2023 Feb 24 7:30 AM
Hello bifunctor
Check my answer to the question Suppressing errors in WS_DELIVERY_UPDATE_2
I guess call the function with
EXCEPTIONS
error_message = 1
OTHERS = 2.<br>
should work as well at least for E type messages.
Best regards
Dominik Tylczynski
2023 Feb 24 7:56 AM
Hi
I have tried
CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
EXPORTING
documentheader = ls_header
TABLES
accountgl = lt_line_items
accountreceivable = lt_customer_ar_item_list
accountpayable = lt_vendor_ap_item_list
currencyamount = lt_amount
accounttax = lt_tax_item_list
return = lt_return
extension2 = lt_extension_02
EXCEPTIONS
error_message = 1
OTHERS = 2.
Unfortunately, it does not help. The daemon is still calling the ON_ERROR hook.
Best regards
2023 Feb 24 8:38 AM
It's MESSAGE ... RAISING ... so I guess it's more about catching it with EXCEPTIONS ... Not sure whether the analysis done by the OP is correct.
2023 Feb 24 9:33 AM
sandra.rossi I see that during the execution in the function module FI_COBL_CHECK the line 126 get called. Then the daemon catch up as an error and call the ON_ERROR hook.
Do you get it what I mean?
Best regards
2023 Feb 24 8:37 AM
You didn't say what you exactly see, why you think it's due to a "message of type E", but in fact it's a classic exception which is raised and probably it's not caught by EXCEPTIONS, because of the addition RAISING.
Right? What did you exactly see?
2023 Feb 24 9:36 AM
sandra.rossi I see that during the execution in the function module FI_COBL_CHECK the line 126 get called. Then the daemon catch up as an error and call the ON_ERROR hook.
I see that the daemon abort the execution suddenly when encounter the statement MESSAGE E262(GZ) WITH I_COBL-RMVCT.
Do you get it what I mean?
Best regards
2023 Feb 24 9:51 AM
Thanks, sorry most of MESSAGE had the word RAISING, I didn't see that few of them were missing RAISING. Weird that the standard is mixing RAISING and not RAISING!
It should be caught by the special exception ERROR_MESSAGE if BAPI_ACC_DOCUMENT_CHECK is in the call stack.
Could you please share a screenshot of the call stack to see both FI_COBL_CHECK and BAPI_ACC_DOCUMENT_CHECK?
2023 Feb 24 10:27 AM
You began with "Dear SAP".
answers.sap.com has many many contributors who do not work for SAP.
Anyway, there are two things you should do:
2023 Feb 24 1:22 PM
Hi sandra.rossi
I made several printscreens.
1. Here is where is started. The system reaches the point where the message type is E.
2. The daemon context got called.
3. The ON_ERROR hook got called
2023 Feb 24 1:23 PM
2023 Feb 24 5:59 PM
The error is about the classic exception ACCOUNT raised by FI_GL_ACCOUNT_DATA which is not handled by SUBST_SINGLE_HKONT in SAPLFACI:
As you said, FI_GL_ACCOUNT_DATA is raising the exception ACCOUNT:
The only solution is to add "EXCEPTIONS account = 1" (or OTHERS = 1) in SUBST_SINGLE_HKONT.
If you don't do it, it will end in an exception in the Daemon.
That's an abnormal situation that FI_GL_ACCOUNT_DATA exception is not caught so I think that you may contact the SAP support.
NB: you can't handle the error with ERROR_MESSAGE because the MESSAGE statement has the RAISING word.