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

Parameters For GUI_UPLOAD

Former Member
0 Likes
2,053

Dear All,

I want to upload data from Excel File, can anybody give me parameters for Function Module 'GUI_UPLOAD'(From Excel File Not from Text File)

Regards,

Mayank

4 REPLIES 4
Read only

Former Member
0 Likes
949

Hi,

if u want upload data from excel sheet use the function module ALSM EXCEL TO ITAB instead of gui_upload.

rgds,

bharat.

Read only

Former Member
Read only

Former Member
0 Likes
949

Hi,

I did the following to upload a Excel file into a Table in SAP

Hope that the following will help you

TYPE-POOLS: truxs, SLIS.

PARAMETERS: p_file TYPE rlgrap-filename default 'C:\Documents and Settings\Testuser\My Documents\partic_results.xls'.

DATA: lw_partic_results TYPE LINE OF zlsotac_results,

partic_results LIKE zlsotac_results OCCURS 0,

gt_header TYPE TABLE OF slis_listheader WITH HEADER LINE.

DATA: it_raw TYPE truxs_t_text_data.

    • At selection screen

*AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  • CALL FUNCTION 'F4_FILENAME'

  • EXPORTING

  • field_name = 'P_FILE'

  • IMPORTING

  • file_name = p_file.

START-OF-SELECTION.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

  • I_FIELD_SEPERATOR =

i_line_header = ' '

i_tab_raw_data = it_raw " WORK TABLE

i_filename = p_file

TABLES

i_tab_converted_data = partic_results[] "ACTUAL DATA

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.

Read only

Former Member
0 Likes
949

Hi Mayank,

Below is the code for the FM GUI_Upload

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = fname

  • FILETYPE = 'ASC'

  • HAS_FIELD_SEPARATOR = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

tables

data_tab = itab

  • 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.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

fname is the file name from which the data needs to be uploaded.

itab is the internal table in which the data needs to be uploaded.

Pls reward if useful.

Thanks,

Sirisha.