In SAP the following request works well, but has result I obtain #5000000 lines for 3000 materials (MATNR):
SELECT k~bldat a~matnr k~bldat e~maktx a~mtart a~brgew
a~ntgew a~gewei a~volum a~laeda mseg~bwart k~budat
INTO CORRESPONDING FIELDS OF TABLE itab
FROM mseg
INNER JOIN makt AS e ON e~matnr = mseg~matnr
INNER JOIN mara AS a ON a~matnr = mseg~matnr
INNER JOIN mkpf AS k ON k~mblnr = mseg~mblnr
WHERE a~mtart in ('ZRSV','ZVTP').
But If I just want the last movement/Date for each of my MATNR, the following request return this error: Wrong table name or table alias name table alias name "(SELECT MAX( T".
SELECT k~bldat a~matnr k~bldat e~maktx a~mtart a~brgew
a~ntgew a~gewei a~volum a~laeda mseg~bwart k~budat
INTO CORRESPONDING FIELDS OF TABLE itab
FROM mseg
INNER JOIN makt AS e ON e~matnr = mseg~matnr
INNER JOIN mara AS a ON a~matnr = mseg~matnr
INNER JOIN mkpf AS k ON k~mblnr = mseg~mblnr
WHERE a~mtart in ('ZRSV','ZVTP')
AND k~bldat = (SELECT MAX( t~bldat ) FROM mkpf AS t
WHERE t~mblnr = mesg~mblnr).
Any idea of the syntax problem? Thanks in advance.