Skip to Content
Author's profile photo Markus Hapke

How to create new conditions with BAdI SD_COND_SAVE_A

Hello !

Topic:

Here is described how to create new conditons with the methods of BAdi SD_COND_SAVE_A.

Our goal was to create a new, further additional price conditon when certain conditions on saving of an new condition are met,

means additionally to the original condition we create a 2nd one .

This relates to BAdI SD_COND_SAVE_A  (SE18) which uses Interface IF_EX_SD_COND_SAVE_A

See too BAdI -Documentation name SD_COND_SAVE_A  if you are lucky to find it.

Starting from

function module RV_CONDITION_SAVE which is calling:

CALL FUNCTION ‘SD_CONDITION_SAVE_EXIT’

The calling of the exit  and subsequent posting is by SAP standard defined as follows in the

FM RV_CONDITION_SAVE:

IF DB_UPDATE = YES. “4.0

  CALL FUNCTION ‘SD_CONDITION_SAVE_EXIT’   ” <– this will call our BAdI-Class

  CALL FUNCTION ‘RV_KONDITION_SICHERN_V13A’ IN UPDATE TASK

In general, if you want to create new conditions this is recommended through using

< fill structures>   ( see other places, where ‘RV_CONDITION_COPY’ is used )

CALL FUNCTION ‘RV_CONDITION_RESET’.

CALL FUNCTION ‘RV_CONDITION_COPY’

IF sy-subrc = 0.

    CALL FUNCTION ‘RV_CONDITION_SAVE’.

    CALL FUNCTION ‘RV_CONDITION_RESET’.

ENDIF.

Therefore, to avoid recursive call  of ‘RV_CONDITION_SAVE’ :

( ‘RV_CONDITION_SAVE’ calls BAdI, which calls ‘RV_CONDITION_SAVE’ which calls BAdi,…  )

use a new custom class attribute GD_UPD_COND_RUNS ( static , proteced , Type BOOLE_D ), see below.

Proceed as follows:

1) Create new impmentation of the BAdI.

Implement a new class:

2) ZCL_IM_SD_COND_SAVE_A

3) Implemenent new method IF_EX_SD_COND_SAVE_A~CONDITION_SAVE_EXIT.

Exemplaric coding for the method – See attachment “Method_IF_EX_SD_COND_SAVE_A~CONDITION_SAVE_EXIT.txt”

I hope there’s someone finding it useful, as the BAdI is not documented !

Greetings, Markus Hapke

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hello Markus,

      Many thanks for this topic. I have the same request.

      But, I have a question about the new custom class attribute GD_UPD_COND_RUNS. I added like as described in your post, but in the sample ABAP code, this attribute GD_UPD_COND_RUNS is never updated to 'X' and in the first lines you check if GD_UPD_COND_RUNS eq 'X'.

      So could you give us some more information in order to implement this method successfully.

      And if you have a more complete example, this will be helpfull.

      Thanks,

      Gil

      Author's profile photo Sri Vishnu Tallapragada
      Sri Vishnu Tallapragada

      Hi Markus

       

      I may be too late but could you paste the coding of "Method_IF_EX_SD_COND_SAVE_A~CONDITION_SAVE_EXIT.txt"

       

      The attachment seems lost

       

      Best regards,

      Vishnu

      Author's profile photo GIRIPRASATH BALAJI
      GIRIPRASATH BALAJI

      Hi , Could you please upload the attachment again .

       

      Many Thanks

      Giri

      Author's profile photo Chandra Ralla
      Chandra Ralla

      Hi I am trying to update ENDPR value using CONDITION_SAVE_EXIT badi. I am able to update the value with in badi but when the cursor return the value goes back to old value. Can anyone help me on this or if you can share the document(Method_IF_EX_SD_COND_SAVE_A~CONDITION_SAVE_EXIT.txt) that would be great.

       

      Thanks in advance.

      Chandra.