‎2006 Jun 22 2:53 AM
Hi friends,
I have an internal table with the following fields:
salesordernumber itemnumber etcetc
I want the output as below:
salesordernumber itemnumber1
itemnumber2
(if the salesordernumber has multiple items, the itemnumber2 should come exactly below itemnumber1)
or just
salesordernumber itemnumber (and go for the next sales order if it has single item)
Please suggest a code.
Thanks.
‎2006 Jun 22 3:02 AM
Hi Nuren,
May be you can do a
DESCRIBE TABLE itab line sy-tfill.
And then if the line items are greater than 1 then you can call different subroutines. Each displaying the layout as u want.
Cheers
VJ
‎2006 Jun 22 3:00 AM
WRITE : / 'Sales order', 50 'Item Number'.
sort <table> by vbeln posnr.
Loop at <table>.
at new vbeln.
write: <table>-VBELN, 50 <table>-POSNR.
endat.
write: 50 <table>-POSNR.
endloop.
‎2006 Jun 22 3:02 AM
Hi Nuren,
May be you can do a
DESCRIBE TABLE itab line sy-tfill.
And then if the line items are greater than 1 then you can call different subroutines. Each displaying the layout as u want.
Cheers
VJ
‎2006 Jun 22 3:04 AM
I am assuming that this is a simple list you are working with.
Here is the rough code I can think of.
loop at itab.
at new vbeln.
write: /5 itab-vbeln, 10 itab-posnr.
endat.
write: /10 itab-posnr.
endloop.Hope this helps.
Thanks,
‎2006 Jun 22 5:31 AM
Hi Nuren,
Please check this piece of code.
TYPES : BEGIN OF ty_itab,
f1,
f2(10),
END OF ty_itab.
DATA : itab TYPE TABLE OF ty_itab WITH HEADER LINE.
itab-f1 = 'A'.
itab-f2 = 'GANGA'.
APPEND itab.
itab-f1 = 'A'.
itab-f2 = 'GANGA'.
APPEND itab.
itab-f1 = 'B'.
itab-f2 = 'GANGA'.
APPEND itab.
itab-f1 = 'B'.
itab-f2 = 'GANGA'.
APPEND itab.
itab-f1 = 'C'.
itab-f2 = 'GANGA'.
APPEND itab.
LOOP AT itab.
AT NEW f1.
WRITE: /5 itab-f1, 10 itab-f2.
ENDAT.
WRITE: /10 itab-f2.
ENDLOOP.
Output will be :
A *************
GANGA
GANGA
B *************
GANGA
GANGA
C *************
GANGA
Hope this what u require. If found helpful, please do reward.