2007 Feb 15 10:15 AM
hi all,
is there any method to validate a flat file before uploading the records to the database for uploading we may use session or call transaction method.
thanks in advance
hi all,
is there any method to validate a flat file before uploading the records to the database for uploading we may use session or call transaction method.
thanks in advance
2007 Feb 15 10:42 AM
Hello Ramesh,
Populate the data into one internal table using (GUI_UPLOAD function module)-> Loop the internal table-> Do the validation for each field of the internal table.
This is a way to validate the data before passing it to a BDC.
Hope this will helpful.
Regards,
Bhavana
2007 Feb 15 10:46 AM
hi
normally as BDC is processed through screens, the screen validations are already done for the same. in case any error occurs in the processing, it is validated on the screen can be observed in session (in case of session method) or BDCMSGCOLL (in case of calltransaction method).
if you dont want to validate in run time, and want to do all the validations before processing, you can read each record of the uploaded internal table using LOOP statement, and do the necessary validations.
thanks
pavan
2007 Feb 15 10:58 AM
Hi
Populate the data into one internal table using (GUI_UPLOAD function module)-> Loop the internal table-> Do the validation for each field of the internal table.
This is a way to validate the data before passing it to a BDC.
Validation in the sense generally we will check and split the line items while handling with BDC.
Regards,
kumar
2007 Feb 15 12:46 PM
2007 Feb 17 11:00 AM
For Checking the file Format.
CALL METHOD cl_gui_frontend_services=>file_exist
EXPORTING
file = w_l_file
RECEIVING
result = w_file_fg
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
not_supported_by_gui = 4
OTHERS = 5.
and then for data up load in to internal table
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = 1
i_begin_row = 2
i_end_col = 9
i_end_row = 5000
TABLES
intern = it_excel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
to get the data ino our required format of internal table
LOOP AT it_excel INTO is_excel.
CASE is_excel-col.
WHEN c_col_0001.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = is_excel-value
IMPORTING
date_internal = w_date.
IF sy-subrc <> 0.
MESSAGE i000(ymmm) WITH 'Enter valid Date in Excel'.
ENDIF.
is_data-cdate = w_date. "OB Delivery Creation date
CLEAR:w_date.
WHEN c_col_0002.
is_data-stsan = is_excel-value. "STSA Number
WHEN c_col_0003.
is_data-matnr = is_excel-value. "Material Number
WHEN c_col_0004.
TRANSLATE is_excel-value TO UPPER CASE.
is_data-lgort = is_excel-value. "Storage Location.
WHEN c_col_0005.
is_data-charg = is_excel-value. "Batch Number
WHEN c_col_0006.
is_data-menge = is_excel-value. "Quantity in KG
WHEN c_col_0007.
is_data-chnum = is_excel-value. "Delivery Challan Number
WHEN c_col_0008.
is_data-fagnt = is_excel-value. "Forwarding Agent 1
WHEN c_col_0009.
is_data-vnumb = is_excel-value. "Vehicle License Plate Number
ENDCASE.
AT END OF row.
APPEND is_data TO it_data.
CLEAR: is_data,is_excel.
ENDAT.
ENDLOOP.
SORT it_data BY cdate.
And then do the validation.
I worked on this.
IF it is use full Give some points.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |