Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Rollback BAPI in BADI ME_PROCESS_PO_CUST

Former Member
0 Kudos

hi guys,

I used BADI ME_PROCESS_PO_CUST to implement a code before saving the purchase order (Method POST).

This code contains a BAPI to create a delivery BAPI_OUTB_DELIVERY_CREATENOREF. If this BAPI fails (this is when Return parameter contains 'E' message), I execute function BAPI_TRANSACTION_ROLLBACK.

Guess what is happening?

There is no purchase order created even when screen shows message "Standard PO created under the number 45#######".

What do I want to do?

- Rollback the bapi executed and let the system continue saving the purchase order.

- If possible show a message to the user that there is an error, but command MESSAGE doesn't seem to work in this BADI

Could you share your insights with this wannabe-abapper?

PD: it says in documentation that it is required ABAP OO to implement this BADI and I think I used it correctly for gathering all data I needed. But I just don't understand why MESSAGE statement and FM POPUP_TO_CONFIRM don't work.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Check this link for reference:

cheers

Aveek

2 REPLIES 2

Former Member
0 Kudos

Hi,

Check this link for reference:

cheers

Aveek

uwe_schieferstein
Active Contributor
0 Kudos

Hello

You may try an approach like this:


  IF ( 1 = 1 ).
    MESSAGE 'Creation of outbound delivery failed'  type 'I'.

    data: ld_dummy  type string,
          ls_msg    type SMESG,
          lt_msg    type tsmesg.

      message id '00' type 'E' number '398' with 'Creation of outbound delivery failed'
                                                  space space space into gl_dummy.

    move-CORRESPONDING syst to ls_msg.
    APPEND ls_msg to lt_msg.

    CALL FUNCTION 'FB_MESSAGES_DISPLAY_POPUP'
      EXPORTING
        IT_SMESG              = lt_msg
*       ID_SMESG_ZEILE        =
*       IT_RETURN             =
*       ID_SEND_IF_ONE        =
      EXCEPTIONS
        NO_MESSAGES           = 1
        POPUP_CANCELLED       = 2
        OTHERS                = 3.
    IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  endif.

Regards

Uwe