Skip to Content
author's profile photo Former Member
Former Member

L_TO_CREATE_POSTING_CHANGE-FM generates message and not exception

Hi All,

We are trying to Post TO using FM L_TO_CREATE_POSTING_CHANGE but the same TO posting is opened in LU04 but due to foreign lock a message is displayed saying the there is a foreign lock by user when the FM is executed but it is not captured as an exception it gives a message and hence the when the Fm is called in a background Job it gets cancelled abruptly.

Solutions tried:

Tried to add others as an exception in the FM and still it does not get captured because the message statement is executed before the exception is triggered. Tried to enqueue the table before the FM but again it will lead to the same foreign lock. I searched the forum related to this issue and to could not find any posts related to my issue. Can anyone suggest how to go about it?



Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jan 26, 2016 at 04:19 PM

    Hi Narayanan,

    If a message with type 'E' or 'A' is raised by the function module using 'MESSAGE' statement instead of 'MESSAGE ... RAISING exception' you can catch it in the following way:

    CALL FUNCTION <function_name>
    error_message = 1.

    The messages parameters will be available in SY structure afterwards.



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Rajan,

      In your RFC (Custom RFC) In the exceptions of the FM L_TO_CREATE_POSTING_CHANGE add another parameter error_message = 38. The error_message will hold the return value which is getting created in your program.




      error_message = 38.



Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.