cancel
Showing results for 
Search instead for 
Did you mean: 

Global Variable thru Customer exiit-No working

Former Member
0 Kudos

Hi All,

Problem: 'When using a RKF "Last 12 Months consumption"

with 0CALMONTH,Movement Type & Issue Total Stock' the query gives no value for the RKF.

I am facing a strange problem with my 0CALMONTH variable name ZCM2L12M (last 12 month including the selected month). The varible is supposed to get the value of selected Month/Year value in interval form (from another Z variable where Variable entry is single).

1. Z variable is ZSELMON (Variable entry is single)

2. DATA: L_MONTH(2) TYPE N,

L_YEAR(4) TYPE N,

L_S_RANGE TYPE RSR_S_RANGESID.

DATA: S_T_VAR_RANGE TYPE RRRANGEEXIT.

2. When 'ZCM2L12M'.

IF I_STEP = 2.

CLEAR S_T_VAR_RANGE.

LOOP AT I_T_VAR_RANGE INTO S_T_VAR_RANGE.

IF S_T_VAR_RANGE-VNAM = 'ZSELMNTH'.

L_YEAR = S_T_VAR_RANGE-LOW+0(4).

L_MONTH = S_T_VAR_RANGE-LOW+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.

ENDIF.

ENDLOOP.

ENDIF.

Let me know if anybody can throw some light on the strange behavior of my variable.

Mahendra

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Try this code.

1. Z variable is ZSELMON (Variable entry is single)

2. DATA: L_MONTH(2) TYPE N,

L_YEAR(4) TYPE N,

L_S_RANGE TYPE RSR_S_RANGESID.

DATA: S_T_VAR_RANGE TYPE RRRANGEEXIT.

2. When 'ZCM2L12M'.

IF I_STEP = 2.

CLEAR S_T_VAR_RANGE.

LOOP AT I_T_VAR_RANGE INTO S_T_VAR_RANGE

WHERE VNAM = 'ZSELMNTH'.

MOVE S_T_VAR_RANGE-LOW(4) TO L_YEAR.

MOVE S_T_VAR_RANGE-LOW+4(2) TO L_MONTH.

MOVE L_YEAR TO L_S_RANGE-HIGH(4).

MOVE L_MONTH TO L_S_RANGE-HIGH+4(2).

IF L_MONTH < '12'.

L_MONTH = L_MONTH + 1.

L_YEAR = L_YEAR - 1.

ELSE.

L_MONTH = '01'.

ENDIF.

MOVE L_YEAR TO L_S_RANGE-LOW(4).

MOVE L_MONTH TO L_S_RANGE-LOW+4(2).

CLEAR E_T_RANGE.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'BT'.

APPEND L_S_RANGE TO E_T_RANGE.

EXIT.

ENDLOOP.

ENDIF.

With rgds,

Anil Kumar Sharma .P

Kindly assign points, if it really helps you.

Message was edited by: Anil Kumar Sharma

Former Member
0 Kudos

Hi,

Looks good. One comment - one needs to find out what is a single entry variable: ZSELMON or ZSELMNTH?

Best regards,

Eugene

Former Member
0 Kudos

Hi Eugene Khusainov ,

Thank you for your correction.

So, Mahendra Mahapatra ,the correct code is :

1. Z variable is ZSELMON (Variable entry is single)

2. DATA: L_MONTH(2) TYPE N,

L_YEAR(4) TYPE N,

L_S_RANGE TYPE RSR_S_RANGESID.

DATA: S_T_VAR_RANGE TYPE RRRANGEEXIT.

2. When 'ZCM2L12M'.

IF I_STEP = 2.

CLEAR S_T_VAR_RANGE.

LOOP AT I_T_VAR_RANGE INTO S_T_VAR_RANGE

WHERE VNAM = 'ZSELMON'.

MOVE S_T_VAR_RANGE-LOW(4) TO L_YEAR.

MOVE S_T_VAR_RANGE-LOW+4(2) TO L_MONTH.

MOVE L_YEAR TO L_S_RANGE-HIGH(4).

MOVE L_MONTH TO L_S_RANGE-HIGH+4(2).

IF L_MONTH < '12'.

L_MONTH = L_MONTH + 1.

L_YEAR = L_YEAR - 1.

ELSE.

L_MONTH = '01'.

ENDIF.

MOVE L_YEAR TO L_S_RANGE-LOW(4).

MOVE L_MONTH TO L_S_RANGE-LOW+4(2).

CLEAR E_T_RANGE.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'BT'.

APPEND L_S_RANGE TO E_T_RANGE.

EXIT.

ENDLOOP.

ENDIF.

With rgds,

Anil Kumar Sharma .P

Former Member
0 Kudos

Hi Anil,

The code didn't work. I appriciate your help. The result is same as my code. May be there might be some other reason behind this strange behavior. Do we have to apply any higher patch.

We have SAP 3.5 with the following SPAM info

Component I Release Level Highest SP

SAP_BASIS 640 0011 SAPKB64011

SAP_ABA 640 0011 SAPKA64011

PI_BASIS 2004_1_640 0008 SAPKIPYI68

SAP_BW 350 0009 SAPKW35009

FINBASIS 300 0008 SAPK-30008IN..

SEM-BW 400 0008 SAPKGS4008

BI_CONT 353 0000 -

Regards

Mahendra

Former Member
0 Kudos

Hi,

R you getting any message.

have selected

'customer exit' for 'processing by',

'interval' for 'variable reprecents',

'mandatory' for 'variable entry' for the variable ZCM2L12M.

With rgds,

Anil Kumar Sharma .P

Kindly assign points to helpful postings.

Former Member
0 Kudos

Hi Anil,

selected

'customer exit' for 'processing by',- Yes

'interval' for 'variable reprecents',- Yes

'mandatory' for 'variable entry' for the variable ZCM2L12M - Yes

The variable works if I click on the "Ready to Input" check box & provides the necessary calender/Year.

But without the check box it is still not working.

Let me know if you think any other reason.

Regards

Mahendra

Former Member
0 Kudos

Hi,

I beleive that there is something wrong with data types declarations and casting.

I would tell it when I test it in the system.

Moreover, to get the better understanding of what the code is doing try to debug it.

Best regards,

Eugene

Former Member
0 Kudos

Hi Eugene,

Thanks for the input. I have already debuged the code & I am getting the correct result i.e high & low values of L_S_RANGE. Also it appends the value to E_T_RANGE. But my concerns is why its not coming to my report output i.e to BEx.

Regards

Mahendra

Former Member
0 Kudos

Hi Mahendra,

If your exit returns the variable value properly, then most likely, the wrong BEx result is a matter of filtering. Where exactly the single entry variable and a range (exit) variable are situated (filter area, free char area, structures)?

Best regards,

Eugene

Former Member
0 Kudos

Hi Eugene,

My range (exit) variable is situated in the keyfigure area & I have tested my single entry vaiable by putting in filter area, free char & Row area also.

Still it is not working.

Regards

Mahendra

Former Member
0 Kudos

Hi Mahendra,

First of all, let’s clarify the following. What exactly is wrong: variable value or query result? I think that if it was something wrong in the exit, then it would be an error message. Then assume that it’s a wrong query result.

From my experince I remember that if you use a single entry variable and determine a range exit variable value from the first variable, then it’s always a problem where to put your user entry var. You should it place somewhere in order to pop it up for user entry.

And after that you have two vars which probably act like two filters.

For me the easiest way to perform what you want was following.

Create two SINGLE ENTRY variables. One – for a user entry, another one – for user exit. If your time restriction should apply to all rows and columns, then in the query put your time char, say CALMONTH, into filter area. Restrict it with range. Put as a higher range value your user entry var, and your exit var as a lower range value.

In this case your user entry var window will pop up for entry and determined in the user exit value of the 2nd var will give you a range for time restriction. And the filter will work as you want it to!

If my suggestion is suitable for you - just rewrite the code for your exit var - it should return a single value, not a range.

Don’t forget to assign point to people who helped you (if they did). It’s a way to say thanks in SDN.

Best regards,

Eugene