Application Development 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: 

About material sort programn

Former Member
0 Kudos

Hello Experts,

i want material sort logic in follwing code by materail description in that also i want to sort those materail which having same material description so if i give perticular number range from that number range i want to sort only one materail which having exact same discription other same discription should not sorted through that report, i got one yesterday which is given as follows so what changes i need to do in following code reward for useful answer send me solution on following mail id

mail id "talele.rahul@gmail.com"

and the code i am using is as follows:

report z_test.

tables: makt.

select-options: s_matnr for makt-matnr.

data: t_makt type table of makt with header line.

start-of-selection.

select * into table t_makt

from makt

where matnr in s_matnr

and spras eq sy-langu.

sort t_makt by MAKTG.

loop at t_makt.

write: / t_makt-matnr,

t_makt-maktx.

endloop.

thanx in advance

Rahul Talele

1 REPLY 1

Former Member
0 Kudos

Hi.

I hope I got you right. You want to select materials by a number range,

but then from all resulting materials you want to use only one entry for each description.

So if the result would be like 1234 hummer, 2345 hummer, 6789 hammer you would like to get a resulting table with only 1234 hummer, 6789 hammer.

Then try to add the code in bold.

select * into table t_makt
from makt
where matnr in s_matnr
and spras eq sy-langu.

sort t_makt by MAKTG.
  • This command leaves only one entry of each material description

<b>delete adjacent duplicates from t_makt comparing maktx.</b>

loop at t_makt.
write: / t_makt-matnr,
t_makt-maktx.
endloop.

Regards,

Timo