Gui_upload function
Hi experts,
I used function gui_upload - to upload excel file.
the data i get is that the cells is seperated by ','.(name,age,mail,,,,)
i want to take this data and put it in a structure, that each cell will be in
seperate in the structure.
how can i put this data in my structure?
thanks,
Michal.
i figure it out thanks.
Similar Messages
-
Doubt in GUI_UPLOAD function
Hi friends,
CALL FUNCTION 'GUI_UPLOAD '
EXPORTING
FILENAME = FILE
FILETYPE = 'ASC'
*HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = ITAB.
In the GUI_UPLOAD function what the filetype should be and has_field_separator should be given what value? What does it mean.How should i prepare the file for example for VA01 transaction if i have a file like this it is not working. What is the problem. I am new to BDC so i need your help on this.
Thanks in Advance.try the following.
DATA: begin of ITAB occurs 0,
field1 type char10,
field2 type char10,
end of itab.
data: filename type string value 'C:\TMP.TXT'.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = filename
FILETYPE = 'ASC'
TABLES
DATA_TAB = itab.
loop at itab.
write:/ itab-field1, 20 itab-field2.
endloop.
create a file with tab-delimitations. -
Change from UPLOAD to GUI_UPLOAD function module
pls let me know that wat are the changes that should be made if the report currently using UPLOAD function module and it should be replaced with GUI_UPLOAD function module ..
wat should be the TYPE of file name and File type ???????? with the respect to changes ....
thanks . in advance..Check out this thread to find the answer
UPLOAD and GUI_UPLOAD
Regards,
Santosh -
Help me on using GUI_UPLOAD function
Dear my friends,
I am using GUI_UPLOAD function to upload a file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename contain file path
FILENAME = filepath
filetype is ASC
FILETYPE = 'ASC'
Use tab key to seperate field
HAS_FIELD_SEPARATOR = ','
Internal table keep data from file by function GUI_UPLOAD
TABLES
data_tab = tblTrantable.
but it did not work for HAS_FIELD_SEPARATOR option.
although i tried to use HAS_FIELD_SEPARATOR = '#'
but system still return by fix lengh data column not by separator.
<u>note : my SAP version = 4.6C</u>
Please help me,
Thanks !
Message was edited by:
Quoc Luc Nguyen
Message was edited by:
Quoc Luc Nguyenhi,
set has field separartor to 'x'.
chk this FM for example:
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = W_FILENAME1
FILETYPE = W_FILETYPE1
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = 'X'
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = IT_UPLOAD
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.
regards,
keerthi -
Where does GUI_UPLOAD function store the files?
Where does GUI_UPLOAD function store the files?
Hi Audrey
Here is an example of accessing files from application server:
open dataset w_file for input in text mode.
if sy-subrc <> 0.
message e895 with 'Unable to locate file'.
else.
do.
read dataset w_file into it_data.
if sy-subrc eq 4. " End of file reached
clear it_data.
exit.
else.
append it_data.
clear it_data.
endif.
enddo.
close dataset w_file.
In the above example, w_file is declared as string containing c:\usr\sap\test.txt
And this file should be there on this path on application server.
And, yes, you need to declare it_data as an internal table containing fields corresponding to file from which you are reading data.
Regards
Ashish Jain
[email protected] -
Problem in GUI_UPLOAD function module
Hi Folks,
I am in the BI system where I have limited scope of upload function module, So I used GUI_UPLOAD as a upload function module.
I am uploading CSV file and which have amount field (with comma ',' ) as one of the column , So it is truncating the other columns while retrieving data into internal table and giving wrong data in columns.
Any other Function module, or tricks to upload file which have ',' in one of the column.
Thanks
PPHi,
Well in this case you will have to change the file format i.e. Instead of CSV make it tab delimited etc.
Else change the amount value by replacing comma(which woud be a tedious task).
There is no other alternative.
Best regards,
Prashant -
GUI_UPLOAD Function Module in 4.6C does not split into lines
Dear All,
I'm about to upload text file into SAP using the FM 'GUI_UPLOAD'.
Previously I've developed a test program to upload the same file in SAP v4.7
and it returns correctly into several lines as expected.
Snippet:
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_filename
filetype = 'ASC'
has_field_separator = ' '
header_length = 0
read_by_line = 'X'
TABLES
data_tab = gt_tabfile
As we can see, the 'read_by_line' parameter is already 'X'. gt_tabfile only consist of 1 string column.
But as I run the same code using the same parameter and file in SAP v4.6C
it returned only 1 line of very long string instead of the correct lines resulted in 4.7.
Is there anything to do with codepage (4.6 is English 1100, I forgot the codepage in 4.7 but i believe it's the same due to language selection is EN). Or anything to do with OSS Note?
Kindly help me to resolve the issue.
Appreciate it very muchThank you for trying to help.
Please be noted I've done all the possible value on these parameter
- filetype 'ASC' OR 'BIN'
- has_field_separator ' ' or 'X'
- header_length 0 or 1 which is dont make sense since my file dont have header so must be 0
- read_by_line ' ' of 'X' doesnt work my expectation.
Any other good questions please? How 4.6C and 4.7 above make a different result? -
Gui_upload for uploading binary file
Hello All,
I am trying to upload '.jpg' files using gui_upload function.
But something goes wrong and it dumps.
I am new to ABAP.
following is the code i used.
DATA: xline TYPE xstring.
DATA : t_file LIKE TABLE OF xline WITH HEADER LINE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filetype = 'BIN'
filename = 'C:\Documents and Settings\I046674\Desktop\RawTest\images\Image_1000.jpg'
TABLES
data_tab = t_file.
It dumps in the 'GUI_UPLOAD' function itself.
Saying follownig,
==========================================
Error analysis
The error occurred at a statement in the form
ASSIGN f TO <fs> TYPE t
One of these two cases occurred:
1) Field f is a string, a data reference, an object reference, an
internal table or a structure that contains such a field. With the
TYPE addition, this is not possible.
2) Field f is of type x and field symbol <fs> has a character-type type.
When executing the statement, the length of f is not a multiple of
the length (in bytes) of a Unicode character.
===============================================
Can someone help me on this?
Thanks & Regards,
Abhijithi,
Master Data Documents Upload ABAP Program
Re: Upload Master Data documents
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'c:\temp\text.txt'
filetype = ' '
IMPORTING
filelength = fleng
TABLES
data_tab = text_tab
EXCEPTIONS
file_write_error = 1
invalid_type = 2
no_authority = 3
unknown_error = 4
OTHERS = 10.
thanks -
GUI_Upload & GUI_Download for excel files
Hi experts,
I want to upload excel file into sap. i am trying with GUI_Upload function module. when i see the data it is filled with # and other special char. When i save the excel file as .txt file and then read the txt file. Now i am getting correct data. Is it possible to read Excel data using GUI_UPLOAD directly without changing .xls to .txt.
Also, how to change data in second or third tab of excel file using GUI_Download.
-RKHi
Actually ur file selection s wrong.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FNAME'
STATIC = 'X'
MASK = '*.txt'
CHANGING
FILE_NAME = P_FNAME
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2.
Upload:
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = LV_FNAME
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = IT_UEXBANK01
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. -
i want to upload some records from the flat file to internal table. when i use GUI_UPLOAD function module in tables parameter i have given the work area. but when i use CL_GUI_FRONTEND_SERVICES-=>FILE_OPEN_DIALOG and then CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD i have given the internal table body in the changing parameters. my doubt is we have used GUI_UPLOAD in both occassions but when we use GUI_UPLOAD alone we are giving the internal table workarea but when we use it along with class CL_GUI_FRONTEND_SERVICES we are giving the internal table body. whats is the reason or logic behind this?.
Hi guys -- the answers you've given are correct but an example IMO is 100% better
go_guiobj type ref to cl_gui_frontend_services., "For Windows file dialog
form load_data using e_file type string
e_table.
field-symbols <int_table> type standard table.
assign e_table to <int_table>.
if go_guiobj is initial.
create object go_guiobj.
endif.
call method go_guiobj->gui_download
exporting
filename = e_file
filetype = 'ASC'
write_field_separator = 'X'
changing
data_tab = <int_table>.
endform
* For Directory look up service (Windows)
at selection-screen
on value-request for p_direct.
search_path = p_direct.
perform directory_lookup using search_path.
if not gv_folder is initial.
p_direct = gv_folder.
endif.
form directory_lookup using directory type string.
if go_guiobj is initial.
create object go_guiobj.
endif.
call method go_guiobj->directory_browse
exporting
window_title = 'Select Directory'
initial_folder = directory
changing
selected_folder = gv_folder.
endform. "directory_lookup
Cheers
jimbo -
Hi,
I wrote a program which used GUI_UPLOAD functionality. Now the security guy says that this is not allowed as per SOX and we need to find a alternate way for uploading data.
Can you please suggest me what options do I have.
Regards
VijayHi,
you can use ws_upload and upload functional modules.anyways ws_upload became obsolete.so you can try using upload.
regards,
deepthi reddy -
What is difference between WS_UPLOAD and GUI_UPLOAD
Dear gurus,
Because my office implement SAP for a long time ago so some programs contain WS_UPLOAD function and I find that is obsolete so I want to know what is different or benefit if I modify program to use GUI_UPLOAD function instead of WS_UPLOAD function
If you have related document please give me the link.
Thank you,Hi,
WS_Download Function module is used in 4.6 c version and it is obsolete.From 6 version u need to use
GUI_Download.
WS_DOWNLOAD is obsolete function module for storing SAP data in a file in the file system of the presentation server.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = ' '
CODEPAGE = ' '
FILENAME = ' '
FILETYPE = 'ASC'
MODE = ' '
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = lt_datatab
FIELDNAMES =
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11
Now you ave to use method or function module GUI_DOWNLOAD
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
BIN_FILESIZE =
FILENAME = lv_filename
FILETYPE = 'ASC'
APPEND = SPACE
WRITE_FIELD_SEPARATOR = SPACE
HEADER = '00u2032
TRUNC_TRAILING_BLANKS = SPACE
WRITE_LF = 'X'
COL_SELECT = SPACE
COL_SELECT_MASK = SPACE
DAT_MODE = SPACE
CONFIRM_OVERWRITE = SPACE
NO_AUTH_CHECK = SPACE
CODEPAGE = SPACE
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = SPACE
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = SPACE
WK1_N_SIZE = SPACE
WK1_T_FORMAT = SPACE
WK1_T_SIZE = SPACE
IMPORTING
FILELENGTH =
CHANGING
DATA_TAB = lt_datatab
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
NOT_SUPPORTED_BY_GUI = 22
ERROR_NO_GUI = 23
others = 24
Thanks,
Anitha -
Field-Symbols and Gui_upload
Hi all!
I'm making a program in which a user can choose between 5 tables to update it by uploading a text file.
The thing is that I don't want to make 5 different functions in which the only difference is the name of the table where de gui_upload function puts the data.
That's why I send to the function the name of the table and assign it to a field symbol.
The problem is that I don't know what to put in the parameter 'DATA_TAB' on the gui_upload function.
Thanks!
Best regards!
Alejandro.Hi Ale,
I hope this will be useful,
REPORT zkb_test1.
PARAMETERS: p_table(30) TYPE c.
DATA: li_filetable TYPE filetable,
lw_filetable TYPE file_table,
lv_filename TYPE string,
lv_rc TYPE i.
File Open Dialog to select the PDF document
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Choose PDF File'
file_filter = '.'
CHANGING
file_table = li_filetable
rc = lv_rc
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
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 the returned file name
READ TABLE li_filetable INTO lw_filetable INDEX 1.
IF sy-subrc NE 0.
MESSAGE 'Error' TYPE 'E'.
ENDIF.
DATA: li_rawtab TYPE STANDARD TABLE OF raw255,
lv_len TYPE i.
DATA: lw_pdfdata TYPE xstring.
DATA: dref TYPE REF TO data.
FIELD-SYMBOLS: <fs_table> TYPE ANY TABLE.
CREATE DATA dref TYPE TABLE OF (p_table).
ASSIGN dref->* TO <fs_table>.
lv_filename = lw_filetable-filename.
Read the docuemnt into internal table
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = lv_filename
filetype = 'ASC'
IMPORTING
filelength = lv_len
CHANGING
data_tab = <fs_table>
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
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards
Kathirvel -
GUI_UPLOAD error conversion 'u00E7'
Hi,
I have a file to upload to an internal table and i use GUI_UPLOAD function, i already try with filetype ASC and DAT but the words with CHAR 'Ç' as convert in 'A#' increase one CHAR in line on my internal table.
Anyone could help me.
Thanks and Regards,
Eduardo PaivaHi Eduardo,
I don't know if you wrote wrong only here or in your abap code too, but the code page is 1160, not 1106.
You can see this number with the FM NLS_GET_FRONTEND_CP
DATA: t_file TYPE STANDARD TABLE OF string.
DATA: v_frontend_cp TYPE cpcodepage,
v_codepage TYPE abap_encod.
CALL FUNCTION 'NLS_GET_FRONTEND_CP'
EXPORTING
langu = sy-langu
* FETYPE = 'MS'
IMPORTING
frontend_codepage = v_frontend_cp
EXCEPTIONS
illegal_syst_codepage = 1
no_frontend_cp_found = 2
internal_or_db_error = 3
others = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
v_codepage = v_frontend_cp.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\temp.txt'
filetype = 'ASC'
codepage = v_codepage
TABLES
data_tab = t_file
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.
Not sure if it solve your problem.. but try it anyway
Paulo. -
Regarding Function modules and methods
Hi,
which of these calls to GUI_UPLOAD is more efficient?
CALL METHOD cl_gui_frontend_services=>gui_upload
or
CALL FUNCTION GUI_UPLOADboth does the same job. if you look at the code inside the method cl_gui_frontend_services=>gui_upload
it would be calling GUI_UPLOAD function.
in terms of performance efficiency, there will be a very negligible differece and call function will be slightly better in my opinion.
Regards
Raja
Maybe you are looking for
-
I am using Adobe Flex Builder 3 on Windows 7. When I got to export a release build to publish the project, the bin-release folder does not get all necessary files. All of the .mxml files are not copied to the folder. This just started happening ou
-
Can i transfer my passport to g drive?
I transferred photos from my old imac to my passport, now i got a new imac and i wanna load the pictures up from my passport, but i bought a bigger g drive to store them, can i go from my passport to g drive or do i have to go via my imac.. i have
-
Purchase order list(list of all tables that efect when i entered a po)
is there any script ,to know what all tables will effect when i entered po deatils and i approve that etc.. if any list is there can any one tell me please. regards satish.
-
How to create po through batch run
Hi, how to create po through batch run (through background job) Prashanth
-
Photoshop download stuck at 90%?
MY download for CC Photoshop in the Creative Cloud is stuck at 90% and I cannot figure out how to cancel the download at all.