Passing a value of a variable from CMOD to BADI
Passing a value of a variable from CMOD to BADI.
User wants to take the FISCPER value entered in the variable screen to populate CALMONTH in CMOD as well as use it as a validation field for populating Virtual Characteristics using BADI.
Create a Function Group by going into Transaction SE37->GOTO->Create Group
The Function Group will be created after clicking on Save.
Before proceeding with the creation of Function module, declare the variables in the Include section of the Function group as shown below in SE80 Transaction.
After the declaration of the variable, proceed with the creation of the SET and GET function modules.
Goto SE37 Transaction and proceed with the YBW_TEST_GET FM creation.
Enter the following details in the Export tab of the FM.
Enter the source code given below,
Similarly create the YBW_TEST_ SET FM with the same details as mentioned below.
Activate the Function Modules. Now our FMs are ready to pass value from your CMOD and store the value in BADI.
We have 2 variables in our Query Designer CALMNTH and FISPER1. The FISPER1 is processed by Manual input and using the FISPER1, value for CALMNTH will be calculated.
Always the sequence of Execution of the Bex report is that the CMOD code will be processed first and the result will be send to the BADI for further processing.
In the below code, the value of the FISCPER1 is stored in the variable lv_fiscper and passed via the FM YBW_TEST_SET.
GOTO SE19 Transaction and open the existing implementation for the RSR_OLAP_BADI BADI and use the YBW_TEST_SET function as mentioned below to pass the value of FISPER1 to the BADI code.