‎2008 Dec 17 5:52 AM
I want to get material last good issue record from MSEG,How to write the code
Select * from MSEG
Where MSEG~BUDAT = MAX ?
‎2008 Dec 17 5:55 AM
hi,
Try this code
SELECT * FROM MSEG INTO G_MSEG
UP TO 1 ROWS ORDER BY BUDAT DESCENDING .
ENDSELECT.
‎2008 Dec 17 5:56 AM
Hello Bean,
MSEG is a huge table which stores data for all the Material Mvmts taking place in the syst. Your qeury will take lot of time to process.
You need to restrict your scope of selection. Can you plz tell what are the user inputs i.e., selection-screen params?
BR,
Suhas
‎2008 Dec 17 5:56 AM
Hi,
try like this...
select * from mkpf into table it_mkpf.
select * from mseg
into table it_mseg
for all entries in it_mkpf
where mblnr eq it_mkpf-mblnr.
sort it_mseg by budat descending.
read table it_mseg index 1.
Now the first row will contain the latest figure..
Arunima
Edited by: Arunima Rudra on Dec 17, 2008 11:30 AM
‎2008 Dec 17 5:58 AM
Hi Bean,
Can you please be bit clear that what do you mean by "material last good issue record ".
And MSEG does not have the field name BUDAT.
Regards
Akshay
‎2008 Dec 17 6:03 AM
Hi,
I want to get the some material last goods entry to some storage location
BUDAT is a field that is the material doc.'s post date
.
‎2008 Dec 17 6:01 AM
This is the logic to calculate the last PO for a particular material .
You can interprate with your condition depending on the movement type and the number range assigned to the material document number .
SELECT * UP TO 1 ROWS
FROM ekpo
INTO wa_ekpo
WHERE ebeln LIKE '45%'
AND matnr = wa_outtab-matnr
ORDER BY ebeln DESCENDING .
ENDSELECT .
If any further issue pls revert back .
Regards
Jamal