cancel
Showing results for 
Search instead for 
Did you mean: 

Transformations

Former Member
0 Kudos

Anyone know how to check for a NULL value and apply blanks

in a formula in a transformation using the IF statement

Accepted Solutions (0)

Answers (1)

Answers (1)

dennis_scoville4
Active Contributor
0 Kudos

Here's some sample code that you can add and modify to test:


CONSTANTS: c_null(10) TYPE c VALUE '',
           c_space(10) TYPE c VALUE SPACE.

IF l_value EQ c_null.
  l_vlaue = c_space.
ENDIF.

Former Member
0 Kudos

Can this be added to the formula or routine?

dennis_scoville4
Active Contributor
0 Kudos

This can be added to a routine, since a routine is basically a snippet of ABAP code that you're adding to the transformation.

Former Member
0 Kudos

OK..Thanks for your guidance. I was hoping that I didn't have to use a routine for the logic below.

/BIC/ZVXPRODH1 & IF( /BIC/ZVXPRODH2 = '', '', /BIC/ZVXPRODH2 )

But I have to b/c the spaces are not getting recognized in the formula.

Former Member
0 Kudos

Hi Ladygt

Statements such as the following do work in formulas.

IF( /BIC/ZFIELD = '', 'Y', 'N' )

What are you trying to achieve ?

Asif

Former Member
0 Kudos

I was able to add the statement below to a routine and works fine.

IF SOURCE_FIELDS-/BIC/ZVXPRODH2 is INITIAL.

RESULT = SOURCE_FIELDS-/BIC/ZVXPRODH2.

ELSE.

CONCATENATE SOURCE_FIELDS-/BIC/ZVXPRODH1 SOURCE_FIELDS-/BIC/ZVXPRODH2 INTO RESULT.

ENDIF.

Former Member
0 Kudos

You might want to try this in a formula if you are feeling couragous

IF (/BIC/ZVXPRODH2 = '', /BIC/ZVXPRODH2 , CONCATENATE(/BIC/ZVXPRODH1, /BIC/ZVXPRODH2))

Regards

Asif