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

sy-datum value space?

Former Member
0 Likes
3,496

Ich habe in der Funktion

ISP_GENER_EINTEIL

folgende Datendefinition gefunden:

data: lv_initial_bis_datum like  sy-datum value space.


Somit hat lv_initial_bis_datum den Inhalt '________' statt '00000000'.


Spaetere Abfragen wie:


IF lv_initial_bis_datum IS INITIAL

oder

CHECK lv_initial_bis_datum IS INITIAL


liefern dann doch nicht das erwartete Ergebnis.


Ist das ein spezieller Programmierer-Trick oder einfach nur ein Fehler?



1 ACCEPTED SOLUTION
Read only

vikas_mulay2
Participant
0 Likes
2,117

Hi Ralph,

The code that you pasted has default value as 'space'.



data: lv_initial_bis_datum like  sy-datum value space.

Hence you have lv_initial_bis_datum as  '________' and not '00000000'.

Simply declare it as

data: lv_initial_bis_datum like  sy-datum

This will solve your problem.

Reagrds,

Vikas

Ich habe in der Funktion

ISP_GENER_EINTEIL

folgende Datendefinition gefunden:

data: lv_initial_bis_datum like  sy-datum value space.


Somit hat lv_initial_bis_datum den Inhalt '________' statt '00000000'.


Spaetere Abfragen wie:


IF lv_initial_bis_datum IS INITIAL

oder

CHECK lv_initial_bis_datum IS INITIAL


liefern dann doch nicht das erwartete Ergebnis.


Ist das ein spezieller Programmierer-Trick oder einfach nur ein Fehler?



7 REPLIES 7
Read only

Former Member
0 Likes
2,117

Can you please translate your question to English?

Read only

0 Likes
2,117

i found following data definition in funktion: ISP_GENER_EINTEIL data: lv_initial_bis_datum like  sy-datum value space. so lv_initial_bis_datum has the value of '________' and not '00000000' without the value parameter. fo later questions like: IF lv_initial_bis_datum IS INITIAL or CHECK lv_initial_bis_datum IS INITIAL i get not the right answer i think for. is this a spezial programmer-trick (data definition) or simply an error?

Read only

Former Member
0 Likes
2,117

Hello ,

- Try to declare like this :

data: lv_initial_bis_datum like  sy-datum .

clear lv_initial_bis_datum.

- then you can get expected results on condition ( if initial )

Regards

Read only

vikas_mulay2
Participant
0 Likes
2,118

Hi Ralph,

The code that you pasted has default value as 'space'.



data: lv_initial_bis_datum like  sy-datum value space.

Hence you have lv_initial_bis_datum as  '________' and not '00000000'.

Simply declare it as

data: lv_initial_bis_datum like  sy-datum

This will solve your problem.

Reagrds,

Vikas

Read only

0 Likes
2,117

This code is original SAP Funktion. I will report this to SAP as error. Thanks all.

Read only

Former Member
0 Likes
2,117

Hi Ralph,

I think it's an error. I assume it is used as a constant. In that case the correct way to declare it would be:

CONSTANTS intial_date TYPE sydatum VALUE IS INITIAL.


Regards

Harald

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,117

Look via debug, the initial value for a DATS type field is '00000000', IS INITIAL will check this value. I suppose space was input as initial value so it is displaying space at screen/on print.

DATA: datefield TYPE d VALUE space.
IF datefield IS INITIAL.
   WRITE: / 'datefield <', datefield, '> IS INITIAL.'.
ELSE.
   WRITE: / 'datefield <', datefield, '> IS NOT INITIAL.'.
ENDIF.
CLEAR datefield.
IF datefield IS INITIAL.
   WRITE: / 'datefield <', datefield, '> IS INITIAL.'.
ELSE.
   WRITE: / 'datefield <', datefield, '> IS NOT INITIAL.'.
ENDIF.

For more information check documentation of Abap type d fields.


Only date entries in the format "yyyymmdd" are valid for data objects of type d, whereby "00010101" is the first valid value. The conversion rules, however, allow the assignment of date fields that contain invalid data. The latter is not recommended.

Regards,

Raymond