Customer Exit Variable implementation using BADI
Contoh Scenario > Kita akan extract data utk HARI PERTAMA per bulan selama Period 1 tahun kebelakang
Kita akan implement the Interface abstract method of the enhancement spot RSROA_VARIABLES_EXIT &
definition RSROA_VARIABLES_EXIT_BADI in user customized BADI class.
The implementation flow will look like below -
Step by Steps :
1. Create sebuah customer exit variable ZVK_LST_YEAR of type Range & kita off kan checkbox input "Input-Ready" -
2. Jalankan 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.-
Enhancement Implementation BADI Name - ZZSD_VARIABLES_EXIT_BADI
Implemented class Name - ZCL_ZZSD_VARIABLES_EXIT_BADI.
4. Letakkan filter pada created implementation : -
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: WA_RANGE LIKE LINE OF C_T_RANGE,
H_STADAT TYPE SY-DATUM,
H_FINDAT TYPE SY-DATUM,
H_MONTH TYPE N LENGTH 2,
H_DAYS TYPE N LENGTH 2,
H_YEAR TYPE N LENGTH 4,
H_VAR TYPE N LENGTH 8.
CASE I_VNAM.
WHEN 'ZVK_LST_YEAR'.
I_STEP = 1.
H_STADAT = SY-DATUM - 365.
H_FINDAT = SY-DATUM .
WHILE H_FINDAT >= H_STADAT .
H_YEAR = H_STADAT(4).
H_MONTH = H_STADAT+4(2).
H_DAYS = H_STADAT+6(2).
CONCATENATE H_YEAR H_MONTH '01' INTO H_VAR .
H_STADAT = H_STADAT + 30.
WA_RANGE-SIGN = 'I'.
WA_RANGE-OPT = 'EQ'.
WA_RANGE-LOW = H_VAR .
APPEND WA_RANGE TO C_T_RANGE.
CLEAR WA_RANGE.
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.