Application Development and Automation 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: 
Read only

Check for null in IF statement

Former Member
0 Likes
3,384

Hi,

I have a variable of type char(8).

I want to check if this field is empty. This is the logic I use right now:


condense lv_date no-gaps.
if lv_date eq ''.
*then some default value
endif.

Is this the correct approach or there is a way to directly check for null values in a variable.

Thanks,

CD

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,532

Hello,

You have to check IS INITIAL.

condense lv_date no-gaps.
if lv_date IS INITIAL.
*then some default value
endif.

BR,

Suhas

Hi,

I have a variable of type char(8).

I want to check if this field is empty. This is the logic I use right now:


condense lv_date no-gaps.
if lv_date eq ''.
*then some default value
endif.

Is this the correct approach or there is a way to directly check for null values in a variable.

Thanks,

CD

2 REPLIES 2
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,533

Hello,

You have to check IS INITIAL.

condense lv_date no-gaps.
if lv_date IS INITIAL.
*then some default value
endif.

BR,

Suhas

Read only

Former Member
0 Likes
2,532

Hi,

you do like this.

IF lv_date IS INITIAL.

*some logic

ENDIF.