Application Development and Automation 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: 
Read only

GUI_UPLOAD for excel file

Former Member
0 Likes
2,010

hi,

i am facing a problem with function module GUI_UPLOAD.

when i am trying to upload a excel file using gui_upload,the data that gets uploaded to internal table is garbage (contains # etc)..

what can be the reason.

shailendra.

1 ACCEPTED SOLUTION
Read only

sachin_mathapati
Contributor
0 Likes
997

Try using these FMs

ALSM_EXCEL_TO_INTERNAL_TABLE instead of GUI_UPLOAD..

OR

'FAA_FILE_UPLOAD_EXCEL'

OR

'TEXT_CONVERT_XLS_TO_SAP'

Reward If helpful

Edited by: Sachin Mathapati on Jul 4, 2008 12:22 PM

Try using these FMs

ALSM_EXCEL_TO_INTERNAL_TABLE instead of GUI_UPLOAD..

OR

'FAA_FILE_UPLOAD_EXCEL'

OR

'TEXT_CONVERT_XLS_TO_SAP'

Reward If helpful

Edited by: Sachin Mathapati on Jul 4, 2008 12:22 PM

5 REPLIES 5
Read only

sachin_mathapati
Contributor
0 Likes
998

Try using these FMs

ALSM_EXCEL_TO_INTERNAL_TABLE instead of GUI_UPLOAD..

OR

'FAA_FILE_UPLOAD_EXCEL'

OR

'TEXT_CONVERT_XLS_TO_SAP'

Reward If helpful

Edited by: Sachin Mathapati on Jul 4, 2008 12:22 PM

Read only

0 Likes
997

Hi,

i think u can't use GUI_UPLOAD when ur calling xl file

on that time u have to use ALSM_EXCEL_TO_INTERNAL_TABLE .

and loop every field into ur internal table field

Read only

Former Member
0 Likes
997

Hi ,

see the below codes...hope this will be helpfull to u.

CALL FUNCTION 'F4_FILENAME'

IMPORTING

file_name = p_file.

DATA : l_filename LIKE rlgrap-filename,

l_begin_col TYPE i VALUE 1,

l_end_col TYPE i VALUE 10,

p_row_fr TYPE i VALUE 2,

p_row_to TYPE i VALUE 10000.

  • l_end_row type i value 10.

l_filename = p_filenm.

*Read the records from the file exporting number of rows and columns

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = l_filename

i_begin_col = l_begin_col

i_begin_row = p_row_fr

i_end_col = l_end_col

i_end_row = p_row_to

TABLES

intern = it_file

EXCEPTIONS

inconsistent_parameters = 1

upload_ole = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • MESSAGE e899 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

reward points if helpfull.

Thanks & Regards,

Y.R.Prem Kumar

Read only

Former Member
0 Likes
997

Hey !!

Use this function module.

ALSM_EXCEL_TO_INTERNAL_TABLE

Regards

Abhijeet Kulshreshtha

Read only

Former Member
0 Likes
997

hi check this..

REPORT ZTESTPROG003.

TYPES:

BEGIN OF ty_upload,

matnr like mara-matnr,

meins like mara-meins,

mtart like mara-mtart,

mbrsh like mara-mbrsh,

END OF ty_upload.

DATA it_upload TYPE STANDARD TABLE OF ty_upload WITH header line.

DATA wa_upload TYPE ty_upload.

DATA: itab TYPE STANDARD TABLE OF alsmex_tabline WITH header line.

  • DATA itab TYPE STANDARD TABLE OF ty_upload WITH header line.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = 'C:\Documents and Settings\venkatapp\Desktop\venkat.xls'

i_begin_col = 1

i_begin_row = 1

i_end_col = 4

i_end_row = 65535

TABLES

intern = itab.

if not itab[] is initial.

loop at itab .

case itab-col.

when '0001'.

it_upload-matnr = itab-value.

when '0002'.

it_upload-meins = itab-value.

when '0003'.

it_upload-mtart = itab-value.

when '0004'.

it_upload-mbrsh = itab-value.

append it_upload.

clear it_upload.

clear itab.

endcase.

endloop.

endif.

loop at it_upload.

write:/ it_upload-matnr,it_upload-meins,it_upload-mtart,it_upload-mbrsh.

endloop.