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

SELECT option using a date

Former Member
0 Likes
647

Hi SAP gurus,

I have a question regarding the select option using Date field,

the variable using the date field is dat_var

My IF condition goes like this

IF dat_var NE SPACE.

Condition

ENDIF. but since date is 00000000 it is going into the condition but i dont want it to

could u guys suggest to what are my possible options

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
628

The initial value of date fields are 00000000, so check for this instead.



IF dat_var NE '00000000'.
  
ENDIF.

Regards,

Rich Heilman

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
629

The initial value of date fields are 00000000, so check for this instead.



IF dat_var NE '00000000'.
  
ENDIF.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
628

>

> Hi SAP gurus,

>

> I have a question regarding the select option using Date field,

> the variable using the date field is dat_var

> My IF condition goes like this

IF dat_var IS NOT INITIAL .

> Condition

> ENDIF. but since date is 00000000 it is going into the condition but i dont want it to

> could u guys suggest to what are my possible options

Read only

mnicolai_77
Active Participant
0 Likes
628

hi,

change NE space with if NOT dat_var IS INITIAL

Bye

Read only

Former Member
0 Likes
628

DATA: dat_var LIKE sy-datum.

IF ( dat_var IS NOT INITIAL ).

WRITE: 'contains valid date'.

ELSE.

WRITE: 'contains empty date'.

ENDIF.

Read only

Former Member
0 Likes
628

Thanks