Skip to Content
Jun 16, 2022 at 11:10 PM

Data Action with conditional IF not funtion


Hello SAP Community,

I am creating a data action that has the following logic where I am calculating fields based on various conditions,

Everything works fine until I get to the PurchasesProduction calculation.

which has the following formula

DATA([d/CONCEPTO_INV] = "ComprasProduccion") = RESULTLOOKUP([d/CONCEPTO_INV] = "StockSeguridad", [d/Version] = %OriVersion%, [d/Date] = "202205") + RESULTLOOKUP([d/CONCEPTO_INV] = "PptoVentas") - RESULTLOOKUP([d/CONCEPTO_INV] = "StockInicial")

When I execute the data action in the history it shows me the result well



ComprasProduccion = StockSeguridad = 200 + PptoVentas = 165 - StockInicial 415 = -50

Now I must add a logic to tell it that everything that is less than < 0 then 0 if not PurchasesProduction and for this add the following condition in the data action:

IF RESULTLOOKUP([d/CONCEPTO_INV] = "ComprasProduccion")<0 THEN

DATA([d/CONCEPTO_INV] = "ComprasProduccion")=0

ELSE DATA([d/CONCEPTO_INV] = "ComprasProduccion")=RESULTLOOKUP([d/CONCEPTO_INV] = "ComprasProduccion")


But the final result when executing the data action is a different result than expected:


As shown, it shows 165 when according to the conditional it should show 0 since -50 is less than 0.

Can someone tell me the procedure that I must correct to correct and that it works correctly?


image.png (37.5 kB)
image.png (24.5 kB)