2009 Feb 28 8:16 PM
Hi Guys,
I have a 1st Internal Table with all shipments details.
I have 2nd internal table shipments details along with pallets details.
My 2nd Internal table looks like below.
PN TKNUM
1 1144
2 1144 and many more than this
3 1145
4 1145
I need to calculate that TKNUM 1144 has total 2 PN's and TKNUM 1145 has total 2 PN's
Thanks,
Prasad.
2009 Mar 01 2:35 AM
HI,
Check this Code..
SORT itab by TKNUM.
LOOP AT itab.
COUNT = COUNT + 1.
AT END OF TKNUM.
" Move total PN count to another internal table
ITAB2-PN = COUNT.
ITAB2-TKNUM = ITAB1-TKNUM.
APPEND ITAB2.
CLEAR COUNT.
ENDAT.
ENDLOOP.
HI,
Check this Code..
SORT itab by TKNUM.
LOOP AT itab.
COUNT = COUNT + 1.
AT END OF TKNUM.
" Move total PN count to another internal table
ITAB2-PN = COUNT.
ITAB2-TKNUM = ITAB1-TKNUM.
APPEND ITAB2.
CLEAR COUNT.
ENDAT.
ENDLOOP.
2009 Feb 28 9:11 PM
see the help on at statement....
loop at itab into wa_itab.
at new tknum / at last tknum....etc...
count.....and move...
enddat.
2009 Feb 28 9:17 PM
Hi Jay,
Thanks for your reply.
Can you give me any example.
Thanks,
Prasad.
2009 Feb 28 9:20 PM
>[Click Here|https://forums.sdn.sap.com/search.jspa?q=at%20endat&dateRange=last90days&searchID=22926323&rankBy=10001&start=0]<
alternative:
loop at itab into wa_itab.
itab1[] = itab[].
delete itab1 where tknum NE wa_itab-tknum.
describe table itab1 lines lv_lines.
write: 'No. of records:', wa_itab-tknum , lv_lines.
endloop.
2009 Mar 01 2:35 AM
HI,
Check this Code..
SORT itab by TKNUM.
LOOP AT itab.
COUNT = COUNT + 1.
AT END OF TKNUM.
" Move total PN count to another internal table
ITAB2-PN = COUNT.
ITAB2-TKNUM = ITAB1-TKNUM.
APPEND ITAB2.
CLEAR COUNT.
ENDAT.
ENDLOOP.
2009 Mar 01 8:31 AM
Hi Avinash,
Its not working.
Let me give my internal table details once again.
PN TKNUM
8 |0000001144
8 |0000001144
8 |0000001144
8 |0000001144
7 |0000001144
7 |0000001144
7 |0000001144
7 |0000001144
I need to get count as 2 for TKNUM .
Plz can you let me know.
Thanks,
Prasad.
2009 Mar 01 8:47 AM
Hello,
You can do this way.
Loop at 2nd internal table.
At new TKNUM.
if flag is initial. " at 1st loop also AT new control break event occurs.
" 1st loop pass count should not be displayed
write:/ count, tknum.
endif.
flag = 'X'.
endat.
count = count + 1.
endllop.
Regards,
Sameer
2009 Mar 01 10:08 AM
2009 Mar 01 10:08 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |