04-22-2009 7:46 AM
Hi
i have a itab which have matnr , plant and many fields
i m using
AT END OF MATNR.
.............
ENDAT.
here condition on only MATNR
i want condition on PLANT also
so how i read this itab using MATNR and PLANT using AT END OF
thanks
04-22-2009 8:02 AM
Hi Prashant,
use the below logic for your requriement. control break statements work with one key fields.
for multiple key fields you have to use another logic.
use the below logic for your requirement
data : lv_matnr like mara-matnr,
lv_werks like marc-werks.
clear : lv_matnr , lv_werks.
loop at itab.
at first.
lv_matnr = itab-matnr.
lv_werks = itab-werks.
endat.
if lv_matnr ne itab-matnr and lv_werks ne itab-werks.
<write logic for your process>.
lv_matnr = itab-matnr.
lv_werks = itab-werks.
else.
<write logic for your process>.
endif.
endloop.
hope it shall be useful.
Regards
Santosh.
Edited by: Santosh Kumar on Apr 22, 2009 9:03 AM
04-22-2009 8:01 AM
Hi
First field of internal table should be MATNR and second field is PLANT then
use like this
At END oF PLANT
-
endat
Kiran
04-22-2009 8:02 AM
Hi Prashant,
use the below logic for your requriement. control break statements work with one key fields.
for multiple key fields you have to use another logic.
use the below logic for your requirement
data : lv_matnr like mara-matnr,
lv_werks like marc-werks.
clear : lv_matnr , lv_werks.
loop at itab.
at first.
lv_matnr = itab-matnr.
lv_werks = itab-werks.
endat.
if lv_matnr ne itab-matnr and lv_werks ne itab-werks.
<write logic for your process>.
lv_matnr = itab-matnr.
lv_werks = itab-werks.
else.
<write logic for your process>.
endif.
endloop.
hope it shall be useful.
Regards
Santosh.
Edited by: Santosh Kumar on Apr 22, 2009 9:03 AM
04-22-2009 8:08 AM
if u want to use
AT END OF MATNR
then in ur table itab WERKS should come before MATNR.
SORT ITAB BY WERKS MATNR.
now u can use
AT END OF MATNR.
By this it will automatically take into consideration plant as well. In fact whatever fields are there before material no. in ur table structure the end of will be trigerred on those as well. So if u want only plant and matnr, then keep werks as 1st field and matnr as 2nd field.
04-22-2009 8:09 AM
hi
at end of matnr
at end of plant.
endat.
endat .
hope it will work.
04-22-2009 9:07 AM
AT END OF MATNR.
Write your code.
AT END OF PLANT.
Write your code.
ENDAT.
ENDAT.
Regards,
Joan
04-22-2009 9:10 AM
Hi,
You can write it as :
AT END OF MATNR.
Write your code.
ENDAT.
AT END OF PLANT.
Write your code.
ENDAT.
If value of PLANT MATNR changes the part will be executed.
Hope it helps.
Regards,
Komal