Skip to Content
0
Jun 05, 2007 at 01:36 PM

Deriving the same week interval for the previous year

23 Views

Dear friends

I am facing an issue with my variable exit.

The business requirement is to be able to retrieve indicators for a week interval for the current year in one column and in another retrieve indicators for the same week interval of the previous year.

When I execute my query in get an error saying no value could be determined for the variable I want to populate.

here is the code of my exit function

DATA: L_S_RANGE TYPE RSR_S_RANGESID.

DATA: LOC_VAR_RANGE like RRRANGEEXIT.

DATA: ZYEAR1(4) type N,

ZYEAR2(4) type N,

ZMONTH1(2) type n,

ZMONTH2(2) type n.

CASE I_VNAM.

WHEN 'Zvar_CALWEEK'.

IF I_STEP = 2. "

read table I_T_VAR_RANGE INTO LOC_VAR_RANGE with key VNAM = 'Zvar_CALWEEKREF'.

  • LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = 'ZCALWEEKREF'.

IF SY-SUBRC = 0.

CLEAR L_S_RANGE.

ZYEAR1 = LOC_VAR_RANGE-LOW(4).

ZYEAR1 = ZYEAR1 - 1.

ZMONTH1 = LOC_VAR_RANGE-LOW+4(2).

CONCATENATE ZYEAR1 ZMONTH1 INTO LOC_VAR_RANGE-LOW.

L_S_RANGE-LOW = LOC_VAR_RANGE-LOW.

ZYEAR2 = LOC_VAR_RANGE-HIGH(4).

ZYEAR2 = ZYEAR2 - 1.

ZMONTH2 = LOC_VAR_RANGE-HIGH+4(2).

CONCATENATE ZYEAR2 ZMONTH2 INTO LOC_VAR_RANGE-HIGH.

L_S_RANGE-HIGH = LOC_VAR_RANGE-HIGH.

L_S_RANGE-LOW = LOC_VAR_RANGE-LOW.

L_S_RANGE-HIGH = LOC_VAR_RANGE-HIGH.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'BT'.

APPEND L_S_RANGE TO E_T_RANGE.

ENDIF.

ENDIF.

ENDCASE.

In short I would like to populate my variable based on the first variable ready for input and obligatory.

I thank you in advance

Regards

Boujema