cancel
Showing results for 
Search instead for 
Did you mean: 

Deriving the same week interval for the previous year

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try with following modifications:

ZYEAR1(4) = LOC_VAR_RANGE-LOW(4).

ZYEAR1(4) = ZYEAR1(4)- 1.

ZMONTH1(2) = LOC_VAR_RANGE-LOW+4(2).

CONCATENATE ZYEAR1(4) ZMONTH1(2) INTO LOC_VAR_RANGE-LOW(6).

With rgds,

Anil Kumar Sharma .P

Former Member
0 Kudos

Thank you both for your input

I 'll certainly come back to you soon

Thanks once again

Regards

Boujema

Answers (2)

Answers (2)

Former Member
0 Kudos

I found out how to do it thanks.

Former Member
0 Kudos

Hi,

read table I_T_VAR_RANGE INTO LOC_VAR_RANGE with key VNAM = <b>'Zvar_CALWEEKREF'</b>. this variable should be your input variable.

not User exit variable.

Put break point and debugg....

Hope it Helps