Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Markus_Hapke
Explorer
0 Kudos
4,709

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

4 Comments
Labels in this area