‎2006 Nov 29 10:27 PM
Hi,
I have an internal table with the fields sales order and item number. I also want to add another field to this internal table which can show 'Serial No'.
For ex:
The present internal table:
Order Item
35 10
35 30
37 20
The requirement:
S.No Order Item
1 35 10
2 35 30
3 37 20
Can you tell me the best logic to get this extra field? Is there any standard SAP field that can calculate these serial numbers?
Thanks and best regards,
Krishen
‎2006 Nov 29 10:33 PM
Hi,
How are you populating the internal table..One by one or bulk..
DATA: BEGIN OF ITAB OCCURS 0,
<b> SERIAL TYPE SYTABIX,</b>
ORDER TYPE VBELN,
ITEM TYPE POSNR,
END OF ITAB.
<b>If one by one..</b>
DATA: V_TABIX TYPE SYTABIX.
LOOP AT ITAB_OLD.
V_TABIX = V_TABIX + 1.
ITAB-SERAIL = V_TABIX.
ITAB-VBELN = ..
APPEND ITAB.
ENDLOOP.
<b>If bulk insert..Then loop at the internal table and then add the serial number..</b>
LOOP AT ITAB.
ITAB-SERIAL = SY-TABIX.
MODIFY ITAB TRANSPORTING SERIAL.
ENDLOOP.
Thanks,
Naren
‎2006 Nov 29 10:33 PM
Hi,
How are you populating the internal table..One by one or bulk..
DATA: BEGIN OF ITAB OCCURS 0,
<b> SERIAL TYPE SYTABIX,</b>
ORDER TYPE VBELN,
ITEM TYPE POSNR,
END OF ITAB.
<b>If one by one..</b>
DATA: V_TABIX TYPE SYTABIX.
LOOP AT ITAB_OLD.
V_TABIX = V_TABIX + 1.
ITAB-SERAIL = V_TABIX.
ITAB-VBELN = ..
APPEND ITAB.
ENDLOOP.
<b>If bulk insert..Then loop at the internal table and then add the serial number..</b>
LOOP AT ITAB.
ITAB-SERIAL = SY-TABIX.
MODIFY ITAB TRANSPORTING SERIAL.
ENDLOOP.
Thanks,
Naren