Doubt in GUI Upload
Hi All,
I am using function module as follows to upload orders to database.File is created in required format on given path with same name as c:\va01.txt.
But when i run my program its showing exception as "CANNOT INTERPRETE DATA IN FILE"
What can be the problem?We usually upload same type of file and data in file is correct.Can anybody suggest me the solution or atleast tell me what could be the problem.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\VA01.txt'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = '#'
TABLES
DATA_TAB = IT_ORDER.
hi,
check that, in the flat file, what field separator u have give, u need to give a tab space.
as the data in flat file n the internal table structure r not matching, thats why ur getting that error.
so, make sure that the flat file structure, i mean the order of fields, field separator are correct. then the function module u given is correct, instead of giving field-separator as # give 'X'.
hope this may solve ur problem.
reward if helpful.
Similar Messages
-
HI all pls give me diff btwn upload ws_upload and GUI Upload
HI All,
pls give me difference between
upload
ws_upload and
GUI Upload
Thanks & regards .
Bharat KumarHi,
WS_* Function modules are replaced by GUI_* FMs from 4.7 SAP version.
GUI_* modules have additional parameters when compared with WS_* FMs.
Both FM are used for uploading data .
But ws_upload is obsolete now .
WS_UPLOAD and WS_DOWNLOAD, the function modules used until now are not part of the standard set of ABAP commands. They are used to display the file interface on the presentation server. WS_UPLOAD and WS_DOWNLOAD are not compatible with USs and have been replaced by GUI_UPLOAD and GUI_DOWNLOAD.
The new function modules, GUI_UPLOAD and GUI_DOWNLOAD, have an interface that also allows you to write Unicode format to the local hard drive. For a description of these interfaces, refer to the documentation for each function module, available under SAP Easy Access " Development " Function Builder " Goto " Documentation.
WS_UPLOAD, GUI_UPLOAD FMs are used in BDCs.
WS_UPLOAD loads files from the Presentation Server to Internal ABAP Tables.
This is used upto SAP 4.6 version.
GUI_UPLOAD is used to loads a file from the PC to the server. The data can be
transferred in binary or text format. Numbers and data fields can be
interpreted according to the user settings.
You can check this for some info
http://help.sap.com/saphelp_erp2005/helpdata/en/79/c554a3b3dc11d5993800508b6b8b11/frameset.htm
http://www.sapdevelopment.co.uk/file/file_otherpc.htm
Regards,
Priyanka. -
Problem while uploading data with GUI UPLOAD Function
Hi,
I am facing problem while uploading data with FM GUI UPLOAD in out text file there are 7 row but after the FM GUI UPLOAD there are 14 entries are coming in Internal table and each alternate row is coming as blank with 0000 in some column in internal table first row is proper and second line is blank so on.
what can be the problem .
The program in which we are using this we are using it from last 2 year but we are facing problem today only.
regards,
zafarHi,
The file formate is same as it is from last two years it is automatically generated by one another bar code server and there is no change in the file formate.
So waht can be the problem to check any inconsistancy in system i have develop a samll program fro uploading a text file with same function module , but it is working fine.
regards,
zafar -
HI ,
I am using GUI upload function and i get the data into table and i want to move this data to field type string how can i do that ?
Regards
Joy
DATA: gt_itab TYPE STANDARD TABLE OF char2048.
START-OF-SELECTION.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = gs_file
CHANGING
data_tab = gt_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
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.Hi,
Refer following code
types : BEGIN OF ty_s_download,
data TYPE string, "Tax Data
END OF ty_s_download.
G L O B A L D A T A D E C L A R A T I O N S
*Global Internal tables
DATA : gt_download TYPE STANDARD TABLE OF ty_s_download. "Download data
LOOP AT gt_tax_data INTO ls_tax_data.
Pass All the tax data to screen output table
ls_output-bukrs = ls_tax_data-bukrs.
ls_output-state = ls_tax_data-state.
ls_output-store = ls_tax_data-store.
ls_output-tax_type = ls_tax_data-tax_type.
ls_output-tax_rate = ls_tax_data-tax_rate.
ls_output-discount_amount = ls_tax_data-discount_amount.
lv_discount = ls_tax_data-discount_amount.
lv_tax_rate = ls_output-tax_rate.
Calculate Gross tax due
ls_output-gross_due = ls_tax_data-report_amount.
lv_gross_due = ls_output-gross_due.
IF NOT ls_tax_data-tax_rate IS INITIAL.
Calculate Taxable Purchase
ls_output-purchase = ls_output-gross_due / ls_tax_data-tax_rate.
ELSE.
ls_output-purchase = 0. "Default it to zero if the tax_rate is zero.
ENDIF.
lv_purchase = ls_output-purchase.
Calculate Net Tax Due
ls_output-net_due = ls_output-gross_due - ls_tax_data-discount_amount.
lv_net_due = ls_output-net_due.
Concatenate all field values
CONCATENATE ls_output-bukrs
ls_output-state
ls_output-store
ls_output-tax_type
lv_purchase
lv_tax_rate
lv_gross_due
lv_discount
lv_net_due
INTO ls_download-data
SEPARATED BY lc_tab.
Append all the downloaded tax data
APPEND ls_download TO gt_download.
Clear work areas
CLEAR : ls_output,
ls_tax_data,
ls_download,
lv_purchase,
lv_discount,
lv_tax_rate,
lv_net_due,
lv_gross_due.
ENDLOOP.
Regards,
Prashant -
How to upload (.txt) file by using GUI Upload?
I tried to upload .csv file in using GUI upload and it works.
THIS IS MY SAMPLE CODE.
CLEAR w_rawfile.
DESCRIBE TABLE i_rawfile LINES v_read. "Counter for records read
Condense w_rawfile-field.
Separate header record from detail records
LOOP AT i_rawfile INTO w_rawfile.
IF sy-tabix = 1. "header is always the first record
SPLIT w_rawfile-field AT ' ' INTO
w_header_file-name1
w_header_file-name2
w_header_file-name3
w_header_file-cntry
w_header_file-address1
w_header_file-address2.
APPEND w_header_file TO i_header_file.
CLEAR: w_header_file.
ELSE. "succeeding records are detail records
SPLIT w_rawfile-field AT ',' INTO
w_inputfile-nachn
w_inputfile-vorna
w_inputfile-nach2
w_inputfile-land1
w_inputfile-stras
APPEND w_inputfile TO i_inputfile.
ENDIF.
IF i try to replace my file into a .txt format. An error occurs. Please kindly give me the code to do this correctlt. ThanX!Reading Data from Presentation Server (Dialog)
To read data from the presentation server into an internal table with a user dialog, use the function module UPLOAD. The most important parameters are listed below. For more information, refer to the function module documentation in the Function Builder (Transaction SE37).
Important Import Parameters
Parameters
Function
CODEPAGE
Only for upload under DOS: Value IBM
FILENAME
Filename (default value for user dialog)
FILETYPE
File type (default value for user dialog)
ITEM
Title for dialog box
Use the FILETYPE parameter to specify the transfer mode. Possible values:
BIN
Binary files
ASC
ASCII files: Text files with end of line markers.
DAT
Excel files, saved as text files with columns separated by tabs and lines separated by line breaks.
WK1
Excel and Lotus files saved as WK1 spreadsheets.
Important Export Parameters
Parameters
Function
FILESIZE
Number of bytes transferred
ACT_FILENAME
Filename (as entered in the user dialog)
ACT_FILETYPE
File type (as entered in the user dialog)
Tables Parameters
Parameters
Function
DATA_TAB
Internal table (target for the import)
Exceptions Parameters
Parameters
Function
CONVERSION_ERROR
Error converting data
INVALID_TABLE_WIDTH
Invalid table structure
INVALID_TYPE
Incorrect FILETYPE parameter
Suppose the presentation server is running under Windows NT, and contains the following Excel file:
If this table is saved as a text file "D:\temp\mytable.txt" with tabs between the columns, the following program can read the table:
PROGRAM SAPMZTST.
DATA: FNAME(128), FTYPE(3), FSIZE TYPE I.
TYPES: BEGIN OF LINE,
COL1(10) TYPE C,
COL2(10) TYPE C,
COL3(10) TYPE C,
END OF LINE.
TYPES ITAB TYPE LINE OCCURS 10.
DATA: LIN TYPE LINE,
TAB TYPE ITAB.
CALL FUNCTION 'UPLOAD'
EXPORTING
CODEPAGE = 'IBM'
FILENAME = 'd:\temp\mytable.txt'
FILETYPE = 'DAT'
ITEM = 'Read Test for Excel File'
IMPORTING
FILESIZE = FSIZE
ACT_FILENAME = FNAME
ACT_FILETYPE = FTYPE
TABLES
DATA_TAB = TAB
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3.
WRITE: 'SY-SUBRC:', SY-SUBRC,
/ 'Name :', (60) FNAME,
/ 'Type :', FTYPE,
/ 'Size :', FSIZE.
SKIP.
LOOP AT TAB INTO LIN.
WRITE: / LIN-COL1, LIN-COL2, LIN-COL3.
ENDLOOP.
The program displays the following dialog box:
Here, the user can change the default values. When the user chooses Transfer, the system imports the data from the file D:\temp\mytable.txt into the internal table TAB.
The output appears as follows:
SY-SUBRC: 0
Name : d:\temp\mytable.txt
Type : DAT
Size : 69
Billy the Kid
My Fair Lady
Herman the German
Conan the Barbarian
The contents of the internal table TAB are exactly the same as the contents of the original Excel table. -
hi,
when i upload a file using gui upload Function module , the dot in the excel sheet gets converted into 'e' . is there any other Function module i can use to do that .
Thanks,
AmitHI,
You need to USe the FM <b>'ALSM_EXCEL_TO_INTERNAL_TABLE'</b>
*& Report UPLOAD_EXCEL *
*& Upload and excel file into an internal table using the following *
*& function module: ALSM_EXCEL_TO_INTERNAL_TABLE *
REPORT UPLOAD_EXCEL no standard page heading.
*Data Declaration
data: itab like alsmex_tabline occurs 0 with header line.
* Has the following format:
* Row number | Colum Number | Value
* i.e. 1 1 Name1
* 2 1 Joe
TYPES: Begin of t_record,
name1 like itab-value,
name2 like itab-value,
age like itab-value,
End of t_record.
DATA: it_record type standard table of t_record initial size 0,
wa_record type t_record.
DATA: gd_currentrow type i.
*Selection Screen Declaration
PARAMETER p_infile like rlgrap-filename.
*START OF SELECTION
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = p_infile
i_begin_col = '1'
i_begin_row = '2' "Do not require headings
i_end_col = '14'
i_end_row = '31'
tables
intern = itab
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
message e010(zz) with text-001. "Problem uploading Excel Spreadsheet
endif.
* Sort table by rows and colums
sort itab by row col.
* Get first row retrieved
read table itab index 1.
* Set first row retrieved to current row
gd_currentrow = itab-row.
loop at itab.
* Reset values for next row
if itab-row ne gd_currentrow.
append wa_record to it_record.
clear wa_record.
gd_currentrow = itab-row.
endif.
case itab-col.
when '0001'. "First name
wa_record-name1 = itab-value.
when '0002'. "Surname
wa_record-name2 = itab-value.
when '0003'. "Age
wa_record-age = itab-value.
endcase.
endloop.
append wa_record to it_record.
*!! Excel data is now contained within the internal table IT_RECORD
* Display report data for illustration purposes
loop at it_record into wa_record.
write:/ sy-vline,
(10) wa_record-name1, sy-vline,
(10) wa_record-name2, sy-vline,
(10) wa_record-age, sy-vline.
endloop.
See the Below wxamples to uploa the excel file
http://www.sapdevelopment.co.uk/file/file_upexcel.htm
http://www.sap-img.com/abap/upload-material-master-finish-goods.htm -
Batch Input Recording - GUI Upload Function
Hello,
i want to record a batch input.
Within the recording a Gui Upload Function is called, so that the user have to select a file from the local disk, which should be uploaded into the system. That step wasn't recorded by the bach input recording.
Is there any soluion for that?
Regards,
TomSdAs Suhas said, these kind of UI dialogs cannot be handled by batch input technology.
Sometimes transactions allow the batch input by displaying another kind of UI dialog that is allowed. Try to record using "simulate background mode", maybe the program will display another UI dialog. Make sure also to untick the "no BI mode" checkbox.
But maybe this transaction isn't planned to be used in batch input at all (which transaction do you need to record?). In that case, the only solution is maybe eCATT (with external tool connected as I am aware). -
Hi Friends,
I have created a GUI Status for a Report program.
I have written the functionalities for Application Tool bar.
But i have not written any thing for my Functional Keys having Standard Tool bar will the keys in the standard tool bar will work as normal or it will get deactivated.
Reward is sure.
Thanks,
GokulHi Gokul,
If you are setting a PF status for a report then menu items and functional keys in the standard toolbar gets deactivated and depending upon ur requirement u can activate keys.
And if you want to activate the functional keys back, exit and cancel give the function codes as BACK, %EX and RW respectively in the PF Status you have defined and Activate the PFstaus.
Now these functional keys start working normally and you need not write any code for these to work.
If you want clarifications futher let me know.
Reward me if useful.
Regards
Sandhya -
Hello Folks,
My requirement is that i will scan documents in some application server and when clicked on the link in WDA the scan document need to displayed it can be either TIF or PDF format containing more than 1 page.
I dont not need any upload element on the screen. For testing i tried uploading a file from my desk top using Function Module GUI_UPLOAD and i get an error while executing this FM saying "Access via 'NULL' object reference not possible".
the function call is as below, please suggest if there is something wrong with the call or if ther is another approach to do this. Thanks.
TYPES : BEGIN OF ty_doc ,
raw(64) TYPE x,
END OF ty_doc.
DATA : lt_doc TYPE TABLE OF ty_doc,
lf_doc TYPE ty_doc,
l_size TYPE i.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\Documents and Settings\user\Desktop\doc.tif'
filetype = 'BIN'
IMPORTING
filelength = l_size
TABLES
data_tab = lt_doc
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 I understand what you want to do is import a file into your WebDynpro application then the method to be followed is as shown below.
>Steps:
>> 1. Right click on the application you are creating.
>> 2. Follow the menu option: Create->Mime Objects -> Import
>> 3. You will get a popup with the header SAP Custom-Open File Menu
>> 4. Choose the file you want to import and click on Open
>> 5. You will get a new document for Creating New Document. Enter description and click on Save .
>> 6. Choose the Package and save. Your file will be stored under the same application under MIMEs.
If what you want is to import a file into the system, and not to the WebDynpro application, then you can
>> 1. go to SE80.
>> 2. Choose MIME Repository. Open a folder where you want to import the file.
>> 3. Right Click on the folder that you desire to import the file to. Menu: Import MIME Objects.
>> 3. Repeat the steps 3 - 6. -
Hi experts,
While uploading PO data using BAPI, In Itemx table all the fields uploading will have x but item field should have value? why it is?Hi,
With the ITEMSX you tell the bapi which fields are to be inserted or changed. If you don't set the x the values of the fields from ITEMS are not taken into account.
Regards,
Bert -
GUI upload with filetype .xlxs
Hi,
I need to upload .xlxs files using GUI_upload function module.
It doesn't support it.
Please suggest some approach to use it.
Regards,
Kshitijaneed to upload .xlxs files using GUI_upload function module
GUI_UPLOAD doesn't provide the functionality for uploading .xlxs file. Although i'm not sure of this FM KCD_EXCEL_OLE_TO_INT_CONVERT but you can take a chance.
Why do you need a .xlsx file? Even you can convert it to .xls. -
Gui Upload and Line Feed within a CSV cell from Excel
Hi all,
I am facing the problem that my CSV file to be uploaded via GUI_UPLOAD is containing cells where the Excel user has split the line within the cell. So there are CRLF at the end of the CSV row and single LF within a cell between the field separators.
GUI_UPLOAD is not making a difference and splits the line within the cell.
Is there any solution for this?
Thanks in advance for hints.
AxelHi Axel,
I didn't know that it was considering CRLF and LF the same way. A workaround is to do the job yourself: call GUI_UPLOAD using BIN format (you'll get the characters as bytes), get the frontend encoding (cl_gui_frontend_services=>GET_SAPLOGON_ENCODING), then convert the bytes into characters using CL_ABAP_CONV_IN_CE class (see documentation), and split (statement SPLIT AT) the characters at cl_abap_char_utilities=>cr_lf to get each line, then split each line at cl_abap_char_utilities=>horizontal_tab.
BR
Sandra -
difference between ws_upload and gui_upload
hi sunil,
WS_UPLOAD and WS_DOWNLOAD, the function modules used until now are not part of the standard set of ABAP commands. They are used to display the file interface on the presentation server. WS_UPLOAD and WS_DOWNLOAD are not compatible with USs and have been replaced by GUI_UPLOAD and GUI_DOWNLOAD.
The new function modules, GUI_UPLOAD and GUI_DOWNLOAD, have an interface that also allows you to write Unicode format to the local hard drive. For a description of these interfaces, refer to the documentation for each function module, available under SAP Easy Access " Development " Function Builder " Goto " Documentation.
Instead of using the function modules, you can use the static methods GUI_UPLOAD and GUI_DOWNLOAD of the global class CL_GUI_FRONTEND_SERVICES.
~~Guduri -
Hello friends,
I have data in the text file and when I use this FM it says bad format data.
DATA: BEGIN OF i_stru_tab OCCURS 0,
pernr LIKE p0001-pernr,
prozt LIKE p1001-prozt,
otype LIKE p1001-otype,
plans LIKE p1001-objid,
orgeh LIKE p1001-objid,
kostl LIKE p0001-kostl,
stell LIKE p1001-objid,
begda LIKE p1001-begda,
endda LIKE p1001-endda,
END OF i_stru_tab.
PARAMETERS: ps_file4 LIKE rlgrap-filename DEFAULT 'c:\HR\ZCNV0008.txt' LOWER CASE,
PERFORM upload_local_file4.
FORM upload_local_file4 .
DATA: p_file14 TYPE string.
p_file14 = ps_file4.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_file14
filetype = 'ASC'
TABLES
data_tab = i_stru_tab
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.
When I execute the code I see data only for the first field of the first row and all the fields are 0.00 and i dont see any records from second row onwards.
Below is the data in the text file.
25310000100.00S 5000001300000000 500000112001083199991231
25312951100.00S 5000001300000000 500000112003080199991231
25313427100.00S 5000001300000000 500000112003060199991231
Thanks,
Raju.use option has_field_separator = 'X'
and separate the fields with tabulations in the text file.
How did you got that file?
You made it with gui_download or are you getting it from an independent source?
Edited by: Ramiro Escamilla on Feb 8, 2008 3:30 PM -
Doubt on Good movements using BAPI'S for Uploading
Hi Experts,
i am doing a bdc program to upload for mb1a transaction using BAPI..I am new to BAPI area..But with some reference i have finished the program..But i dont know why in clear statement and in gui upload showing error..IN gui upload when i activate the exception its throwing error..Hereby i am pasting the code...Any idea pls share with me..
<removed by moderator>
I dont know how to make the code show correctly...any help???????
Regards
Karthick
Moderator message: please post only relevant code parts, observe the maximum of 5000 characters per post to preserve formatting, leave out commented lines, etc.
Edited by: Thomas Zloch on Feb 10, 2011 6:05 PM
sorry moderator...it will not happen again..
my scenario is like this i ahve to upload the serial number with respect to the quantity in unit of measure..i am not getting any idea on this..for example if the quantity for the material is 5 then it has to upload five serial numbers...
please help me on this!!!!!!!!
regards
Karthick
Edited by: karthicksap on Feb 12, 2011 5:25 AMHi kris,
Finally i finished the coding..its working fine...but now its throwing material is not maintained in plant..checked with that..but material is maintained there..i dont know why its throwing the error..i checked with debugging and i found that its taking the last serial number only..for every material..my flatfile is like this..
11.01.2011 11.01.2011 abc 9051 5101 stbdx300 3 600001 0 1000000000000001
11.01.2011 11.01.2011 abc 9051 5101 stbdx300 3 600001 0 1000000000000002
11.01.2011 11.01.2011 abc 9051 5101 stbdx300 3 600001 0 1000000000000003
any idea kris.>?????
regards
Karthick
Maybe you are looking for
-
I didn't succeed in updating my Itunes.
I didn't succeed in updating my Itunes on my Windows PC (Windows 7). Therefore I removed the Itunes application and would reinstall. But when I get to install - Start Services I get the following message: Service "Apple Mobile Device" failed to star
-
How to obtain the encoding scheme for an XML document
How do you go about reading the encoding scheme for an XML document?? More specifically how do I read the line: <?xml version="1.0" encoding="UTF-8"?> (Using Win32 C++ XML Parser 2.0.3 as SAX). null
-
Field Symbols : pros and cons
Field Symbols are used where in ABAP programming. Any pros and cons of using them in our program?
-
ERROR MASSAGE 47:01, PLEASE HELP ME, URGENT
TO ALL WHO EXPERT IN HP DESIGNJET T610, NOW IM FACING PROBLEM WITH MY PLOTTER, ONE ERROR MASSAGE APPEAR ON DISPLAY SCREEN. MASSAGE SHOW NO 47.01 ERROR, WHAT THATS MEAN? AND PLEASE SHOW ME THE WAY AND HELP ME TO SOLVE THE PROBLEM. THANK YOU FOR YOUR
-
Adobe Standard Profile for D800 vs D700
Adobe Standard profile for the D800 appears to be a better color match to the Camera profiles for the D800 than Adobe Standard for the D700 color match to it's Camera profiles. I notice that the D800 Adobe Standard Profile is a larger files (118KB)