Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Multiple statements in an IF THEN

Hi,

I have a report where, very occasionally, I might have multiple values in a collapsed line (@ two group levels actually, Pos, and Bez)

If I encounter this, I need to set a hi value and a lo value for each (displayed @ PosFooterA and B, and BezFooterA and B).

If I don't, I need the lo value to remain at 0, so I can check it, and collapse PozFooterB and BezFooterB.

As I recall, I've always been able to avoid multiple statements within an IF THEN, but here I am...

The error I'm getting is that the PolishPricePosHi just before the "and" needs to be a Boolean.

What is the syntax I need for this?

WhilePrintingRecords;

Global NumberVar PolishPricePosHi;

Global NumberVar PolishPricePosLo;

Global NumberVar PolishPriceBezHi;

Global NumberVar PolishPriceBezLo;

if {BW_ANGEB_STKL.BOM_PRODUKT} in [9101]

then

if PolishPricePosHi = 0

then PolishPricePosHi := {BW_ANGEB_STKL.PR_PREIS_ME}

else

if {BW_ANGEB_STKL.PR_PREIS_ME} > PolishPricePosHi

then PolishPricePosLo := PolishPricePosHi

and PolishPricePosHi := {BW_ANGEB_STKL.PR_PREIS_ME};

Former Member
replied

HI Matt,

Try:

WhilePrintingRecords;

Global NumberVar PolishPricePosHi;

Global NumberVar PolishPricePosLo;

Global NumberVar PolishPriceBezHi;

Global NumberVar PolishPriceBezLo;

if {BW_ANGEB_STKL.BOM_PRODUKT} in [9101]

then

(

  if PolishPricePosHi = 0 then

  PolishPricePosHi := {BW_ANGEB_STKL.PR_PREIS_ME}

  else if {BW_ANGEB_STKL.PR_PREIS_ME} > PolishPricePosHi then

  (

  PolishPricePosLo := PolishPricePosHi;

  PolishPricePosHi := {BW_ANGEB_STKL.PR_PREIS_ME};

  )

)

-Abhilash

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question