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

Sort

kiran_k8
Active Contributor
0 Likes
656

Hi,

-


Material

Posting Date

Vendor

Mat.Doc.No

Bal.Qty

-


ID0169164

07.08.2004

IC-KIT

412783

4.000

ID0169164

07.08.2004

IC-KIT

412784

8.000

ID0169164

16.08.2004

IC-KIT

413064

14.000

ID0169164

16.08.2004

IC-KIT

413065

34.000

ID0169164

19.08.2004

IC-KIT

413162

14.000

ID0169164

20.08.2004

IC-KIT

413171

24.000

ID0169164

20.08.2004

IC-KIT

413172

34.000

ID0169164

08.11.2004

IC-KIT

413761

80.000

ID0169167

16.08.2004

IC-KIT

413064

20.000

ID0169167

16.08.2004

IC-KIT

413065

60.000

ID0169167

19.08.2004

IC-KIT

413162

20.000

ID0169167

20.08.2004

IC-KIT

413171

40.000

ID0169167

20.08.2004

IC-KIT

413172

60.000

I want to sort the above one in such a way that when I delete the adjacent duplicates after sorting the internal table should contain only

ID0169164

08.11.2004

IC-KIT

413761

80.000

ID0169167

20.08.2004

IC-KIT

413172

60.000

ie.Material with the latest budat and mblnr and its corresponing bal quantity.

sort itab by matnr budat ascending.

delete adjacent duplicates from itab comparing lifnr matnr.

is not giving me the result.Can anyone here please let me where I am going wrong.

Thanks,

K.Kiran.

Edited by: Kiran K on Jan 21, 2008 5:39 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
544

Hi kiran,

first sort the internal table as per

sort itab by matnr ascending budat descending.

then u delete the records as .

delete adjacent duplicates from itab comparing matnr.

regards,

Santosh thorat

4 REPLIES 4
Read only

Former Member
0 Likes
545

Hi kiran,

first sort the internal table as per

sort itab by matnr ascending budat descending.

then u delete the records as .

delete adjacent duplicates from itab comparing matnr.

regards,

Santosh thorat

Read only

0 Likes
544

Santhosh,

Thanks,but it won't give me the latest balance quantity if there are two mblnrs on the same posting date.

As per yours it will result in this.

ID0169164

08.11.2004

IC-KIT

413761

80.000

ID0169167

20.08.2004

IC-KIT

413171

40.000

but what needed is this.

ID0169164

08.11.2004

IC-KIT

413761

80.000

ID0169167

20.08.2004

IC-KIT

413172

60.000

When there are two MBLNRS on the latest posting date then I should consider the latest MBLNR and its balance quantity.

Thanks,

K.Kiran.

Read only

0 Likes
544

Hi,

sort itab by matnr ascending budat descending XBLNR DESCENDING.

then u delete the records as .

delete adjacent duplicates from itab comparing matnr.

Regards,

Santosh Thorat

Read only

Former Member
0 Likes
544

Hi Kiran,

Check it.

SORT it_itab BY matnr.

DELETE ADJACENT DUPLICATES FROM it_itab COMPARING matnr