cancel
Showing results for 
Search instead for 
Did you mean: 

OLAP Variable does not extract any data

Former Member
0 Kudos

Hi,

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!

Please help!

M

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

yes thyats the code, only I renamed a few elements since they are identical in my DATA statement.

See here:

{WHEN 'ZCML12CM'.

  • 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 < '12'.

VMONTH = VMONTH + 1.

VYEAR = VYEAR - 1.

ELSE.

VMONTH = '01'.

ENDIF.

L_S_RANGE-LOW = VYEAR.

L_S_RANGE-LOW+4 = VMONTH.

CLEAR ZE_T_RANGE.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'BT'.

APPEND L_S_RANGE TO ZE_T_RANGE.}

I've tried using the standard elements L_YEAR and L_MONTH but that didnt make any difference.

Thanks

M

shanthi_bhaskar
Active Contributor
0 Kudos

{WHEN 'ZCML12CM'.

  • 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.

ELSE.

VMONTH = '01'.

ENDIF.

L_S_RANGE-LOW = VYEAR.

L_S_RANGE-LOW+4 = VMONTH.

CLEAR ZE_T_RANGE.

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.

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks!" That worked very well.....

I now realise E_T_RANGE is used as export paramter, and not ZE_T_RANGE...

Thanks a lot for your help!

M

shanthi_bhaskar
Active Contributor
0 Kudos

are you excluding the values from infopackage then it wont be possible in IP

Former Member
0 Kudos

Hi,

thanks for your response.

I'm not excluding anything in my infopackage, I just select my OLAP variable in where the code should exclude current month.

However, since I copied the excisting code, without excluding current month (yet), just to check whether any data gets extracted, no selection is made and all the data for a particular employee is loaded, rather than the last 12 months.

If I use 0CML12CM there is no problem whatsoever, but ZCML12CM with the same code as 0CML12CM does not work.

M

shanthi_bhaskar
Active Contributor
0 Kudos

please execute the Test Routine in the data selection tab..and verify what it is returing ...so that we will come to know does code is getting triggered or not..

Former Member
0 Kudos

Hi,

I did put a breakpoint in the routine already, and when I execute the package there certainly is data in the various data elements.

If is able to determine the value for year and month of last year and the year and month for this year, so it's triggering the right selection.

Somehow, when I look in my data package where the selections are displayed in the header tab, only the employee number that I selected is displayed, not the CALMONTH object, as it should be, even when I use 0CML12CM.

I have even created the variable in the query designed similar to 0CML12CM to be sure it's identical, but no luck.

So the data is there, ABAP code is correct, but still no selection is made when I execute the package... strange indeed!

M

shanthi_bhaskar
Active Contributor
0 Kudos

Did you use this code


  DATA: L_YEAR(4)     TYPE N,
        L_MONTH(2)    TYPE N,
        L_S_RANGE     TYPE RSR_S_RANGESID.

* Determine the last 12 month including the current month
  L_YEAR = SY-DATUM+0(4).
  L_MONTH = SY-DATUM+4(2).

  L_S_RANGE-HIGH = L_YEAR.
  L_S_RANGE-HIGH+4 = L_MONTH.

  IF L_MONTH < '12'.
    L_MONTH = L_MONTH + 1.
    L_YEAR = L_YEAR - 1.
  ELSE.
    L_MONTH = '01'.
  ENDIF.

  L_S_RANGE-LOW = L_YEAR.
  L_S_RANGE-LOW+4 = L_MONTH.

  CLEAR E_T_RANGE.
  L_S_RANGE-SIGN = 'I'.
  L_S_RANGE-OPT  = 'BT'.
  APPEND L_S_RANGE TO E_T_RANGE.