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: 

sy-datum value space?

Former Member
0 Kudos

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

vikas_mulay2
Participant
0 Kudos

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

7 REPLIES 7

Former Member
0 Kudos

Can you please translate your question to English?

0 Kudos

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?

Former Member
0 Kudos

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

vikas_mulay2
Participant
0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

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

raymond_giuseppi
Active Contributor
0 Kudos

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