Skip to Content
0
Former Member
Jan 20, 2012 at 01:47 PM

Calculate the projected value of a field for the future date?

38 Views

Hi all,

I am using some code to calculate the hra of the employee for a particular month on the basis of a record maintained for that month in the payroll cluster (pc_payresult).

Now if suppose for a particular month in the future, that dates would not be there in this cluster, i want the projected hra based on the last record in the payroll cluster.

This would be applicable only for the future dates.

Like suppose I am calculating hra for April (2011) to March(2012). So for the months jan, feb and march, I want the hra value to be the calculated value of hra for the month of december(2011).

For this I have implemented the following code:-

loop at lt_tds_1 into ls_tds_1.

LOOP AT it_rgdir INTO wa_itrgdir WHERE fpbeg GE beg_d_curr AND fpend LE end_d_curr.

LOOP AT lt_tds_581 INTO ls_tds_581 WHERE pernr = ls_tds_1-pernr

AND begda LE wa_itrgdir-fpend AND endda GE wa_itrgdir-fpbeg.

lv_metro = ls_tds_581-metro.

CASE ls_tds_581-elgwt.

WHEN '1030'.

lv_rent_paid = ls_tds_581-rtamt.

ENDCASE.

IF lv_metro EQ '1'.

lv_40_50_per = ( 50 * lv_basic ) / 100.

ELSE.

lv_40_50_per = ( 40 * lv_basic ) / 100.

ENDIF.

lv_10_per_excess = lv_rent_paid - ( ( 10 * lv_basic ) / 100 ).

IF lv_hra < lv_40_50_per.

IF lv_hra < lv_10_per_excess.

lv_minimum_hra = lv_hra.

ELSE.

lv_minimum_hra = lv_10_per_excess.

ENDIF.

ELSE.

IF lv_40_50_per < lv_10_per_excess.

lv_minimum_hra = lv_40_50_per.

ELSE.

lv_minimum_hra = lv_10_per_excess.

ENDIF.

ENDIF.

ENDLOOP.

ls_tds-bet02 = ls_tds-bet02 + lv_minimum_hra.

ENDLOOP.

endloop.

The internal table it_rgdir is having all records from the payroll cluster for a particular employee. Now It_rgdir is not having the records for 01.01.2012 to 31.12.2012 till 01.03.2012 to 31.03.2012.

So for these 3 future months, I would need the calculated hra for the last month (dec 2011).

Any ideas, what code shall I use, I thought a lot, but still could not find out how shall I code it out.

Any help would be highly appreciated???

Regards

Tarun