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

Date field validation

Former Member
0 Likes
2,151

Hi all,

I have developed a BDC program to upload data into MIGO transaction. Now, I will be uploading date (from excel sheet) into the transaction. I want to validate this date just like how it is done in the screen.

For example, in screen, if the user enters 010109, after pressing enter key the date will be converted as 01.01.2009.

How can I achieve this?

Thanks,

Rajan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,521

Hi,

You need to fix the date format before you upload the data using BDC. Before it is tedious to validate the date entered in the file. There are lot many probabilites needs to be checked.

The best way is to fix the format in the file and code for the same and maintain the documentation for this.

11 REPLIES 11
Read only

Former Member
0 Likes
1,522

Hi,

You need to fix the date format before you upload the data using BDC. Before it is tedious to validate the date entered in the file. There are lot many probabilites needs to be checked.

The best way is to fix the format in the file and code for the same and maintain the documentation for this.

Read only

Former Member
0 Likes
1,521

Use FM CONVERT_DATE_TO_EXTERNAL.

Read only

Former Member
0 Likes
1,521

dear ,

take the parameter of the internal table as SY-DATUM and then take the excel data and pass it .

and also if u will pass this directly this should not gice error

thanks ankit

Read only

Former Member
0 Likes
1,521

Hi, You can convert it using Date function modules and upload it to BDC. You need to use the FM for every line item exactly before entering date value or,

while recording MIGO transaction, after you enter the date say, 01012009 press enter, and the date will be automatically converted to 01.01.2009. Thereby this enter will be captured in BDC recording. when you run it through program, as you update the date, enter command will perfrom and the date will be automatically converted to the required format. You dont need to do anything apart from recording the enter code.

Read only

former_member438956
Active Participant
0 Likes
1,521
Read only

Former Member
0 Likes
1,521

Hi,

You can use Below FM :

CONVERT_DATE_TO_INTERNAL

This FM will convert date as internal format,i mean depends on user profile.

Regards,

Omkaram.

Read only

Former Member
0 Likes
1,521

Hi Rajan,

First you convert the date from excel to SAP internal format i.e. YYYYMMDD and then use WRITE TO statement to get user default format(Like 13.04.2009).

Regards,

Raju.

Read only

Former Member
0 Likes
1,521

Hi,

Try using Function Module:

CONVERT_DATE_TO_INTERNAL ,

this will convert your date into sap's

internal date format.

Hope it helps

Regards

Mansi

Read only

Former Member
0 Likes
1,521

Hi all,

If the user enters date like this 1/2/09 (using slash) or 1:02:09 (using colon or semi colon) or if there is any typographical error, the program has to pick the value correctly.

is it possible to perform validation for all these cases? is there any FMs for this..?

Thanks,

Rajan

Read only

Former Member
0 Likes
1,521

solved on my own

Read only

0 Likes
1,521

can u tell me rajan how did you solved this problem , coz i am facing same problem .

i have excel sheet in which date format is 20100405 means yearmonthday

and i want it to be 05.04.2010.

i have used fm convert_date_sap_internal

but it is converting date 05.04.1020 format . can u tell me what could be probable reason . it would be very nice of you .