‎2007 Jan 08 12:14 PM
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........
‎2007 Jan 08 4:02 PM
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...
‎2007 Jan 08 4:02 PM
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...