cancel
Showing results for 
Search instead for 
Did you mean: 

Customer Exit Code for variable

Former Member
0 Kudos

Hi friends,

I have keydate as a input variable for my query of production report and i want to show the production qty from first day of financial year to keydate.

How i should write the code in customer exit. can anybody has this code ready?.

Regards,

Suyash

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Suyash,

Give me the date formats and the starting date of the financial year.

So when the user enters the date suppose 15.06.2007, th user should see the data in that particular column from the starting date to the date 15.06.2007, right?

Also let me know the IO of the date.

Will write the code. you can make slight modifications to that and use the code in CMOD.

Former Member
0 Kudos

Thanx venkat,

i have keydate (0p_KEYDT) format (dd/mm/yyyy) as input parameter, e.g if i put 30/03/2007 (30th march07), code should give me 01/04/2006 (which is the first day of current financial year) and we are using V3 fisc veriant.

Regards,

Suyash

Former Member
0 Kudos

Suyash,

You can do the restriction of V3 in the report. you need not do anything about V3 in exit.

check the below code and make necessary changes and use it in CMOD.

let name of the variable on 0P_KEYDT which should be of type customer exit be ZKDAT.

Check the below code

You can find comments in the bracket.

Data: itab like i_t_var_range,

mvar(2) type N, ( to hold month)

yvar(4) type N, (to hold year)

first_dat(6) type N, (to hold starting date)

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.

Former Member
0 Kudos

Material Priceon31st 0calday priceas Qty Difference

1 5.00 1/2/07 5.50 2 5.00-5.50=-0.50

2/2/07 3.50 3

8/2/07 8.50 5

I have a requirement where if the user enters in the selection screen 02.2007 then the price of the material ahouls be compared with 31st march of previous year , in th e above example the price of the material changes 3 times & even it should show me the qty of material ordered for this material in the month 02.2007

For this I have created 1 custometexit variable for 0calday ( for 31st March data)

& created restricted keyfigure & in this I kept the keyfigure Netprice & 0calday restricted with customerexit variable

& I have created variable for 0calmonth/year if processing type manual entry/default value & created restricted keyfigure & in this I kept the keyfigure Netprice & 0calmonth/year restricted with variable manual entry/default value

& written the following code

If the user does not enter any value then it should compare 31st march data with all the months data

I have placed material, 0calday in rows . restricted keyfigures in cols

When I enter some value in selection screen then it is not at all showing the coulmn which I have created for 31st March netprice (even though I don’t have the data in my system for 31 March of previos year , it should show me blank).if I am not entering the value in the selection screen like 02.2007 then in 31st march price column also it is showing me the same values which I have for 02.2007 netprice values

Material Price on31stMarch 0calday priceas Qty

on

1 5.50 1/2/07 5.50 2

3.50 2/2/07 3.50 3

8.50 8/2/07 8.50 5

10.00 1/3/07 10.50 6

DATA: l_s_range TYPE rsr_s_rangesid,

i_s_range TYPE rrs0_s_var_range,

v_ysdate LIKE sy-datum,

v_year(4).

CASE i_vnam .

customerexit variableWHEN 'VAR_CMY'. --

CLEAR:l_s_range,v_year,v_ysdate.

READ TABLE i_t_var_range INTO i_s_range

Manual entry defaultWITH KEY vnam = 'VAR_SCALMONTH'.----


variable

IF sy-subrc = 0.

v_year = i_s_range-low(4) - 1 .

CONCATENATE v_year '03' '31' INTO v_ysdate.

l_s_range-low = v_ysdate.

l_s_range-sign = 'I'.

l_s_range-opt = 'EQ'.

APPEND l_s_range TO e_t_range.

ENDIF.

ENDCASE.

Why my code is not working ,pls give anu inputs.or shall open th enew forum

but pls guide me

Former Member
0 Kudos

thanx venkat,

if i put 30/03/2007 then it is showing me 200604 means start of financil year period.

for calculation shall i put restriction on fisc.year -ZKDAT equal and grater than, and

calday restriction - 0p_keydt is less than and equals to, will it works?

Regards,

Suyash

Former Member
0 Kudos

But it should show 20060401 na? It will directly populate from date and to date also. i mean the date entered by the user also.

Is the user entering input for fisc year?

Please give me details of all user inputs so that I can modify the code without complexities for you....

Former Member
0 Kudos

hi vankat,

there is only one user input which is keydat (0P_KEYDT), if value is 30.03.2007

ur code is giving 200604 instead of 20060401, here 01 is not comming, so it gives me error.

kindly check the code where u have written "concatenate pyvar '04' '01' into first_dat"

regards

suyash

Former Member
0 Kudos

Hi venkat,

I eagerly waiting for ur reply , pls reply me

Former Member
0 Kudos

Suyash,

Just change the first_dat variable type in data declaration.U can find that in bold below....

Data: itab like i_t_var_range,

mvar(2) type N,

yvar(4) type N,

<b>first_dat type D,</b>

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.

Message was edited by:

Venkat Ambati

Former Member
0 Kudos

thank you very much vankat, my problem is solved.

assigned u full marks.

regards,

suyash

Answers (0)