on 03-12-2024 8:31 AM
Dear Community, I am trying to find out delivery date for each Frame Agreements (Sale Blanket Agreement). Following is the sql query that I created but it does not give correct results. Please help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Johan, If you see the query posted, the Delivery Date is calculated. Please find the attached screenshot. I wish to get correct Delivery dates based the Frequency - Monthly, Annual, Once, Weekly etc. In SAP, except Frquency "Occuring Once", for other like Monthly, Annual, the dates are not specified, Hence I need to get all delivery dates for specified frequencies for Frame Agreements.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
01 DATEADD(MONTH
02 , 1 / DATEDIFF(DAY, OOAT."StartDate", OOAT."EndDate")
03 , OAT2."FromDate")
On the second line you are dividing 1 by the number of days between the start and end days. That means that a fraction of a month will be added to OAT2."FromDate". Is this correct?
Regards,
Johan
Yes that is correct but I don't know if the logic is correct. I tried another version of the query
CASE WHEN OAT2."DatePeriod" = 'M' THEN COALESCE(OAT2."FromDate", OOAT."StartDate")
WHEN OAT2."DatePeriod" = 'A' THEN COALESCE(OAT2."FromDate", OOAT."StartDate")
WHEN OAT2."DatePeriod" = 'O' THEN COALESCE(OAT2."FromDate", OOAT."StartDate")
WHEN OAT2."DatePeriod" = 'W' THEN COALESCE(OAT2."FromDate", OOAT."StartDate")
WHEN OAT2."DatePeriod" = 'Q' THEN COALESCE(OAT2."FromDate", OOAT."StartDate")
WHEN OAT2."DatePeriod" = 'S' THEN COALESCE(OAT2."FromDate", OOAT."StartDate")
END AS "DeliveryDate"
User | Count |
---|---|
104 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.