cancel
Showing results for 
Search instead for 
Did you mean: 

Need to trigger ORDER_SAVE BADI when BP data is changed from Sales Order screen

Former Member
0 Kudos

Hello experts,

The requirement is that I need to display an error message on order save if the credit card data entered by user does not matches with 'standard' card info in BP Master data. The error message should be removed when the user takes remedial action mentioned below. I have implemented ORDER_SAVE BADI to perform checks and collect/delete error messages.

I have a button in Payment Data assignment block in Sales Order screen to read Credit Card data from current order and add it as standard card for customer BP. The button is available only in EDIT mode of Sales Order screen. This is working fine as expected.

The issue is that when I click on save button, ORDER_SAVE BADI is not getting triggered(as Order data is not getting changed). As a result the relevant error messages are not getting deleted. I tried using FM <crm_message_delete> and message container classes in button event handler method but got some authorization related error. Is there any way I can trigger ORDER_SAVE method or is there any alternate way to delete error message?

Regards,

Amit

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I found a workaround to trigger ORDER_SAVE BADI.

Option 1 - Create a custom attribute in ORDERADM_H BO and set the attribute value in SAVE method.

Option 2 - CRMD_ORDERADM_H already has dummy field which can be considered for setting in SAVE method.

I used option 2 because the field ORDERADM_H_DUMMY was not used anywhere. The BADI is getting triggered and messages are also getting deleted now.

Regards,

Amit

dhruv_mehta
Active Contributor
0 Kudos

good you found solution.... u added a custom attribute and changed while partner gets changed?

Former Member
0 Kudos

That's one of the option I have written above.

Regards,

Amit

Answers (3)

Answers (3)

dhruv_mehta
Active Contributor
0 Kudos

how are you editing ur bp data from ur order?

i had similar requirment for very few fields on BP to be editated from order it self. I created my own small component and add it in BT125H_TASK ( as i was working with activity ).

Provide us some more techincal things for the same....

make sure you do locking entity properly...

    CALL METHOD SUPER->DO_PREPARE_OUTPUT.

  DATA : LR_BUILHEADER TYPE REF TO CL_CRM_BOL_ENTITY.
  DATA : LR_ADMINH TYPE REF TO CL_CRM_BOL_ENTITY.

  LR_BUILHEADER ?= ME->TYPED_CONTEXT->BUILHEADER->COLLECTION_WRAPPER->GET_CURRENT( ).
  IF LR_BUILHEADER IS BOUND.
    IF LR_BUILHEADER->IS_LOCKED( ) = 'X'.
    ELSE.
      LR_ADMINH ?= ME->TYPED_CONTEXT->BTADMINH->COLLECTION_WRAPPER->GET_CURRENT( ).
      IF LR_ADMINH->IS_LOCKED( ) = 'X'.
        LR_BUILHEADER->LOCK( ).
      ENDIF.
    ENDIF.
  ENDIF.

Former Member
0 Kudos

im not sure if its useful to you but i had similar issue with ORDER_SAVE BADI and crm_message_delete. after so many discussion with functional team as well as BASIS guys nothing much concluded and finally i implemented implicit enhancements in PAI of order save screen itself which went fine.

Former Member
0 Kudos

Hi Amit,

Is your issue solved?

I hope you have all the three methods of order_save Badi

CHANGE_BEFORE_UPDATE

PREPARE

CHECK_BEFORE_SAVE

If still it is not getting triggered. Can you check when you only edit payment data assignment block, do your functional spec have any specific pre- requisite. If yes, check if you can use PPF action methods.

I tried editing Billing Assignment block on Service contract and saved. Order_save badi gets triggered for me. Is that your custom button??