‎2008 Apr 17 10:05 AM
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
‎2008 Apr 17 10:07 AM
Hi,
if u want upload data from excel sheet use the function module ALSM EXCEL TO ITAB instead of gui_upload.
rgds,
bharat.
‎2008 Apr 17 10:08 AM
Check out these sample programs
‎2008 Apr 17 10:10 AM
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.
‎2008 Apr 17 10:13 AM
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.