Hi all,
i have written a report in which i have to show some data based on some criteria. I have to show many fields in output, and some of them are based on logic, consider the situation
Doc. No. Entry Date Quantity Km index Avg. Text
20002 01.04.2014 14.880 2130 (2270-2130/14.880) = 9.40
20002 05.04.2014 12.560 2270 (2410-2270/ 12.560) = 11.14
20002 10.04.2014 15.800 2410 (2550-2410/15.880 ) = 8.81
20002 15.04.2014 13.560 2550 No Higher KM index Still Running
i am printing these values based on ducument no, that means in a specified time interval say if someone wants to see the avg. between 01.04.2014 to
20.04.2014, then the result should be shown as shown in above .
Now , what i have done is i have calculated the higher and lower km index, but i am not getting how could i calculate the values shown above.
I have written my code as
For calculating min. and max. values , i have written these code
LOOP AT it_final INTO wa_tmp.
if sy-tabix = 1 .
wa_max = wa_tmp.
wa_min = wa_tmp.
else.
* minimum
if wa_tmp-zuonr < wa_min-zuonr .
wa_min-zuonr = wa_tmp-zuonr .
endif.
if wa_tmp-wrbtr < wa_min-wrbtr .
wa_min-wrbtr = wa_tmp-wrbtr .
endif.
* repeat above IF.ENDIF for each col
* Maximum
if wa_tmp-zuonr > wa_max-zuonr .
wa_max-zuonr = wa_tmp-zuonr .
endif.
if wa_tmp-wrbtr > wa_max-wrbtr .
wa_max-wrbtr = wa_tmp-wrbtr .
endif.
if wa_tmp-mng1 > wa_max-mng1 .
wa_max-mng1 = wa_tmp-mng1 .
endif.
endif.
ENDLOOP.
But i am not getting, how can i get my output as shown above. Attached is the code written for my report.
Please tell me , what should be the logic behind this case.