12-03-2007 4:16 PM
Hi experts,
I have a situation like this:
I need to display an internal table through abap display as follows:
Order No:----
Item no:----
(If any under that order no.)
orderno.........
item no.....
likewise display..........
Any help?....
thanks in advance.....
12-03-2007 4:19 PM
You can do it like this:
LOOP AT ITAB.
WRITE: / 'Order No:', itab-order.
if not itab-item is initial.
WRITE: / 'Item No:', itab-item.
endif.
skip 1.
endloop.
Regards,
Naimesh Patel
12-03-2007 4:19 PM
You can do it like this:
LOOP AT ITAB.
WRITE: / 'Order No:', itab-order.
if not itab-item is initial.
WRITE: / 'Item No:', itab-item.
endif.
skip 1.
endloop.
Regards,
Naimesh Patel
12-03-2007 4:32 PM
how can we do this using at endat.....
this 2 fields are not the first 2 fields inmy table.....
can we sort them and use at endat logic......
12-03-2007 4:35 PM
Yes you can use the AT ENDAT on the LINE number but the probelm will be if the other field which are ahead of the ORDER and LINE will change your AT event will fire.
So, put your fields ORDER and LINE at the first two fields and try like this:
SORT ITAB BY ORDER LINE.
LOOP AT ITAB.
AT END OF LINE.
WRITE: / 'Order', ITAB-ORDER,
WRITE: / 'Item', ITAB-ITEM.
ENDAT.
ENDLOOP.
Regards,
Naimesh Patel
12-03-2007 4:40 PM
Hi Kartikey,
First You Sort your internal table upto Order no, Item no fields
Forexample:
Sort itab by field1
field2
-
Orderno
itemno.
LOOP AT ITAB.
at endat.
WRITE: / 'Order No:', itab-order.
WRITE: / 'Item No:', itab-item.
endat.
endloop.
12-03-2007 4:41 PM
Hi,
Try to use (Due to your sort fields are not as first fields in your internal table)
SORT ITAB BY ORDERNO.
LOOP AT ITAB.
ON CHANGE OF ITAB-ORDERNO.
WRITE: / 'Order No', ITAB-ORDERNO.
ENDON.
WRITE 😕 Item No:' , ITAB-ITEMNO.
ENDLOOP.
a®