‎2007 May 24 10:40 AM
Hello,
I have a program that goes like this :
DATA : p_audatto, p_audatfrom TYPE sy-datum.
p_audatto = sy-datum.
p_audatfrom = sy-datum - 3.
....
when i debug this i have
p_audatto == 2,
p-audatfrom == 20070521 and
sy-datum ==20070524
Can somebody explain me why my p_audatto value is 2 ?
Thanks
‎2007 May 24 10:42 AM
Hi
Because you've defined it as field of <b>ONLY 1 CHAR</b>, so it can store only the first number of the date.
DATA : p_audatto TYPE SY-DATUM, "<---- Right definition
p_audatfrom TYPE sy-datum.
p_audatto = sy-datum.
p_audatfrom = sy-datum - 3.Max
‎2007 May 24 10:42 AM
Hi
Because you've defined it as field of <b>ONLY 1 CHAR</b>, so it can store only the first number of the date.
DATA : p_audatto TYPE SY-DATUM, "<---- Right definition
p_audatfrom TYPE sy-datum.
p_audatto = sy-datum.
p_audatfrom = sy-datum - 3.Max
‎2007 May 24 10:43 AM
Hello
Delcare the fields like this
DATA : p_audatto TYPE sy-datum, " Check here
p_audatfrom TYPE sy-datum.
Vasanth
‎2007 May 24 10:43 AM
Hi,
Decalre p_audatto TYPE sy-datum.
this will work and the result will be
24.05.2007
Revert back if nay issues.
Reward with points if helpful.
Regards
Naveen.
‎2007 May 24 10:44 AM
Bcoz when you are defining DATA : p_audatto, p_audatfrom TYPE sy-datum.
p_audatto will be taken as type c of length 1. for desired result you need to define like this
DATA : p_audatto TYPE sy-datum,
p_audatfrom TYPE sy-datum.
regards,
Amit
‎2007 May 24 10:45 AM
Hi Tomislav,
By default if you didnt specify any thing to a variable in DATA statement then it will be treated as CHARACTER type.
In your case p_audatto is acting as CHARACTER data type of length 1.
DATA : <b>p_audatto type sy-datum,</b>
p_audatfrom TYPE sy-datum.
Thanks,
Vinay
‎2007 May 24 10:45 AM
Hi,
If you want to get date in p_audatto,define p_audatto as
DATA: p_audatto like sy-datum.
Regards,
Savitha
‎2007 May 24 10:47 AM
Hi
Do like this......
DATA : p_audatto TYPE sy-datum,
p_audatfrom TYPE sy-datum.
Reward All Helpfull Answers........
‎2007 May 24 10:49 AM
Data type declaration for p_audatto is C.
By default if you don't declare any it will consider as type C lenght of 1 char.
That is the cause of your problem.
Reward points to all useful answers.
Regards,
SaiRam