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

How to handle error messages occured witin a FM?

Hi all,

here is the scenario:

I'm writing a program which post some kind of documents into SAP based on a flat input file with data. To post the document I'm using a complex function module. Results from post are tracked into some log-file.

Problem is:

Sometimes, due to incorrect input data, function module returns an error messages directly into a system line, but not in an output message from the FM. That brokes my flow and I'm unable to proceed with next record from my flat file.

Question is:

Is it possible to prevent error message occurance into a system line? I would like to get the error, if possible, and to pass it to my log-file instead.

Any help would be highly appreciated.

Many thanks in advance.



Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Dec 09, 2004 at 02:58 PM

    If it raises an exception you can catch it.

    cx_root is the root class for exceptions.



    call fm.


    CATCH cx_root INTO ex.


    message = cx_root->get_text( ).


    If it helps please give points.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Ramki --

      well, these FMs are part of the FuGr 'OIGI > TD RFC Create/change Shipment', part of a dev.class 'OIG > TD Transport and Distribution',

      application component 'IS-OIL-DS-TD > Transportation and Distribution',

      software component 'IS-OIL > IS-OIL 46C'.

      It seems it is released for customer, isn't it? As I mentioned (or not? 😉 it doesn't behave as a 'normal' BAPI - there are lots of error messages tracked into a system message line instead of FM-interface, and there is even a situation, when in some mess in an input data, pop-up screen/s occurs.

      Perhaps that's the way I should follow - to open a customer message at oss.



  • Posted on Dec 09, 2004 at 03:24 PM

    You might want to try calling that function module in background task or in separate task. Otherwise, I don't think you can skip that error messages that does not raise exception in the function module you call.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member


      thanks for the suggestion. This would also broke my scenario, isn't it? I'm in a loop, and I need some step finished before to start the next one - which is not possible in case of NEW or BACKGROUND TASK.

      Furthermore, FM has a CHANGING parameters - RC (returnCode) - which couldn't be accessed in case of NEW TASK or BACKGROUND TASK - there is no possibility to get CHANGING parameters in such type of CALL. So how would I get the result from the FM - means operation?

      Ok, scenario seems to be not so clear. That's the way I fould until now. Perhaps I should deal with own FM which calls the original one in some way, or so... don't have a clear idea how to proceed in different way.

      Any suggestions?

      Thanks in advance.



  • Posted on Dec 10, 2004 at 10:57 AM


    Pleae mail to me also.

    id :

    Thanks in Advance

    Suresh Babu Karanam

    Add a comment
    10|10000 characters needed characters exceeded

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.