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

regarding dats field

Former Member
0 Likes
1,064

when I raed the value from screen the date comes as say 04.05.2007.

but when i put the the same value it truncates to 8 since the work area field is of type dats and only 8 characters are accepted .

what should be the solution

should i take the work area field of length as 10 and declare as char,but i need to modify custom table with workarea values , in the cutsom table again the field is of tpe dats,

suggest something

when I raed the value from screen the date comes as say 04.05.2007.

but when i put the the same value it truncates to 8 since the work area field is of type dats and only 8 characters are accepted .

what should be the solution

should i take the work area field of length as 10 and declare as char,but i need to modify custom table with workarea values , in the cutsom table again the field is of tpe dats,

suggest something

7 REPLIES 7
Read only

Former Member
0 Likes
1,004

Take the type DATS.

Amit.

Read only

Former Member
0 Likes
1,004

Hi,

Inside the program it will be converted as YYYYMMDD format.

Do one thing take one variable of size 10.

if you want the format dd.mm.yyyy.

check the following code.

Think that p_date is your parameter date.

Data : v_date(10).

Concatenate p_date6(2) p_date2(2) p_date+0(4) into v_date separated by '.'.

Read only

Former Member
0 Likes
1,004

Hope the custom table also having the data type as dats.So declare the field with type d.

Regards,

Madan.

Read only

Former Member
0 Likes
1,004

If you are not doing any processing with the date field, you can change the workarea as well as table field to char 10 instead of dats.

Read only

Former Member
0 Likes
1,004

If the Screen field from whic you are reading the date is a charater field, then you should use a conversion routine to convert the date to internal format. If the screen field is a date field, it will automatically convert the date to internal format.

To convert external date to inetrnal format:

DATA: date TYPE dats.

CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'

EXPORTING

datum = '14.12.2008'

dtype = 'DATS'

IMPORTING

idate = date.

Read only

Former Member
0 Likes
1,004

Use Function modules

CONVERT_DATE_TO_EXTERNAL with appropriate variables

before displaying to screen and

CONVERT_DATE_TO_INTERNAL to update date from screent to your program

Read only

Former Member
0 Likes
1,004

hi bro,

parameters : s_date type dats.

data: wa_date type dats.

wa_date = s_date.

write 😕 s_date,wa_date.

plz excecute tz code..am not seeing any difference...