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

BDC FLAT FILE DATE VALIDATIONS

Former Member
0 Likes
358

Hi,

The flat file is having 2 Date fields Start Date and End Date. How can i Validate it whether they are in YYYYMMDD format or not. And also I need to extract the records with effective dates between 2003 and 2004. Can any body help out. If you provide me coding it is very helpful....Very Urgent.....

Thanks........

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
312

Hi Anil,

Upload the flat file to an internal table and loop the internal table and validate the data.

Loop at itab_file.

  • Create a perform to validate the Start Date and End Date.

Perform validate_date using date changing flag_err.

  • Create a perform to extract the records of 2003 and 2004

Perform extract_records.

Endloop.

Form Validat_date using date changing flag_err.

data l_date(8) type c.

move date to l_date.

  • To check the day of the date

if l_date6(2) >= 1 and l_date6(2) <= 31.

flag_err = ' '.

else.

flag_err = 'X'.

endif.

  • To check the month of the date

if l_date4(2) >= 1 and l_date4(2) <= 12.

flag_err = ' '.

else.

flag_err = 'X'.

endif.

Endform.

Once after validating the date then check out the year of the date using the perform extract_records.while moving the flate file data into final internal table.

Form extract_records using itab_file.

data l_date(8) type c.

move itab_file-date to l_date.

  • Check the year of the date

if l_date0(4) = 2003 or l_date0(4) = 2004.

move itab_file to itab_final.

endif.

Endform.

Use the final internal table and pass it to the BDC for processing.

Regards,

Jayaram...

1 REPLY 1
Read only

Former Member
0 Likes
313

Hi Anil,

Upload the flat file to an internal table and loop the internal table and validate the data.

Loop at itab_file.

  • Create a perform to validate the Start Date and End Date.

Perform validate_date using date changing flag_err.

  • Create a perform to extract the records of 2003 and 2004

Perform extract_records.

Endloop.

Form Validat_date using date changing flag_err.

data l_date(8) type c.

move date to l_date.

  • To check the day of the date

if l_date6(2) >= 1 and l_date6(2) <= 31.

flag_err = ' '.

else.

flag_err = 'X'.

endif.

  • To check the month of the date

if l_date4(2) >= 1 and l_date4(2) <= 12.

flag_err = ' '.

else.

flag_err = 'X'.

endif.

Endform.

Once after validating the date then check out the year of the date using the perform extract_records.while moving the flate file data into final internal table.

Form extract_records using itab_file.

data l_date(8) type c.

move itab_file-date to l_date.

  • Check the year of the date

if l_date0(4) = 2003 or l_date0(4) = 2004.

move itab_file to itab_final.

endif.

Endform.

Use the final internal table and pass it to the BDC for processing.

Regards,

Jayaram...