2014 Jul 29 3:46 PM
hi experts,
i need help for buiding logic for counting row based on material number and plant and year.
matnr plant year count
00000000000001 1000 2014 2
00000000000001 1000 2014 2
00000000000001 1000 2013 1
00000000000002 1000 2014 1
counting of alv based on matnr plant and year.
i need the output like this and help for the same
thanks in advance,
vinod
2014 Jul 29 3:52 PM
While looping on your internal table, use AT END OF year.
LV_VAL will keep the number of counts of same MATNR, Plant and YEAR.
DATA: lv_val type i.
SORT: i_tab by MATNR PLANT YEAR.
LOOP AT i_tab into s_tab.
lv_val = lv_val + 1.
AT END OF year.
Clear: lv_val.
ENDAT.
ENDLOOP.
2014 Jul 29 3:52 PM
While looping on your internal table, use AT END OF year.
LV_VAL will keep the number of counts of same MATNR, Plant and YEAR.
DATA: lv_val type i.
SORT: i_tab by MATNR PLANT YEAR.
LOOP AT i_tab into s_tab.
lv_val = lv_val + 1.
AT END OF year.
Clear: lv_val.
ENDAT.
ENDLOOP.
2014 Jul 29 4:00 PM
hi lokesh,
thanks for ur response,this count is based on all three fields matnr,plant and year,
how to do tat.
2014 Jul 29 4:05 PM
As I explained in sample code, use at end of.
This is how you can achieve.
Search on "AT END OF" control level statement.
~Lokesh
2014 Jul 29 4:12 PM