on 2024 May 30 9:26 AM
Hi,
I have an Excel formula that I want to convert to an SQL formula so I can use it in a query.
The Excel formula is:
=D2*CEILING((B2-C2)/D2;1)
I thought I could use RoundUp, but that funcation is not available in SAP.
The formula in SAP looks like this:
t0.purpackun*RoundUp((T1.[Maxstock]-((t1.onhand-t1.iscommited)+ t1.onorder))/t0.purpackun,1) as 'Order quantity',
Request clarification before answering.
If you are looking for a basic SQL query to translate, try this :
Select D * CEILING((B - C) / D ) AS result FROM your_table;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Doesn't (recent versions of) Abap SQL handle a CEIL( sql_exp ) function?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
you can try this
SELECT
[OITM].[PurPackUn]
,[OITW].[Maxstock]
,[OITW].[OnHand]
,[OITW].[IsCommited]
,[OITW].[OnOrder]
,[OITM].[PurPackUn]*CEILING(([OITW].[Maxstock]-[OITW].[OnHand]-[OITW].[IsCommited]+[OITW].[OnOrder])/[OITM].[PurPackUn]) AS [OrderQty]
FROM
OITM
INNER JOIN OITW ON OITW.ItemCode= OITM.ItemCode AND OITW.WhsCode = 'xx'
WHERE
OITM.ItemCode = 'xx'regards Lothar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
As it turns out, MS SQL has a function called CEILING.
SELECT CEILING(1.4/0.6)
/* result: 3 */Regards,
Johan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.