‎2012 Sep 26 12:59 PM
Hi
I use BAPI_ASSET_ACQUISITION_POST and when I fill all need data with incorrect field ASSETTRTYP then I got error message on bottom bar
and my program is stop processing. Why this message isn't in return BAPI table but on screen?
‎2012 Sep 26 1:18 PM
Hi Kosmo,
This is because the code inside the BAPI is not written the way it should have been. Instead of populating the return table it is raising the message with Message command.
If you want to trap it. use this
CALL FUNCTION 'BAPI_ASSET_ACQUISITION_POST'
EXPORTING
......
IMPORTING
TABLES
EXCEPTIONS
error_message = 99.
You have to add the code written in bold in addition to the BAPI call. It will trap the error and will not throw any error in the screen. In order to know the error you can use system variable like SY-MSGID, SY-MSGNO, SY-MSGTY and SY-MSGV1 to SY-MSGV4
So add the following code after the BAPI call
IF SY-SUBRC = 99.
****convert the message to message text using simple coding or FORMAT_MESSAGE/ MESSAGE_TEXT_BUILD FMs
endif.
Hope it helps.
Regards,
R
‎2012 Sep 26 1:18 PM
Hi Kosmo,
This is because the code inside the BAPI is not written the way it should have been. Instead of populating the return table it is raising the message with Message command.
If you want to trap it. use this
CALL FUNCTION 'BAPI_ASSET_ACQUISITION_POST'
EXPORTING
......
IMPORTING
TABLES
EXCEPTIONS
error_message = 99.
You have to add the code written in bold in addition to the BAPI call. It will trap the error and will not throw any error in the screen. In order to know the error you can use system variable like SY-MSGID, SY-MSGNO, SY-MSGTY and SY-MSGV1 to SY-MSGV4
So add the following code after the BAPI call
IF SY-SUBRC = 99.
****convert the message to message text using simple coding or FORMAT_MESSAGE/ MESSAGE_TEXT_BUILD FMs
endif.
Hope it helps.
Regards,
R