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: 

ws_upload and GUI_upload ....

Former Member
0 Kudos

Hi Everyone,

I got a query, I have tried using ws_upload and gui_upload both in the program...... the codes are below, If I try using .xls it gives only garbage in the internal table. .txt format is working fine. Can anyone help by haveing a look at the code piece where am I going wrong. i trid these piece of codes in both ECC6.0 and 4.6.

**************CODES BELOW*******************

******************************************************

FORM UPLOAD_PS_PRICE .

DATA:L_CURR LIKE EKPO-NETPR.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = p_local

filetype = 'DAT'

  • has_field_separator = 'X'

TABLES

data_tab = t_ps_price

exceptions

file_open_error = 1

file_read_error = 2

no_batch = 3

gui_refuse_filetransfer = 4

invalid_type = 5

no_authority = 6

unknown_error = 7

bad_data_format = 8

header_not_allowed = 9

separator_not_allowed = 10

header_too_long = 11

unknown_dp_error = 12

access_denied = 13

dp_out_of_memory = 14

disk_full = 15

dp_timeout = 16

OTHERS = 17.

IF sy-subrc <> 0.

ENDIF.

  • CALL FUNCTION 'WS_UPLOAD'

  • EXPORTING

  • FILENAME = P_LOCAL

  • FILETYPE = 'DAT'

  • TABLES

  • DATA_TAB = T_PS_PRICE

  • EXCEPTIONS

  • CONVERSION_ERROR = 1

  • FILE_OPEN_ERROR = 2

  • FILE_READ_ERROR = 3

  • INVALID_TYPE = 4

  • NO_BATCH = 5

  • UNKNOWN_ERROR = 6

  • INVALID_TABLE_WIDTH = 7

  • GUI_REFUSE_FILETRANSFER = 8

  • CUSTOMER_ERROR = 9

  • OTHERS = 10.

  • IF SY-SUBRC <> 0.

  • MESSAGE S002 WITH TEXT-007.

  • ENDIF.

4 REPLIES 4

Former Member
0 Kudos

Hi

WS_UPLOAD is obselete and is not recommended to use.

If you want to upload the excel sheet use FM ALSM_EXCEL* or TEXT_CONVERT_TXT_TO_SAP

Regards

Shiva

Former Member
0 Kudos

hi anupama,

use the fm ALSM_EXCEL_TO_INTERNAL_TABLE for uploading from XLS file.

Regards,

Priya.

Former Member
0 Kudos

hi

good

did you debug the code and try to find out where is the exact error is, because it is quite difficult to give you the correct reply with this bit of code.

thanks

mrutyun^

Former Member
0 Kudos

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE' to upload excel file