Application Development 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: 

TEXT_CONVERT_XLS_TO_SAP

Former Member
0 Kudos

can we use TEXT_CONVERT_XLS_TO_SAP for the excel both on application and presentation server to move excel data to internal table?

where as we use gui_upload for presentation server and open dataset for application server for .txt file

3 REPLIES 3

Former Member
0 Kudos

hi,

Hi,

Presentation server to internal table

Try this code to upload the data from EXCEL sheet to internal table.

DATA l_count TYPE sy-tabix.

CONSTANTS: lc_begin_col TYPE i VALUE '1',

lc_begin_row TYPE i VALUE '2',

lc_end_col TYPE i VALUE '2',

lc_end_row TYPE i VALUE '3000'.

  • Begin of CALK912848 - Carlos Werberich - 16Sep08

CLEAR p_i_excel_data. REFRESH p_i_excel_data.

  • End of CALK912848 - Carlos Werberich - 16Sep08

  • Function module to read excel file and convert it into internal table

CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'

EXPORTING

filename = p_p_file

i_begin_col = lc_begin_col

i_begin_row = lc_begin_row

i_end_col = lc_end_col

i_end_row = lc_end_row

TABLES

intern = i_data

EXCEPTIONS

inconsistent_parameters = 1

upload_ole = 2

OTHERS = 3.

  • Error in file upload

IF sy-subrc NE 0 .

MESSAGE text-006 TYPE 'E'.

EXIT.

ENDIF.

IF i_data[] IS INITIAL .

MESSAGE text-007 TYPE 'E'.

EXIT.

ELSE.

SORT i_data BY row col .

  • Loop to fill data in Internal Table

LOOP AT i_data .

MOVE i_data-col TO l_count .

ASSIGN COMPONENT l_count OF STRUCTURE p_i_excel_data TO <fs_source> .

MOVE i_data-value TO <fs_source> .

AT END OF row .

  • Append data into internal table

APPEND p_i_excel_data.

CLEAR p_i_excel_data.

ENDAT .

ENDLOOP .

ENDIF .

Former Member
0 Kudos

this FM can use only to from presentation server, you can't upload excel data from applications server,

this is upto my knowldge,, by that option better you can take .txt file will better from applications server..

Former Member
0 Kudos

cheers

Aveek