Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

sort descending for MARD

Hello Everyone,

i am stuck , i have to print the storage location where the stock is maximum .

My select program prints the storage location where the stock appears first .

Please help.

for example :

material :-xyz

plant :abc

storage location:- 0,0,3,7,0,4,8

What i want is to print storage location where the stock is 8 but it is printing the storage location where the stock is 3.

Any suggestions , I have to use in a smartform

BR

Sumit

Former Member
Former Member replied

Hello

Try this snippet:

data: imard like mard occurs 0 with header line.
select * from mard into table imard
                   where matnr = viqmel-matnr
                   and werks = viqmel-werk.
sort imard by labst descending.
read table imard index 1.
if sy-subrc = 0.
  write: 'Maximum stock at', imard-lgort.
endif.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question