‎2020 Apr 29 7:47 AM
Dear Experts,
I am using FM "L_TO_CREATE_MULTIPLE" to create TO in my custom FM, i have enabled all the exceptions and using below code to catch all the errors.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno INTO lv_msg
WITH sy-msgv1.
return-type = sy-msgty.
return-id = sy-msgid.
return-number = sy-msgno.
return-message = lv_msg.
But for some of the invalid inputs are not getting captured in this message, instead it goes out of FM and comes on status bar, attached screen shot.
In PI system getting the message as below, i want handle this in my FM and send the structure to PI system.
<rfc:ZWM_BL_TO_CREATE.Exception xmlns:rfc="urn:sap-com:document:sap:rfc:functions"> <Name>RFC_ERROR_SYSTEM_FAILURE</Name>
<Text> Storage bin EWGSSAY in storage type ASY does not exist (check your e</Text>
</rfc:ZWM_BL_TO_CREATE.Exception>
Please let me know how to handle this?
‎2020 Apr 29 7:56 AM
As it is an RFC, you just have to call it for RFC destination none, the message will not be displayed.
CALL FUNCTION 'L_TO_CREATE_MULTIPLE'
DESTINATION 'NONE'...
‎2020 Apr 29 8:01 AM
Excellent.. Its working. thanks a lot..
‎2020 Apr 30 2:15 PM
Hi Frederic,
Actually when this FM called from PI system same error is thrown,it works internally and in debugging mode. Kindly advise.
Regards
Santosh
‎2020 Apr 30 2:20 PM
Sorry Idon't understand, what is the problem from PI ?
‎2020 Apr 30 2:40 PM
When call is made from PI system to my FM its throwing error.
<rfc:Z_BL_TO_CREATE.Exception xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
<Name>RFC_ERROR_SYSTEM_FAILURE</Name>
<Text>Message type is unknown.</Text>
</rfc:Z_BL_TO_CREATE.Exception>
‎2020 May 26 12:16 PM
BEST ANSWER:
use the below exception which will handle everything
error_messge = 1.
‎2020 May 27 6:29 AM
Not agree, you will avoid having exception, but you will not catch the message.
But for some of the invalid inputs are not getting captured in this message, instead it goes out of FM and comes on status bar, attached screen shot.
‎2020 May 27 7:05 AM
Santosh N Please post a separate answer, it's not related to what Frederic proposed.
It's not very precise to say that using ERROR_MESSAGE "handles everything". It's more exact to say that it solves your question better than calling L_TO_CREATE_MULTIPLE in sRFC (destination 'NONE' + handling the exception SYSTEM_FAILURE). The special ERROR_MESSAGE exception is explained in the ABAP documentation.
Frederic Girod you say "not catch the message", but I don't understand what you mean. ERROR_MESSAGE is a special exception which really makes the kernel catch the error message and terminates the function module.
‎2020 May 27 7:59 AM
sandra.rossi, SAP display the message, but you are not able to manage this message. For example if you want to make specific action, if you want to use the message in a log ...
I have exactly this case with RF screen, and I need to focus on the field that generate the error, if I let SAP display the error, I could not do it. So I used the dummy RFC, SAP does not display the error message, but returns the value (SYST). So you could display it as you want.
‎2020 May 27 8:22 AM
What Santosh did, and that works for him:
CALL FUNCTION 'L_TO_CREATE_MULTIPLE'
...
EXCEPTIONS
error_message = 1
...No need of using sRFC 'NONE' in his case.
You say that "SAP display the message". NO if you use the special exception ERROR_MESSAGE, any MESSAGE ... TYPE 'E' (without RAISING) executed inside the function module and its nested procedures will be implicitly interpreted like MESSAGE ... TYPE 'E' RAISING error_message. The ABAP documentation says about ERROR_MESSAGE:
Messages of the type E and A raise the exception error_message and set sy-subrc to n_error.
The message class, message type, message number, and the contents of possible placeholders for the
MESSAGE statement are in the fields sy-msgid, sy-msgno, sy-msgty, and sy-msgv1, ... sy-msgv4.
In the case of messages of type A, the statement ROLLBACK WORK is also executed explicitly.