‎2007 Nov 21 2:33 PM
Hi Experts,
I have data in an internal table itab as follows.
So here i have to count number of deliveries selected.here only 2 (0080000022 and 0080000024)
but if you use describe table itab lines lin it will give 4. but i want 2.Programatically
how can we do this? with out using delete duplicate option.because no duplicates are there comparing all fields.
Delivery KuNNR
0080000022|2000171676|20000119 | |000010|000000000000600000|XX01 |
0080000023|2000171676|20000119 | |000010|000000000000600000|XX01 |
0080000024|2000171674|20000119 | |000010|000000000000600000|XX01 |
0080000024|2000171674|20000119 | |000020|000000000000600001|XX01 |
Regards
Ravi.
‎2007 Nov 21 2:36 PM
Hi Ravi,
This will do
Loop at itab.
on change of kunnr.
cnt = cnt + 1.
endon.
Endloop.
write cnt. " CNT will have the no.of deliveries.Reward if this helps,
Satish
‎2007 Nov 21 2:36 PM
Hi Ravi,
This will do
Loop at itab.
on change of kunnr.
cnt = cnt + 1.
endon.
Endloop.
write cnt. " CNT will have the no.of deliveries.Reward if this helps,
Satish
‎2007 Nov 21 4:30 PM
‎2007 Nov 21 2:36 PM
Hi,
DATA : counter type i.
SORT itab BY kunnr.
LOOP AT itab.
ON CHANGE OF itab-kunnr.
ADD 1 to COUNTER.
ENDON.
-----
---
ENDLOOP.
write :/ counter
‎2007 Nov 21 2:38 PM
Try like this:
DATA: BEGIN OF IT_DEL OCCURS 0,
DELIVERY TYPE VBELN,
END OF IT_dEL.
LOOP AT IT_DATA.
IT_DEL-DELIVERY = IT_DATA-DELIVERY.
COLLECT IT_DEL.
CLEAR IT_DEL.
ENDLOOP.
describe table it_del line sy-index.
write: 'No of delivery', sy-index.
IT_DEL will have all your unique deliveries.
In given example:
0080000022
0080000023
0080000024.Regards,
Naimesh Patel