Hi Experts,
I have Plant, Material, Movement type and Date.
My requirement is I want the MAX date in Material and Plant combination, with Movement type condition
First I need MAX date in Material and Plant combination, where Movement type is 602 , if 602 is null then 601, if 601 is null then 102, if 102 is null then 101 if 101 also is null then other Movement types.
For this I used below code in derived table in IDT but I am not able to get the correct results:
SELECT
DISTINCT
Table__1."0PLANT",
Table__1."0MATERIAL",
Max(Table__1."0PSTNG_DATE") as Last_Sales_Date
FROM
"NM1"."PUBLIC"."IZDSO_DMR" Table__1
Where
CASE
WHEN (Table__1."0MOVETYPE"=602) THEN (Table__1."0MOVETYPE"=602)
WHEN (Table__1."0MOVETYPE"=602) IS NULL THEN (Table__1."0MOVETYPE"=601)
ELSE
(Table__1."0MOVETYPE"=601) END
Group By
Table__1."0MATERIAL",
Table__1."0PLANT"
I tried only for 602, 601 Movement types only
Please help me to get the correct result
Thanks,
G Sampath Kumar