‎2009 Apr 15 12:07 PM
Hi,
I want to upload an excel from Presentation Server to an internal table for processing the entries.
The file is obtained from a Third Party system and has some entry in the first Row, followed by Column names in the 2nd Row. And the actual column entries starting from the third row.
Square D Remittance Discount Check 02/10/09
Invoice No InvAmt DiscAmt Amt Paid CheckNo Reason code
2504714306 397500 3975 393525 604659
2567229501 26367 264 26103 604659 DD
2567229502 77160 772 76388 604659
While uploading the file using CALL METHOD cl_gui_frontend_services=>gui_upload,
I am getting the BAD DATA FORMAT exception.
Is there a way to handle such an Excel Format in the gui_upload call?
Please let me know.
Thanks,
Binu
‎2009 Apr 15 12:17 PM
‎2009 Apr 15 12:09 PM
‎2009 Apr 15 12:13 PM
hi Binu,.
use FM 'TEXT_CONVERT_XLS_TO_SAP'
OR
'ALSM_EXCEL_TO_INTERNAL_TABLE'
the above two funcion modules are used to convert excel data into intrernal tables directly..
you can mention the number of rows to ignore.. in the the function module..
..
Reagrds,
Prabhudas
‎2009 Apr 15 12:17 PM
‎2009 Apr 15 12:22 PM
Hi,
For the Excel file upload you can do like:
Type-pools Truxs.
DATA: it_raw TYPE truxs_t_text_data.
* internal table declared to be passed in the
* function module used to convert data from xls to sap
*&---------------------------------------------------------------------*
*&Function module called to upload xls data into an internal table
*&---------------------------------------------------------------------*
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = p_file
TABLES
i_tab_converted_data = it_upload[] "internal table into which data
"will get uploaded having the same
"structure of the required fields
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Hope it helps
Regards
Mansi
‎2009 Apr 15 12:25 PM