‎2007 May 24 1:33 PM
Hi,
i have a date variable which is "date".
what is the difference between the following two statements?
if date is initial.
-
-
endif.
if date = space.
-
-
endif.
many thanks in advance,
Ravi
‎2007 May 24 1:36 PM
hi,,
if date is initial. " this will check according to the data type..
if data type is char then initial = space, if integer initial = 0.
-
-
endif.
if date = space. " this exclusively checks whethere the date variable has blank space
-
-
endif.
rewards if useful,
regards,
nazeer
‎2007 May 24 1:36 PM
hi,,
if date is initial. " this will check according to the data type..
if data type is char then initial = space, if integer initial = 0.
-
-
endif.
if date = space. " this exclusively checks whethere the date variable has blank space
-
-
endif.
rewards if useful,
regards,
nazeer
‎2007 May 24 1:37 PM
Hi
IF date is of TYPE DATS
then initial means it has value '00000000'
equal to space mean ' '.
CHAR by deafult takes space.
If date is of CHAR type then both statements do the same thing.
other wise
if date is initial. (means 00000000)
-
-
endif.
if date = space.
-
-
endif.
Reward points if useful
Regards
Anji
‎2007 May 24 1:38 PM
the initial value depends on the data type..
it would be space for Char type & '0' for NUMC type so in your case if you have defined as
data w_date type dats.
both the IF statements will give you the sam eresult as the initial value of DATS is space.
But if you define it as
data: w_date(8) type n.
the initial value will be '00000000'.
~Suresh
Ignore my repsonse.. badly mixed up the initial value of dats with chars
Message was edited by:
Suresh Datti
‎2007 May 24 1:39 PM
‎2007 May 24 1:42 PM
sorry sandeep but thats absoluteley wrong!
his second statement will under NO CURCUMSTANCES be true!
‎2007 May 24 1:51 PM
FYI,
in the data declaration this variable is defined as
date like sy-datum.
now i donno whether this sy-datum is of char type or num
any inputs now?
Ravi
‎2007 May 24 1:52 PM
Sy-datum is of type DATS & is stored as Char but has the initial value '00000000'.
~Suresh
‎2007 May 24 1:41 PM
well your second statement will NEVER be true.
SPACE is the initial VALUE of Character variables.
while the initial value for DATS-fields is 00000000
‎2007 May 24 1:46 PM
Hi,
<i><b>SPACE:</b></i>
The data object SPACE is a constant with type C. It is one byte long, and contains a space
character. SPACE is a constant, and as such, cannot be changed.
<i><b>INITIAL:</b></i>
CONSTANTS: pi TYPE P DECIMALS 10 VALUE '3.1415926536'.
ref_c1 TYPE REF TO C1 VALUE IS INITIAL.
The last line shows how you can use the IS INITIAL argument in the VALUE
addition. Since you must use the VALUE addition in the CONSTANTS statement,
this is the only way to assign an initial value to a constant when you declare it.
Regards,
Bhaskar
‎2007 May 24 2:09 PM
hi,
date initial means it will have default value.
date = '00000000'.
date = space means..default value is not assigned.
date = ' '.
Reward with points if helpful.
‎2007 May 24 2:29 PM
Hi Ravi,
hi,
If DATE IS IN INITIAL STAGE THEN
date = '00000000'.
AND DATE IS SPACE MEANS.
date = ' '.
Reward.