cancel
Showing results for 
Search instead for 
Did you mean: 

Customer Exit for Variables not working

Former Member
0 Kudos

Hi All,

I am creating a month to date report. For that I have created 2 variables on 0CALDAY, one with USer Entry and mandatory options and another with Customer Exit, Mandatory and Interval options(not ready for input). I have used the first one for creating a restricted keyfig for daily sales and the other for another restricted keyfig for month to date sales.

The user will input value in the first variable at the runtime and in the customer exit I wrote some code(took help from one of the old forums) to get the values of the start and end dates of the second variable. But the Month to date restricted keyfigs are also showing the same daily sales figs. Below is the code I wrote in the user exit.

CASE I_VNAM.

WHEN 'ZMONTH'.

if I_STEP = 2.

loop at I_T_VAR_RANGE into L_S_VAR_RANGE.

where vnam = 'ZDAY'.

L_S_RANGE-LOW = L_S_VAR_RANGE-low(6).

L_S_RANGE-LOW+6(2) = '01'.

L_S_RANGE-HIGH = L_S_VAR_RANGE-low.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'BT'.

append L_S_RANGE to E_T_RANGE.

endloop.

endif.

ENDCASE.

Can someone please let me know if I an doing any mistake here.

Thanks,

RPk.

Accepted Solutions (1)

Accepted Solutions (1)

former_member188972
Active Contributor
0 Kudos

All the steps are correct for which you wrote.

ZMONTH - is your exit variable customer

ZDAY - is the variable that input the user during the execution of query.

Right?

Did you make a simple debug?

You could put in your code a loop like:

while sy-subrc eq 0.

endwhile.

then execute the query with the transaction RSRT, when your selection goes in infinite loop cath it with SM50

Program/mode-Program-debug

Try...

Former Member
0 Kudos

Yes Sergio,

ZDAY and ZMONTH are 2 variables on 0CALDAY. ZDAY is the one for user input and ZMONTH is the Customer Exit one.

Let me explain you in detail.

I have 2 Keyfigs 0COST and 0SALES. I have created 2 rescricted KFs with these KFs by restricting using the 0CALDAY and the first Variable i.e ZDAY so that it will only display the costs and sales only for the day which user had requested for.

I have created another 2 RKFs on the same KFs restricting again on 0CALDAY but using the ZMONTH variable. This will get the lower and higher ranges from the Customer Exit so that it will display the costs and sales from the 1st day of the month till the date user has given.

But all the 4 RKFs are showing only the figs for the day which user has requested.

I checked it by debugging it and the ranges are being calculated as expected and even there are being updated in the E_T_RANGE.

What could be the problem? As I told earlier this is the first report being created in our BW system. Do I need to make any setting before writing code in the User Exits?

Thanks,

RPK.

former_member188972
Active Contributor
0 Kudos

One dubt,

there is other code in your exit ZXRSRU01 that could impact E_T_RANGE when treat the variable ZMONTH?

Former Member
0 Kudos

Hi Sergio,

As this is our first report, there is no other coding except the above code. One doubt, do we need to update the table I_T_VAR_RANGE with somethign along with the table E_T_RANGE?

When I am teting that in debugging mode, the user exit is being executed 3 times. For STEP 1, it is doing nothing. For STEP 2 it is updating the E_T_RANGE with the low and high values and SIG as 'BT' and option as 'I'. Again in STEP 3. but in STEP 3 I check the table E_T_RANGE and found that it is empty. Is this correct or something wrong?

Thanks,

RPK.

former_member188972
Active Contributor
0 Kudos

In I_step = 3 you don't need to make nothing.

I_T_VAR_RANGE is only in input.

You only have to make modification in E_T_RANGE as appears to me correct all.

Please check more in deeply your query.

If the problem persist, give me a print screen of the query. (e-mail in business card)

Regards,

Sergio

Former Member
0 Kudos

Hi Sergio,

Just sent you an email to both your gmail and techedge IDs. Hope you will help me in solving my problem.

Awaiting your reply...

Thanks,

RPK.

former_member188972
Active Contributor
0 Kudos

On what I see in the query definition your code should be like follow:

CASE I_VNAM.

WHEN 'ZQVMTD1'.

if I_STEP = 2.

loop at I_T_VAR_RANGE into L_S_VAR_RANGE.

where vnam = 'ZQV_CALD'.

L_S_RANGE-LOW = L_S_VAR_RANGE-low(6).

L_S_RANGE-LOW+6(2) = '01'.

L_S_RANGE-HIGH = L_S_VAR_RANGE-low.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'BT'.

append L_S_RANGE to E_T_RANGE.

endloop.

endif.

ENDCASE.

i.e. the name of the variables are different.

Possible?

Former Member
0 Kudos

Hi Sergio,

I have exactly the same code. I have given ZMONTH and ZDAY just for easy understanding.

Below is the exact code I have in my User Exit.

DATA: L_S_RANGE TYPE RSR_S_RANGESID.

DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.

DATA: LOC_VAR_RANGE2 LIKE RRRANGEEXIT.

data: waRange LIKE RRRANGEEXIT.

break-point.

CASE I_VNAM.

WHEN 'ZQVMTD1'.

IF I_STEP = 2.

LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE

WHERE VNAM = 'ZQV_CALD'.

CLEAR L_S_RANGE.

L_S_RANGE-LOW = LOC_VAR_RANGE-LOW(6).

L_S_RANGE-LOW+6(2) = '01'.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'BT'.

L_S_RANGE-HIGH = LOC_VAR_RANGE-LOW.

APPEND L_S_RANGE TO E_T_RANGE.

EXIT.

ENDLOOP.

ENDIF.

endcase.

Any Ideas???

Thanks,

RPK.

former_member188972
Active Contributor
0 Kudos

it's really a mistery!!!

Which I see is perfect as a guide book!

my last tentative:

- reset the cache of the query

- check the availability of data in cube

- insert a normal key figure into your query to check the result.

Bye

Former Member
0 Kudos

Hi RPK ,

I AM NEW IN BW, LIKE TO ASK YOU THE STEPS HOW U CREATED THAT VARIABLE WITH EXIT.

CAN YOU TELL STEPS TO CREATE THIS VARIABLE, I ALSO HAVE TO CREATE FOR FI REPORTS.

THANKS IN ADVANCE.

Message was edited by: S M

Former Member
0 Kudos

Hi SM,

Please leave your email ID. I will send the step by step document.

Thanks,

RPK.

Former Member
0 Kudos

Hi RPK,

Please share the same doc will b gr8 helpful.

I will reward u points also.

my mail id : rakeshkonda007@gmail.com

Will b waiting for ur doc.

Urs,

Raki.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Go to RSRT and enter your query name.

Then Generate Report(Click the button in menu).

The execute..see the result.

Bex normally doesn't take the changes made in cmod, if you don't close the session.

Regards,

San!

Message was edited by: San!

Former Member
0 Kudos

Hi Sergio/Anil,

I have tried both your code but unfortunately nothing has been changed. I have no clue of what is going on. Everything seems to be OK and even in debugger I can see that the E_T_RANGE is being filled with my required range but the result is the same. What might be the problem?

Hi San,

I have tried executing my report in RSRT using the option 'Generate Report'. When I click on it the mouse pointer is showing me that something is happeningn but after couple of seconds it returns to normal mode and nothing is happening then. I tried using the 'Execute' button and the result is the same report which I can see in the BEx.

Please help me in solving this.

Do I need to make any changes or setting before using the exits? This is the first report being created in our BW system.

Thanks,

RPK.

Former Member
0 Kudos

Can someone shed some light on this please!!!

Thanks,

RPK.

Former Member
0 Kudos

Hi,

Try this:

DATA: L_S_RANGE TYPE RSR_S_RANGESID.

DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.

DATA: LOC_VAR_RANGE2 LIKE RRRANGEEXIT.

CASE I_VNAM

WHEN 'ZMONTH'.

IF I_STEP = 2.

LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE

WHERE VNAM = 'ZDAY'.

CLEAR L_S_RANGE.

L_S_RANGE-LOW = LOC_VAR_RANGE-LOW(6).

L_S_RANGE-LOW+6(2) = '01'.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'BT'.

L_S_RANGE-HIGH = LOC_VAR_RANGE-LOW.

APPEND L_S_RANGE TO E_T_RANGE.

ENDLOOP.

ENDIF.

endcase.

<b>Activate the Program and Project also.</b>

If you would have taken type of L_S_VAR_RANGE is RSR_S_RANGESID, your code is perfect.

<b>Close the sessions of BEx in SM04</b>.and then reopen the BEx and test the new change. You have to close sessions in SM04 because if sessions are still open, Server may use old code.

With rgds,

Anil Kumar Sharma .P

Message was edited by: Anil Kumar Sharma

former_member188972
Active Contributor
0 Kudos

Try to insert this:

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'BT'.

append L_S_RANGE to E_T_RANGE.

--> Insert

EXIT.

<--- end of insert

endloop.

endif.

ENDCASE.

former_member188972
Active Contributor
0 Kudos

I think you miss this:

......

loop at I_T_VAR_RANGE into L_S_VAR_RANGE.

where vnam = 'ZDAY'.

L_S_RANGE-LOW = L_S_VAR_RANGE-low(6).

L_S_RANGE-LOW+6(2) = '01'.

--->

L_S_RANGE-HIGH = L_S_VAR_RANGE-low(6).

L_S_RANGE-HIGH+6(2) = '30'

<-------

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'BT'.

append L_S_RANGE to E_T_RANGE.

endloop.

.........

But I suggest to you to find a FM to define correctly the number of days of the month (I set 30 as example).

Regards,

Sergio

Former Member
0 Kudos

Hi Sergio,

My requirement is to take the HIGH value as the user input and not the end of the month i.e if the user input is 20.10.2006 then the Month to date range should be 01.10.2006 and 20.10.2006. This is the reason that I am assigning the user input to the HIGH value(L_S_RANGE-HIGH = L_S_VAR_RANGE-low). I have checked the code in debugging mode and found that the code is being executed in the I_STEP = 2 and also I can see the low and high values as required but when I see the report the values are not being picked for the range.

Do I need to make any setting other than this coding?

Thanks,

RPk.