Skip to Content
avatar image
Former Member

Dump with Message Statement in User-Exit / BAdi while calling BAPI from FPM Application

Hi,

We are developing a Floorplan Manager(FPM) application where we want to automate creation of Return Order, Return Delivery and Return Billing against Original Sales Order Flow.

To achieve Return documents creation, we are calling BAPI's (Example: BAPI_CUSTOMERRETURN_CREATE and BAPI_SALESORDER_CREATEFROMDAT2). But there had been lot of validations present in the custom development written in existing Customer-Exit's and BADI's where MESSAGE statement had been used to throw an error messages. This absolutely works fine as long as we run functionality using GUI transaction codes (Example: VA01)

However when we process the same functionality via FPM Application where BAPI's are triggering the same User-Exit's / BAdi's, SAP system gives a dump whenever these MESSAGE Statements are executed.

Though we could figured out that MESSAGE statement has to be altered as "MESSAGE ID 'XX' TYPE 'E' NUMBER '000' WITH MATNR INTO lv_message" to make sure FPM application do not short-dump, but we are looking for efficient and better way to handle such situation of may be one single MESSAGE syntax which should work fine in FPM and GUI transactions.

Could you please advise if you have any solution?

Thanks,

Bharath.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 19 at 04:08 PM
    -1

    Never, never, never use a MESSAGE statement in a BAPI, that's just fundamentally wrong on several levels. Please review the development guidelines for BAPI's: GUI interaction is forbidden for anything intended to be used remotely, for exactly the reason you are encountering.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Mike,

      We have tried different approaches, we are still not successful.

      This is flow: Launch FPM application -> User select a original order -> Press button to process Return Flow -> Call BAPI to create Return Billing document -> Internally it executes User-Exit 'EXIT_SAPLV60B_001' . There was some customer specific logic written in which MESSAGE Statement is used. As soon as this MESSAGE statement is triggered, it issues a dump to FPM Application. Please note MESSAGE Statement works perfectly alright if we create a Return Billing document using VF01 transaction.

      Tried following approaches to fix the FPM dump issue.

      1.MESSAGE 'VF' type 'E'.....INTO lv_dummy. This will not give a dump but this does not stop further creation of Billing document.

      2. Used Return Code by setting 'SY-SUBRC = 4' or tried with setting ERROR_FLAG. But these Return Codes are cleared as soon as control come out of User-Exit and Standard code continues to execute in FM 'RV_ACCOUNTING_DOCUMENT_CREATE'

      3.Tried with RAISE EXCEPTION TYPE 'CX_CLASS'. This was also giving a dump. Additionally we thought of raising Function Module exceptions but here were no exceptions defined in User-Exit.

      4.Created a separate OO class and storing the messages into an internal table from User-Exit. After BAPI has been executed. Before BAPI COMMIT is executed, we are checking whether internal table has any error message filled, then throw an error message. But by the time control come back to FPM application after User-Exit, Billing document was already created and saved in to the database due to internal commit in the Standard SAP Code.

      All the options did not help us to fix the issue. Are we doing anything wrong?

      Do you see any chances of fixing this issue? Kindly advice.

      Thanks,

      Bharath.

  • Jan 31 at 10:18 AM

    Tried following approaches to fix the FPM dump issue.

    1.MESSAGE 'VF' type 'E'.....INTO lv_dummy. This will not give a dump but this does not stop further creation of Billing document.

    may be you can control the above point by having an error flag in global attributes in class level, whenever above message is identified you mark the global error flag and control rest of the logic.


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Naresh,

      Thanks for your answer.

      Below If you see the ABAP stack executed when 'Return Flow' Button is pressed from my FPM application.

      After MESSAGE Statement is executed in User-Exit, control comes to 'RV_ACCOUNTING_DOCUMENT_CREATE', there it continues to create Billing document in the ABAP stack followed. I think Standard SAP should have provided some exceptions in the User-Exit FM by raising these from Exit could stop further execution. Otherwise i need to plugin my custom code after control come out of User-Exit and Before Standard SAP Creates Billing document, there i can read my global class attribute / Internal table, then let the code not continue to create billing document. I am looking for some pointer / approach where i can restrict the Billing document creation.

      Thanks,

      Bharath.