Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

How to create new conditions with BAdI SD_COND_SAVE_A

$
0
0

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


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>