Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

UserExit For Variable issue..

Former Member
0 Kudos

Hi,

I am struggling with my first customer exit for variables in BEx.

In BEx Query user enters Fiscalyear/period : ZPER (e.g.001/2007) in the selection criteria.

And in the rows I want to calculate the versions ZVER for each posting period Jan, Feb, Mar....(0FISCPER-> 1, 2, 3....) in the columns.

Eg.

PPeriod Jan Feb Mar...

Version 3 2 3

The logic is:

If ZPER is GE 0FISCPER then ZVER=3 else posting period is 2.

Can anyone please help me with the code for this.

The exit is : EXIT_SAPLRRS0_001 and include ZXRSRU01.

So far I could manage:

DATA: L_S_RANGE TYPE RSR_S_RANGESID.

DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.

DATA: PERIOD TYPE d.

CASE i_vnam.

WHEN 'ZVER'.

PERIOD = ZPER(3)

IF I_STEP = 2.

CLEAR L_S_RANGE.

IF PERIOD GE 0FISCPER.

ZVER = 3.

ENDIF.

Can anyone please help me with this code.

Thanks

8 REPLIES 8

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Hi Sarah, I'm not sure I follow your requirement.

Exactly which part of the logic are you struggling with.

Is it just this part...

<i>If ZPER is GE 0FISCPER then ZVER=3 else posting period is 2.

Can anyone please help me with the code for this.</i>

IF PERIOD GE 0FISCPER.
ZVER = 3.
<b>else.
zver = 2.</b>
ENDIF

Regards,

Rich Heilman

0 Kudos

Thanks Rich for responding.

the error I get when I run check is:

Field "ZPER" is unknown. It is neither in one of the specified

and

tables nor defined by a "DATA" statement.

and it doesnt understand 0FISCPER(I use this in restricting Posting Period)

Thanks once again..

0 Kudos

Well, these fields would either have to be defined in the user exit include program, or be a part of the signature of the EXIT_SAPLRRS0_001 function module being called.

Where are these values coming from?

Regards

Rich Heilman

0 Kudos

Hi,

declare ZPER variable.

if it is a table ,declare like this :

Tables : ZPER.

if it is a table field.

declare like

Data : zper like tablename-fieldname.

Regards

Laxman

0 Kudos

ZPER is a variable created in BEx <Mandatory, ReadyforInput,Single value>. Its used as Filter in the Query and the value is entered in the selection screen when BEx Query is run.

~ Do I still have to declare it? and how?

I am not using any tables here its basically based on the Fiscalyear/Period entered by the user, the posting period needs to be compared and accordingly version is determined.

I am using the same exit and include.

Is there anything i am missing. Hope my logic is right.

Thanks

0 Kudos

If the value is not being passed into the function module interface, then you can not access it directly. You can try to get to it thru memory using fields symbols. I don't seem to have this exit in my system, so I really can't guide you thru it.

Regards

Rich Heilman

0 Kudos

I am not sure how to pass the value from the selection screen for ZPER to the exit. As, ZPER is already a variable declared in Bex. Do I have use it differently?

As based on what user enters in ZPER only then Posting periods can be compared and accordingly version will be decided.

Can anyone please help with this.

Thanks.

0 Kudos

Seems in current user exit this variable is not passed or available.

Then try to find an exit which triggers before this exit with this varilable in scope.

EXPORT <VAR> to memory id 'TEST'.

and

IMPORT <VAR> from memory id 'TEST'.

Here you export this to memory and access this in your required user exit to do the processing.

Regds

Manohar