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 inserting date into database

Former Member
0 Likes
471

Hello Gurus,

I have problem with inserting date field in the database. date field has data types dats in the database. if i give the dates in the selection screen it insert properly without problem if user doesnt enetr value in the date field i have to insert default value. here i am not able to insert date formate properly.

here is the example :

PARAMETER : AEDATE TYPE DATS . ( WHICH IS SAME AS DATABASE DATA TYPE ).

If user doent enter the value default value i want to insert 01.01.1970.

DATA : BEGIN OF ITAB OCCURS 0,

ACS1 TYPE D,

END OF ITAB.

ACS1 = AEDAT.

INSERT DB FROM ITAB.

if user eneter in selection screen it works fine. if i want to give default value it wont insert properly.

Please help me. it is urgent.

Thanks in advance.

best regds,

zub

2 REPLIES 2
Read only

Former Member
0 Likes
411

Hi,

If you want to give a default value( like 01.01.1970 ), you should use FM CONVERT_DATE_TO_INTERNAL to convert that default value to internal format(database format).

You can debug at code line ACS1 = AEDAT to see the value in 2 case (give default value & input from screen).

Regards,

Gy

Read only

Former Member
0 Likes
411

Hello,

If u want to assign default value(date), date must be entered in the format YYYYMMDD

Example:

move '19700101' to fields-value