OLAP Variable does not extract any data
I copied SAP standard OLAP Variable 0CML12CM into new variable ZCML12CM from which I want to exclude the current month.
At first I'm testing to see if the datapackage extracts any data or not, by using the SAP standard variable ABAP Code (so current month is not excluded yet) in my variable ZCML12CM. The variable extract the last 12 months including current month.
in CMOD the code seems correct, and I'm able to select the variable in my data package, assigning a fiscal year variant to it.
The data package is to extract HR data from datasource Employee (0HR_PA_0).
The problem is; no selection is made on CALMONTH when I execute the package, so all data is extracted, instead of the last 12 months. Any idea why this is hapening? I'm 99,9% the code is correct, but somehow the package does not pick it up!
Shanthi Bhaskar replied
Determine the last 12 month including the current month
VYEAR = SY-DATUM+0(4).
VMONTH = SY-DATUM+4(2).
L_S_RANGE-HIGH = VYEAR.
L_S_RANGE-HIGH+4 = VMONTH.
IF VMONTH < '.
VMONTH = VMONTH + 1.
VYEAR = VYEAR - 1.
VMONTH = '01'.
L_S_RANGE-LOW = VYEAR.
L_S_RANGE-LOW+4 = VMONTH.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'BT'.
APPEND L_S_RANGE TO ZE_T_RANGE.}
here is the correction
APPEND L_S_RANGE TO ZE_T_RANGE is wrong APPEND L_S_RANGE TO E_T_RANGE.