cancel
Showing results for 
Search instead for 
Did you mean: 

customerexit to compare the price with previos year 31st March

Former Member
0 Kudos
36

Material Price on 0calday priceas Qty Difference

31stMarch on

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 coumn which I have created for 31st March netprice (even though I don’t have the dat in my systeme for 31 March of previos year , it should show me blank).if I am not entering the value in the selection screen then it is showing me the same values which I have

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

Even when it show the data for qty also it should show me the data only of that month which the user enters but not the entire qty of all months

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 .

WHEN 'VAR_CMY'. -- customerexit variable

CLEAR:l_s_range,v_year,v_ysdate.

READ TABLE i_t_var_range INTO i_s_range

WITH KEY vnam = 'VAR_SCALMONTH'.----


Manual entry default 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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

Check this code,

WHEN ''VAR_CMY'.

IF i_step = 2. "after the popup

LOOP AT i_t_var_range INTO loc_var_range

WHERE vnam = 'VAR_SCALMONTH'.

v_year = loc_var_range-low+0(4).

v_year = v_year - 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.

EXIT.

ENDLOOP.

ENDIF.

ENDCASE.

hope it helps ,

assign points if helpful.

Former Member
0 Kudos

Thanks for ur reply

when i write the code provided by you and executing the query

giving me the error after entering the value in the variable VAR_SCALMONTH = 02.2007

value "200603'3" for user exit variable var_cmyis invalid

Diagnosis

The value for the variable VAR_CMY is determined in the user exit (RSR00001). In this case, the value 200603'3 was allowed. This value is not valid.

System Response

Procedure

Procedure for System Administration

Check the user exit for variable VAR_CMY. Make sure that variables for characteristic values are in internal format and are not compounded. This means, for example, that a date variable must have the value 20000914 and not the value 14.09.2000.

if i am not entering any value in the selection screen then it should show me in 31st march column with no data as there is no data of 31st March in my system, but its showing th values present in the netprice

Any other inputs pls

Former Member
0 Kudos

Hello ,

The code should work becos from your mail it shows the previous year value is correctly calculated as 2006 ,

CONCATENATE v_year '03' '31' INTO v_ysdate.

just tryto replace the same line once again, i guess it must work.

hope i guess this is what you required.

regards,

karthik

Former Member
0 Kudos

Where have you created the variable VAR_CMY.

It should be on the CALDAY or the date field on which you are restricting the data with.

And one more thing is you cannot hardcode the values just for the month of feb.2007.

Try to use Function Module in your code to get last day of the month

LAST_DAY_IN_PERIOD_GET.

Regards, Siva

Message was edited by:

Siva Bonam

Former Member
0 Kudos

Hello,

I dotn wont the last day of the month , I have specified clearly in my requirement,pls have a look at it

i have created variable manual entry/default value on 0calmonth/year as user is going to enter the month & year & not day

Former Member
0 Kudos

If the variable is on calmonth/year the use the below.

CONCATENATE v_year '03' INTO v_ysdate.

As the one you did is for the calday. where as the calmonth year length is 6 and for calday it is 8.