Skip to Content
Author's profile photo Former Member

Passing a value of a variable from CMOD to BADI

Requirement:

Passing a value of a variable from CMOD to BADI.

Sample Scenario:

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.

Solution:

Create a Function Group by going into Transaction SE37->GOTO->Create Group

/wp-content/uploads/2014/12/pic1_600018.jpg

/wp-content/uploads/2014/12/pic2_600019.jpg

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.

/wp-content/uploads/2014/12/pic3_600020.jpg

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.

/wp-content/uploads/2014/12/pic4_600021.jpg

Enter the following details in the Export tab of the FM.

/wp-content/uploads/2014/12/pic5_600032.jpg

Enter the source code given below,

/wp-content/uploads/2014/12/pic6_600034.jpg

Similarly create the YBW_TEST_ SET FM with the same details as mentioned below.

/wp-content/uploads/2014/12/pic7_600036.jpg

/wp-content/uploads/2014/12/pic8_600037.jpg

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.

/wp-content/uploads/2014/12/pic9_600038.jpg

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.

/wp-content/uploads/2014/12/pic10_600045.jpg

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.