cancel
Showing results for 
Search instead for 
Did you mean: 

How to write customer exit for the variable

Former Member
0 Kudos
57

Hi Experts,

I have a requirement to create the variable, the scenaria is like this..

I need to create the variable which gives the period/year values,if yours enters the values 05.2007 then the variable should return the first monthe the year i.e.01.2007.

I hope it can be done by writing the customer exit..but iam unware how to achieve this.

Please explain me step by step and cope for customer exit to done this.

Points will be awarded

Suraj.

Accepted Solutions (1)

Accepted Solutions (1)

edwin_harpino
Active Contributor
0 Kudos

hi Suraj,

there should variable sap exit for first month,

for customer exit, check this how to doc for steps

https://websmp210.sap-ag.de/~sapdownload/011000358700002762582003E/HowToDeriveVariableValue.pdf

your code may look like

----


  • INCLUDE ZXRSRU01 *

----


DATA: L_S_RANGE TYPE RSR_S_RANGESID.

DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.

CASE I_VNAM.

WHEN 'your 1st month variable'.

IF I_STEP = 2. "after the popup

LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE

WHERE VNAM = 'your user input variable'.

CLEAR L_S_RANGE.

L_S_RANGE-LOW = LOC_VAR_RANGE-LOW(4)."low value, e.g.200001

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

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'EQ'.

APPEND L_S_RANGE TO E_T_RANGE.

EXIT.

ENDLOOP.

ENDIF.

ENDCASE.

hope this helps.

Former Member
0 Kudos

Hi Edwin,

thanks for quick reply,

here iam creating only one variable and that should return the first month of the year after the user inputs the current month or anyothermonth.

should i keep my varible in both 'WHEN' and IF I_STEP=2 statements?

Regards

Suraj

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

No need to get more inputs at this time. Already you have the solution that Edwin has provided clearly. Use his logic properly, surely will get solution. His ABAP routine is exactly matching with your requirement.

Regards,

Vivek V

Former Member
0 Kudos

Hi Vivek

thanks for reply,i am closing the thread and assigned the points to u all.

regards

Former Member
0 Kudos

thanks

former_member188325
Active Contributor
0 Kudos

Hi,

What if user enters 06.2006? then also it it should return 01.2007? please give is logic behind this.

thanks

Former Member
0 Kudos

Hi Murali,

If the user enters 06.2006 then it should return 01.2006..that is the requirement.hope u understood.

Regards

edwin_harpino
Active Contributor
0 Kudos

hi Suraj,

you can try as the doc, create 2 variables, one for user entry,

and the other with user exit, and use the code mentioned,

hope this helps.

former_member188325
Active Contributor
0 Kudos

It means you always want to have data for 01.2007?? then whats the use of making user to enter value? any specific reason?

Former Member
0 Kudos

if the user enters <b>05.2006</b> it should return the <b>01.2006</b>.....hope u got the point.

former_member188325
Active Contributor
0 Kudos

Then you have to crate two variables.one is userentry,ready for input..

var2: customer exit to read the value from var1,not ready for input.

then create a dummy rkf in rows/columns where ever applicable and use var1 over there.and hide this dummy rkf.

now...have to think about syntax.

Former Member
0 Kudos

Hi,

Iam going to use this variable in the structures..so icant modify all the reports by inserting the dummy rkf.....i need a simple solution like replace the user entered value with first month of the year and display the same in the output.

can i achieve this with out modifing the existing reports?

Thanks

Suraj

Message was edited by:

suraj kumar

Message was edited by:

suraj kumar

Former Member
0 Kudos

hi any updates??

Message was edited by:

suraj kumar