cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to write Multiple IF Conditions in Transformation File

Former Member
0 Kudos
2,610

Dear Experts,

I have a typical requirement as follows -

For one of the Dimension, I need to map based on the following Criteria -

IF PMAG = "" AND PGMRU = "" THEN PMRU

IF PMAG = "" AND PGMRU <> "" THEN PGMRU

IF PMAG <> "" THEN PMAG

In Mapping section of Transformation File i wrote the code as follows -

Method 1 - If Condition within IF

PRODUCT = *IF(PMAG=*STR() THEN (IF PGMRU=*STR() THEN PMRU; PGMRU); PMAG)

When I did a Validate & Transform TF without selecting any BW Cube, it saved without any errors.  But when I try to by selecting the proper cube, given me an error COL(

Method 2- By Giving * in STR

PRODUCT = *IF(PMAG=*STR(*) THEN PMAG; PGMRU=*STR() THEN PMRU; PGMRU)

It didn't throw any error during V & P, but when I try to execute the package then it threw error STR(*

Method 3- By entering <> or !=

PRODUCT = *IF(PMAG =!*STR() THEN PMAG; PGMRU=*STR() THEN PMRU; PGMRU) - Thrown Syntax Error

PRODUCT = *IF(PMAG NOT=*STR() THEN PMAG; PGMRU=*STR() THEN PMRU; PGMRU) - Thrown Syntax Error

Any suggestion...

Thanks in advance.

Sreeni.

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

Just read help: Data Transformation Maintenance - SAP BusinessObjects Planning and Consolidation - SAP Library

PRODUCT = *IF(PMAG+PGMRU=*STR() THEN PMRU; PMAG=*STR() THEN PGMRU; PMAG)

Former Member
0 Kudos

Hi Vadim,

Thanks for the response... but there is something missing in the statement -

In your statement -

PMAG+PGMRU = *STR() = PMRU - Fulfilled 1st Condition

PMAG = *STR() = PGMRU - Seems this is wrong as it is not looking at PGMRU.. My Requirement is PMAG= "" & PGMRU <> "" then PGMRU...


I'm not sure whether I understood something differently in your 2nd statement.  Could you please reconfirm.


Regards,

Sreeni.

former_member186338
Active Contributor
0 Kudos

First condition is both empty: if true then PMRU

If it's not true then at least one not empty

And we check second condition - if PMAG is empty (and in this case PGMRU can't be empty!!!) then PGMRU, else (PMAG is not empty!) - PMAG

Hope everything is clear!

Former Member
0 Kudos

TQ for the clarification..

former_member186338
Active Contributor
0 Kudos

Then it's a good idea to close the discussion!

Former Member
0 Kudos

Hi Vadim,

Thanks once again for all your timely help.

Regards,

Sreeni.

Answers (0)