Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

abap display

Former Member
0 Kudos

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.....

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos

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

5 REPLIES 5

naimesh_patel
Active Contributor
0 Kudos

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

0 Kudos

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......

0 Kudos

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

0 Kudos

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.

0 Kudos

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.