07-14-2008 10:28 AM
i have the following internal table
delivery no Line item etc.........
65213 10
65214 10
65214 20
65215 10
65216 10
65216 20
i want to count the number of documents.it should be 4
(Ps:not the number of records, number of delivery numbers)
How to do this?
07-14-2008 10:31 AM
Try this.
Loop at itab.
At New DelNum.
Count = Count + 1.
EndAt.
endloop.
(Or)
Collect DeliveryNum to New_itab.
find total records in this new_itab.
rwrd points if helpful
Bhupal
07-14-2008 10:31 AM
Try this.
Loop at itab.
At New DelNum.
Count = Count + 1.
EndAt.
endloop.
(Or)
Collect DeliveryNum to New_itab.
find total records in this new_itab.
rwrd points if helpful
Bhupal
07-14-2008 10:32 AM
use control events....AT NEW VBELN.....
LOOP AT IT_FINAL INTO WA_FINAL.
WA_FINAL1 = Wa_FINAL.
AT NEW VBELN.
WRITE : / WA_FINAL1-VBELN.
20 WA_FINAL1-POSNR.
ENDAT.
CLEAR : Wa_FINAL,WA_FINAL1.
ENDLOOP.
07-14-2008 10:33 AM
LOOP AT IT_FINAL INTO WA_FINAL.
WA_FINAL1 = Wa_FINAL.
AT NEW VBELN.
COUNT = COUNT + 1.
ENDAT.
ENDLOOP.
07-14-2008 10:33 AM
hiii
you can use it like below...
data:
counter type i.
loop at itab.
at new doc_no.
counter = counter + 1.
endat.
endloop.
here counter will give you total number of document in internal table.
regards
twinkal.
07-14-2008 10:36 AM
hi Kumar,
you can do something like:
IF num <> del_num.
count = count + 1.
num = del_num.
ELSE.
num = del_num.
ENDIF.
* or u can use AT NEW
AT NEW del_num.
count = count + 1.
ENDAT.
With luck,
Pritam.
07-14-2008 10:36 AM
hiii
there is one another way too..take one more internal table of same type and use following code
DELETE ADJACENT DUPLICATES FROM i_output COMPARING matnr.
DESCRIBE TABLE i_output LINES w_line.
WRITE:
/ 'Number Of Unique document Extracted :'(011), w_line.
regards
twinkal