Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

variable with user exit, urgent plz

Hi friends,

I have a requirement to create a variable with user exit. The variable should be based on

forecast period. And it is based on quarter value. If user enters

jan2007 it have to fetch amount value for jan2007

feb2007 it have to fetch amount value for jan + feb 2007

mar2007 it have to fetch amount value for jan + feb + mar 2007

apr2007 it have to fetch amount value of apr2007

may2007 it have to fetch amount value of apr + may 2007

jun 2007 it have to fetch amount value of apr+may + jun 2007

jul2007 it have to fetch amount value of jul 2007

so on

I hope I gave you some idea. can some one give me the user exit code for this one please... It is an urgent requiremet.

Appreciate your help.

Thanks.

Ravi

Former Member
Former Member replied

Ravi,

Can you give me the valies eneterd by the user. I mean some sample data...

Data: itab like i_t_var_range,

mvar(2) type N,

yvar(4) type N,

first_dat type D,

pyvar(4) type N.

WHEN ZKDAT.

IF i_step = 2.

LOOP AT i_t_var_range INTO itab WHERE vnam = 'ZKDAT'.

CLEAR: mvar, yvar, first_dat, pyvar.

mvar = itab-low+4(2).

yvar = itab-low+0(4).

CASE mvar.

WHEN '01' or '02' or '03'.

pyvar = yvar -1.

concatenate pyvar '04' '01' into first_dat.

l_s_range-low = first_dat.

l_s_range-high = itab-low.

l_s_range-sign = 'I'.

l_s_range-opt = 'EQ'.

APPEND l_s_range TO e_t_range.

EXIT.

WHEN Others.

concatenate yvar '04' '01' into first_dat.

l_s_range-low = first_dat.

l_s_range-high = itab-low.

l_s_range-sign = 'I'.

l_s_range-opt = 'EQ'.

APPEND l_s_range TO e_t_range.

EXIT.

ENDCASE.

ENDLOOP.

ENDIF.

Ravi, using this sample code you can make changes relevant to your case. If you can give inputs I asked for I will modify and give it.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question