Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

COALESCE

sabarna17
Contributor
0 Kudos

Hi,

SELECT EBELN, INFNR,

        MATKL,

COALESCE( s~INFNR, s~MATKL ) AS ABCD

FROM EKPO AS s

UP TO 20 ROWS

INTO TABLE @DATA(lt_result).

I am Using the previous code to test.

But if s~INFNR is null and s~MATKL consists value, then also blank is displaying in ABCD column.


Need clarification.

-Sabarna

1 REPLY 1

former_member183045
Contributor
0 Kudos

In the field INFNR there is never a null value but an empty value. So you can not use coalesce here because infnr is always set

SELECT * FROM EKPO WHERE INFNR = ''  ... returns a lot of results

SELECT * FROM EKPO WHERE INFNR is null ... returns no results

So in your case you should use matkl if infnr = ''

Best regards, Andreas