Skip to Content
0
Oct 24, 2019 at 05:53 PM

If Then Else SAP B1 Query

257 Views Last edit Oct 24, 2019 at 05:53 PM 2 rev

Hello,

I have this query I already use daily:

SELECT T2.[WhsName], T0.[DocDate], T0.[DocEntry] AS 'Order Number', T0.[LineNum], T0.[ItemCode] AS 'Item Code', T0.[Dscription] AS 'Product Name', T0.[Quantity], T0.[LineTotal] AS 'Net Sale'

FROM INV1 T0 INNER JOIN OITM T1 ON T0.[ItemCode] = T1.[ItemCode] INNER JOIN OWHS T2 ON T0.[WhsCode] = T2.[WhsCode] INNER JOIN OINV T3 ON T0.[DocEntry] = T3.[DocEntry]

Trying to create another Column that would categorize document into either Delivery or Store Order. The Document should be considered a Delivery if the ItemCode 'Delivery' appears in the document lines. Is this possible to accomplish through an If Else statement in SAP B1? So far, I hvae tried Case Option, but have not had much luck either.

Also tried below, but did not seem to work either.

IF T0.[ItemCode] = 'Delivery', THEN T3.[DocEntry] = 'Delivery' ELSE 'Store'.