cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Text Variable User Exit

Former Member
0 Kudos

Hi All,

I have a requirement to display the start date range which the user inputs to show as the heading/lable of the report. The dates will be selected as a range like 1/1/2007 to 1/31/2009 and I need it to be displayed in the report as the heading like "January 1, 2007 - January 31, 2009". Therefore I think, I will have to a create a text variable with customer exit form and in the code I will have to define the text for each month ( like 01 = January, 02 = Febuary ) & as it's a range, i guess 2 text variables will need to be created. I am working in BI 7.0.

My questions are:

1) What all options do I need to check when I create the new text variable? And where will I need to insert this text variable in report definition? It is inserted near the query discription?

2) Can anyone please help me with code? Not sure how i can achieve this..

Can anyone advice please. Points will be awarded.

Thanks a lot!!!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sia,

at first I have to let you know that I'm not familiar with BI7.0, because we still run BI3.5.

In my mind you don't have to create 2 variables, one should be enough because for the range 01/01/2008 to ... theire is a variable ( in BI3.5 called 0I_Days )

And for the coding you should take a look into in Sap documentation

http://help.sap.com/saphelp_nw04s/helpdata/en/1d/ca10d858c2e949ba4a152c44f8128a/frameset.htm

( if the link doesn't work search for i_step )

Last but not least some example Code:


Case i_step.

when 1.
...
when 2.
case vname.
when '<your variable>'.
if 0I_days-low(2) EQ '01' .
concatenate 'Jan.' 0i_days-low+2(2) ',' 0i_days-low+4(4) into l_s_range-low.

elseif 0I_days-high(2) EQ '01' .
concatenate 'Jan.' 0i_days-high+2(2) ',' 0i_days-high+4(4) into l_s_range-high.
elseif ...
...
endif.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'BT'. 
Append e_t_range.
endcase.
endcase.

Hope this helps

Sebastian

Former Member
0 Kudos

Hi,

Thanks for the reply! I have written the code as below but I get an error message in code that the variable i created ( ZDATVAR) cannot be changed. please take alook at the code and let me know if u see anything wich is incorrect.

DATA: L_S_RANGE TYPE RSR_S_RANGESID.

DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.

Data : v_month(12) type C.

Data : ZYear(4).

Data : ZMon(2) type N.

CASE I_VNAM.

WHEN 'ZDATVAR'.

IF i_step = 2.

loop at i_t_var_range into loc_var_range

WHERE VNAM = '0ZDATEFROM'.

clear l_s_range.

ZYear = loc_var_range-low(4).

ZMon = loc_var_range-low+4(2).

clear v_month.

If ( ZMon = '01' ).

v_month ='January'.

EndIf.

If ( ZMon = '02' ).

v_month ='February'.

EndIf.

If ( ZMon = '03' ).

v_month ='March'.

EndIf.

If ( ZMon = '04' ).

v_month ='April'.

EndIf.

If ( ZMon = '05' ).

v_month ='May'.

EndIf.

If ( ZMon = '06' ).

v_month ='June'.

EndIf.

If ( ZMon = '07' ).

v_month ='July'.

EndIf.

If ( ZMon = '08' ).

v_month ='August'.

EndIf.

If ( ZMon = '09' ).

v_month ='September'.

EndIf.

If ( ZMon = '10' ).

v_month ='October'.

EndIf.

If ( ZMon = '11' ).

v_month ='November'.

EndIf.

If ( ZMon = '12' ).

v_month ='December'.

EndIf.

CONCATENATE v_month+6(2) ',' +0(4) INTO 'ZDATVAR'.

EXIT.

ENDLOOP.

EndIf.

Thanks!

Former Member
0 Kudos

Hi,

CONCATENATE v_month+6(2) ',' +0(4) INTO 'ZDATVAR'.

this doesn't work, because you can't concatenate into a String.

You have to use the structure l_s_range which contains the values of your variable and you have also to set L_S_RANGE-SIGN and L_S_RANGE-OPT both doesn't have any effect in your querie but I guess they are required .

If you are done with changing the values you have to Append your modification to the structur e_t_range for returnig to the query.

The right code should look like this:

 CONCATENATE  v_month+6(2) ','  zmon+0(4) INTO l_s_range-low.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'. 
Append e_t_range.

kind regards

Sebastian

/Edit

0(4) <- this should also not work it has to be this zmon0(4)

Edited by: Sebastian Bellmann on Jan 30, 2008 9:37 AM

Former Member
0 Kudos

Hi Sebastian,

Thanks a lot for your help, I got my code to work!!!..Full points assigned!!. But i still need to fix a minor issue, I gave space between the vales in cancatenate statement:

CONCATENATE v_month space zday ',' zyear inTO l_s_range-low SEPARATED BY space.

the issue is now the result is "January 01 , 2007" ; there is a space between "01" & "Comma". I don't want that. I want the space to be there after "01 comma". Is there any way I can control that??

Thanks!

Edited by: Sia on Jan 30, 2008 6:21 PM

Former Member
0 Kudos

Hi,

there should be no way while using an single statment. But you can concatenate "zday" and comma first and the put the hole string together.

e.g.


Data tmp(3)." 3 Charaters should be enough
Concatenate zday ',' into tmp.
CONCATENATE v_month tmp zyear INTO l_s_range-low SEPARATED BY space.

kind regards

Sebastian

Former Member
0 Kudos

Thank you so much!!!!!. Full points assigned!!!

Answers (0)