10-08-2008 3:54 PM
Hi ,
I have to upload a Excel sheet with data where the first line will be the Header .
I am using the FM
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_LINE_HEADER = 'X'
I_TAB_RAW_DATA = IT_TAB_RAW_DATA
I_FILENAME = P_FILE
TABLES
I_TAB_CONVERTED_DATA = IT_FS00_C
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2.
But the data is not getting uploaded in the IT_FS00_c table.
is there any other way to do it.
thanks and regards,
Vikki.
10-08-2008 3:58 PM
Hi,
Try uploading entire file to string table just by using FM GUI_UPLOAD. Then within a loop split all the lines and put it to destination structure. First line of the table will be file's header line.
Regards
Marcin
10-09-2008 9:43 AM
10-09-2008 9:55 AM
Use the folllowing coding.....
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = 1
i_begin_row = 2
i_end_col = 7
i_end_row = 9999
TABLES
intern = t_alsm_tab
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SORT t_alsm_tab BY row col.
LOOP AT t_alsm_tab INTO r_alsm_tab.
AT END OF row.
l_append = 'X'.
ENDAT.
IF r_alsm_tab-col = 1.
r_input_tab-kokrs = r_alsm_tab-value.
ELSEIF r_alsm_tab-col = 2.
r_input_tab-bukrs = r_alsm_tab-value.
ELSEIF r_alsm_tab-col = 3.
r_input_tab-rprctr = r_alsm_tab-value.
ELSEIF r_alsm_tab-col = 4.
r_input_tab-pline = r_alsm_tab-value.
ELSEIF r_alsm_tab-col = 5.
r_input_tab-sdatst = r_alsm_tab-value.
ELSEIF r_alsm_tab-col = 6.
r_input_tab-sdated = r_alsm_tab-value.
ELSEIF r_alsm_tab-col = 7.
r_input_tab-kostl = r_alsm_tab-value.
ENDIF.
IF l_append = 'X'.
APPEND r_input_tab TO t_input_tab.
CLEAR : l_append , r_input_tab.
ENDIF.
ENDLOOP.
ENDIF.
10-10-2008 7:23 AM
Thank you All for the reply.
The same FM 'TEXT_CONVERT_XLS_TO_SAP' worked well after i made all the fields as CHAR type.
Vikki.