Customer Exit Variable implementation using BADI
In this blog I am going to discuss about the Customer exit variable implementation using BADI.
The scenario is We need to consider(extract) the snapshot data of the 1st day of every month over a 1 year period back starting from current data.
In the next blog step by step I will discuss about the PYMTD, YTD, YMTD based on a range or input date.
To implement the customer exit, we need to implement the Interface abstract method of the enhancement spot RSROA_VARIABLES_EXIT and definition RSROA_VARIABLES_EXIT_BADI in user customized BADI class.
The implementation flow will look like below –
Step by Steps :
1. Create a customer exit variable ZVK_LST_YEAR of type Range and remove check from the checkbox input “Input-Ready” –
2. Go to SE18 and check the RSROA_VARIABLES_EXIT to check the interface and method definition. It will help us to implement the method of interface exists in the RSROA_VARIABLES_EXIT definition using SE19 in the next steps.
3. Go to Se19. Create a Custom BADI inside the enhancement Spot RSROA_VARIABLES_EXIT.
With the below name.-
Customized BADI Name – ZZSD_VARIABLES_EXIT_BADI
Implemented class Name – ZCL_ZZSD_VARIABLES_EXIT_BADI.
4. Put the filter in the created implementation as below –
5. Go inside the class to crate your code –
6. The code to implement the scenario of the customer exit is given below-
method IF_RSROA_VARIABLES_EXIT_BADI~PROCESS. DATA: WA1 like LINE OF C_T_RANGE, ZINITIALDT TYPE SY-DATUM, ZENDDT TYPE SY-DATUM, ZNMONTH TYPE N LENGTH 2, ZDAYS_LV TYPE N LENGTH 2, ZYAR_LV TYPE N LENGTH 4, var type N LENGTH 8. CASE I_VNAM. WHEN 'ZVK_LST_YEAR'. I_STEP = 1. ZINITIALDT = sy-datum - 365. ZENDDT = sy-datum. WHILE ZENDDT >= ZINITIALDT. ZYAR_LV = ZINITIALDT+0(4). ZNMONTH = ZINITIALDT+4(2). ZDAYS_LV = ZINITIALDT+6(2). CONCATENATE ZYAR_LV ZNMONTH '01' INTO var. ZINITIALDT = ZINITIALDT + 30. WA1-sign = 'I'. WA1-opt = 'EQ'. WA1-LOW = var. APPEND WA1 TO C_T_RANGE. CLEAR WA1. ENDWHILE. ENDCASE. endmethod.
7. Activate the class and BADI implementation respectively.
8. Now you can go to RSRT and check the query.
Hope this will help.
In the next BLOG I will discuss customer exit variable implementation of MTD,YTD, PYTD, PYMTD etc.