Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

code

Former Member
0 Likes
564

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
542

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

4 REPLIES 4
Read only

Former Member
0 Likes
543

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

Read only

0 Likes
542

Hi All,

Thanks

Read only

Former Member
0 Likes
542

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

Read only

naimesh_patel
Active Contributor
0 Likes
542

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