# Batch Derivation with BADI Derivation

Purpose:   When sender passes values of numeric single value characteristics to receiver, we can either pass minimum/maximum or average value of multiple sender batches. We will show case how BADI enhancement DERIVATION can be utilized and mean absolute value can be calculated and sent to receiver batch for results.

Example:

Receiver Material N-2600 Cetepharm-N tablet in IDES client.

When these sender batches send the SI characteristic to receiver sender batch would calculate the plain average.

SI (receiver) = (30+90)/2 = 120/2=60.

With the help of BADI DERIVATION we would calculate mean average with below formula:

SI( receiver) = SI % of sender1*batch qty issued of senderbatch1 / total qty issued to receiver +

SI % of sender2*batch qty issued of senderbatch2/ total qty issued

1.               1.   Method BWU_LIST_CALL_AFTER:   CT_BWU_LIST table would provide you the information about  all batches so far issued

to the process order.Extract the same in global internal table I_BATCH_TAB to be used in method RECEIPIENT_VALUES_AND_STATUS.

Logic to be written in method RECIPIENT_VALUES_AND_STATUS:

1.       Refine the batches received as a result of batch where used search results from I_BATCH_TAB to make sure we are only considering results relevant to receiver process order.

2.       Refine I_BATCH_TAB to have batches relevant to consumption only ( Type C  from I_BATCH_TAB).

3.       Calculate the total quantity of sender batch issued to process order.

4.       Apply mean absolute formula explained above if i_recipient_condition_record-exit1 = c_wtavg which is control parameter we defined in receiver condition record in EXIT1.

5.       Update results in CT_RECIPEINT_VALUES parameter of method which would flow to batch automatically.

Receiver batch shows mean absolute average instead of simple average per formula explained above.

Same way BADI DERIVATION can be useful in implementing your own logic during batch derivation.