File_open_error with GUI_UPLOAD
Hi All !
I would like to upload the file which is under the path /interfaces/DEC120/Synchrolink/in in our SAP server.
I use in the abap program :
fic1 = '/interfaces/DEC120/Synchrolink/In/mv_slr.asc'.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = fic1
filetype = 'ASC'
TABLES
data_tab = wt_zinvslr
EXCEPTIONS
but I have an error open file in return.
If I change the path by : fic1 = 'C:\mv_slr.asc'
it works...
I checked the autorisations and all seems be ok.
Anyone has an idea ?
Thanks in advance,
Sandrine
Edited by: CHRISTIAN MEYER on Jul 6, 2010 5:51 PM
Hi !
Thanks for your help ! I use open dataset ....
it works !!
best regards,
Sandrine
Similar Messages
-
How to update a dbf file with gui_upload???
hi friends,
i would like to know how to update a dbf file with gui_upload???
as i hve already know that it's easy to convert dbf to tab formatted text fle and thn upload it.but i want the direct uploading way.i don't let my user's bsy with converting existing dbf to txt.so pls help me asap!!!!!i will be thankful to you!!!!!its very easy you can search other forum!!!
-
Problem with GUI_UPLOAD using excel sheet
Hi,
I am trying to upload excel sheet thru GUI_UPLOAD ... this excel sheet has a header line and 3 line of data. Even if I remove the header line then also the internal while debugging is showing 28 lines of entries with "#" "squares" in some columns ... while in others where data should be there shows all Zeros....
The excel sheet has the following info
Rate Type Valid From Date From Currency To Currency Indirect Quote Direct Quote
M 29.09.2006 SGD USD 1.6932
M 29.09.2006 USD SGD 1.6932
M 29.09.2006 SGD MYR 2.19653
KURST GDATU FCURR TCURR INUKURS DUKURS
###ࡱ |########|#####|### #| 0.00000 |0.00000 |
##29 |00000000| | | 0.00000 |0.00000 |
o#d# |00000000| | | 0.00000 |0.00000 |
The code that I am writing is as follows:-
*& INTERNAL TABLES
DATA : BEGIN OF T_INPUT occurs 0,
KURST LIKE TCURV-KURST, " Exchange rate type
GDATU LIKE SY-DATUM, " Date from which rate is effective
FCURR LIKE TCURC-WAERS, " From currency
TCURR LIKE TCURC-WAERS, " To currency
INUKURS LIKE TCURR-UKURS, " Indirect Quote
DUKURS LIKE TCURR-UKURS, " Direct Quote
END OF T_INPUT.
S T A R T - O F - S E L E C T I O N *
START-OF-SELECTION.
Perform to upload the excel file.
PERFORM UPLOAD_EXCEL_FILE.
FORM UPLOAD_EXCEL_FILE .
DATA: L_FILENM TYPE STRING.
L_FILENM = P_FILENM.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = L_FILENM
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = T_INPUT
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.Hi SB,
pls change the data type declared for 'valid from date'
from
DATA : BEGIN OF T_INPUT occurs 0,
KURST LIKE TCURV-KURST, " Exchange rate type
<b>GDATU LIKE SY-DATUM,</b> " Date from which rate is effective
FCURR LIKE TCURC-WAERS, " From currency
TCURR LIKE TCURC-WAERS, " To currency
INUKURS LIKE TCURR-UKURS, " Indirect Quote
DUKURS LIKE TCURR-UKURS, " Direct Quote
END OF T_INPUT.
to
DATA : BEGIN OF T_INPUT occurs 0,
KURST LIKE TCURV-KURST, " Exchange rate type
GDATU(10) type c, " Date from which rate is effective
FCURR LIKE TCURC-WAERS, " From currency
TCURR LIKE TCURC-WAERS, " To currency
INUKURS LIKE TCURR-UKURS, " Indirect Quote
DUKURS LIKE TCURR-UKURS, " Direct Quote
END OF T_INPUT.
Cheers,
Vikram
Please reward for helpful replies!! -
Bdc upload file data into internal table problem with gui_upload fm
Hello experts,
my coding is like this ..
data : begin of itab occurs 0 .
field1 like mara-matnr,
field2......
etc,
end of itab.
data: file1 type string.
parameter :file like rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
static = 'X'
mask = space
field_name = 'FILE'
CHANGING
file_name = file.
START-OF-SELECTION.
FILE1 = FILE . "HERE I AM PASSING INTO STRING
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = FILE1
FILETYPE = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = itab. " here the data is not populating from the file , it is giving the error like speified table not found.
HERE i am getting the message like "specified table name not recgonised" . the data is not populating into the itab from the file.
file structure is same as the internal table.
I stored the file as .txt( ie in notepad).
my file is like this..
10000 200 323 sunndarrr.......
i had a problem with this bdc , i am getting like "specified table name not recgonised" in the fm gui_upload while debugging.
when i am using the ws_upload it is working fine.
please guide me where i have done the mistake.
thank you so much for all the replies.Hi,
Have a look on the following code.
TABLES: kna1.
DATA: BEGIN OF itab1 OCCURS 0,
str(255),
END OF itab1.
DATA: itab2 TYPE kna1 OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = 'D:\ABAP EVE\ffile1.txt'
filetype = 'ASC'
TABLES
data_tab = itab1
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
no_authority = 10
OTHERS = 11.
IF sy-subrc <> 0.
WRITE:/ 'sorry'.
ELSE.
LOOP AT itab1.
SPLIT itab1-str AT ',' INTO itab2-kunnr itab2-name1.
APPEND itab2.
ENDLOOP.
IF sy-subrc = 0.
LOOP AT itab2.
WRITE:/ itab2-kunnr,itab2-name1.
INSERT INTO kna1 VALUES itab2.
ENDLOOP.
IF sy-subrc = 0.
WRITE:/ 'inserted'.
ELSE.
WRITE:/ 'not inserted'.
ENDIF.
ELSE.
WRITE:/ 'fail'.
ENDIF.
ENDIF.
Flat file:
10001,Sadney
10003,Yogesh
20005,Madan
1.U need to define internal table with one field of max size
2.upload the flat file data into that internal table
3.split that internal table data into another internal table(having fields)
<REMOVED BY MODERATOR>
thanks,
Chandu
Edited by: Alvaro Tejada Galindo on Apr 30, 2008 12:17 PM -
Upload local TRU file with GUI_UPLOAD in ECC6
Hi all,
i need to upload a file with no "CR/LF" characters in a migration project from 46C to ECC6 system
in 46C, the FM WS_UPLOAD is working well :
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = ' '
filename = input_f1
filetype = 'TRU'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = '300'
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = ITAB_IN
EXCEPTIONS
This FM is obsolete in ECC6 and the GUI_DOWNLOAD FM populates only one line of the internal table. It means only 300 characters
and all the remaining file is ignored :
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = input_f1
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = ITAB_IN
EXCEPTIONS
Can any one tell me how can i read such file entirely in my internal table??
Thank youTry changing your code as this sample code snippet:
TYPES: BEGIN OF ex_upload,
record(800) TYPE c,
END OF ex_upload.
DATA: ex_itab TYPE STANDARD TABLE OF ex_upload,
wa_upload TYPE ex_upload.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_file1
filetype = 'ASC'
* HAS_FIELD_SEPARATOR = 'X'
TABLES
data_tab = ex_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 -
Problem with GUI_UPLOAD
Hey Folks,
I need to convert the excel data into inernal table
types : begin of ty_data,
matnr type matnr,
exbwr type exbwr,
text type c,
end of ty_data.
This is my excel file.
6249 10 prabhas
6249 56 Dude
6249 57 Rockstar
6249 80 Babu
6249 90 Bhaiyya
6249 250 Munna
6249 35 Rocky
6249 75 Hero
6249 789 Prankster
data : filename type string.
filename = p_file.
call function 'GUI_UPLOAD'
exporting
filename = filename
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = it_data
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.
when I m using this FM i m getting the error as Bad_DATA_FORMAT i have also checked the FM ALSM_EXCEL_INTERNAL_TABLE but both seems not to be working in my case. Can somebody tell me where its gong wrong.
Thanks
Rocktry to convert/save the excel file into tab delimited text file, and then try using GUI_UPLOAD
call function 'GUI_UPLOAD'
exporting
filename = filename
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X' "<---use this -
Excel data transfer into SAP internal table with GUI_UPLOAD
hi all,
i m using SRM4 system and i wanted to develop one report which will upload data from excel and convert it into IT.
i know that many threads are posted on this topic.
but my requirement is slight different. in the system only one function module is available that is "GUI_UPLOAD" and we want that user shd not save file as tab delimited before calling this fm. instead, program shd take care of all these things...
please suggest something asap..
helpful ans will be rewarded..
thanks,
jigs.Dear Jigs,
Please go though the following lines of code:
D A T A D E C L A R A T I O N *
TABLES: ANEP,
BKPF.
TYPES: BEGIN OF TY_TABDATA,
MANDT LIKE SY-MANDT, " Client
ZSLNUM LIKE ZSHIFTDEPN-ZSLNUM, " Serial Number
ZASSET LIKE ZSHIFTDEPN-ZASSET, " Original asset that was transferred
ZYEAR LIKE ZSHIFTDEPN-ZYEAR, " Fiscal Year
ZPERIOD LIKE ZSHIFTDEPN-ZPERIOD, " Fiscal Period
ZSHIFT1 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 1
ZSHIFT2 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 2
ZSHIFT3 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 3
END OF TY_TABDATA.
Declaration of the Internal Table with Header Line comprising of the uploaded data.
DATA: BEGIN OF IT_FILE_UPLOAD OCCURS 0.
INCLUDE STRUCTURE ALSMEX_TABLINE. " Rows for Table with Excel Data
DATA: END OF IT_FILE_UPLOAD.
S E L E C T I O N - S C R E E N *
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME,
BEGIN OF BLOCK B2 WITH FRAME.
PARAMETERS: P_FNAME LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN: END OF BLOCK B2,
END OF BLOCK B1.
E V E N T : AT S E L E C T I O N - S C R E E N *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = 'X'
MASK = '.'
CHANGING
FILE_NAME = P_FNAME
EXCEPTIONS
MASK_TOO_LONG = 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.
E V E N T : S T A R T - O F - S E L E C T I O N *
START-OF-SELECTION.
Upload Excel file into Internal Table.
PERFORM UPLOAD_EXCEL_FILE.
Organize the uploaded data into another Internal Table.
PERFORM ORGANIZE_UPLOADED_DATA.
E V E N T : E N D - O F - S E L E C T I O N *
END-OF-SELECTION.
*& Form UPLOAD_EXCEL_FILE
text
--> p1 text
<-- p2 text
FORM UPLOAD_EXCEL_FILE .
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FNAME
I_BEGIN_COL = 1
I_BEGIN_ROW = 3
I_END_COL = 7
I_END_ROW = 32000
TABLES
INTERN = IT_FILE_UPLOAD
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " UPLOAD_EXCEL_FILE
*& Form ORGANIZE_UPLOADED_DATA
text
--> p1 text
<-- p2 text
FORM ORGANIZE_UPLOADED_DATA .
SORT IT_FILE_UPLOAD BY ROW
COL.
LOOP AT IT_FILE_UPLOAD.
CASE IT_FILE_UPLOAD-COL.
WHEN 1.
WA_TABDATA-ZSLNUM = IT_FILE_UPLOAD-VALUE.
WHEN 2.
WA_TABDATA-ZASSET = IT_FILE_UPLOAD-VALUE.
WHEN 3.
WA_TABDATA-ZYEAR = IT_FILE_UPLOAD-VALUE.
WHEN 4.
WA_TABDATA-ZPERIOD = IT_FILE_UPLOAD-VALUE.
WHEN 5.
WA_TABDATA-ZSHIFT1 = IT_FILE_UPLOAD-VALUE.
WHEN 6.
WA_TABDATA-ZSHIFT2 = IT_FILE_UPLOAD-VALUE.
WHEN 7.
WA_TABDATA-ZSHIFT3 = IT_FILE_UPLOAD-VALUE.
ENDCASE.
AT END OF ROW.
WA_TABDATA-MANDT = SY-MANDT.
APPEND WA_TABDATA TO IT_TABDATA.
CLEAR: WA_TABDATA.
ENDAT.
ENDLOOP.
ENDFORM. " ORGANIZE_UPLOADED_DATA
In the subroutine --> ORGANIZE_UPLOADED_DATA, data are organized as per the structure declared above.
Regards,
Abir
Don't forget to award points * -
Hello All,
I am using the function module GUI_UPLOAD for uploading a notepad (tab delimitted). My file consists of 3000 records. I have passed the parameters filetype as 'ASC' and separator as 'X'.
When I am trying to upload the file it is taking too much time and results in ABAP dump (Time Out).
I have found that there is one record which is causing the problem. I have removed that record and uploaded. This time it got uploaded fine. But when I compare this record with other records, I didn't find any difference.
The same file is gettng uploaded when I use the FM 'UPLOAD'. But this is taking much time.
Length of the record in the file is 4809. I guess this is not the issue, because I have uploaded files which is having a record length of 7500.
Thanks in Advance,
Kishore.Hi,
Don't use UPLOAD it is obsolete which is replaced by GUI_UPLOAD.As far as the Dump is considered there can be a minor issue with data format.These are rare issues.
Just check to download using :
CLASS:CL_GUI_FRONTEND_SERVICES
METHOD:GUI_UPLOAD
regards,
Gurpreet -
Double quotes issue with GUI_UPLOAD
Hello Gurus,
I'm uploading a tab delimited file from my PC using GUI_UPLOAD. I've a description field (Char 40) in my input file which contains characters like double quotes or commas or single quotes. Whenever there is a comma or a double quote in the desc field in my input file, the field value is uploaded into the program as the actual value with double quotes in front of the value and at the end of the value.
Say if I'm uploading <b>steel 1"</b>, then it is uploaded into the program as <b>"steel 1""</b>. Any ideas why is this and how to fix it.
JJAppreciate ur answer Anand. I want to know why I get the value with double quotes in front of it and towards the end of it. I know that I can get rid of the extra double quotes with offsetting and replace statement...Thats not what I was expecting. I want to know why the extra double quotes are coming into the picture.
FYI, I'm on ECC 6.0 and the snippet of my code is:
DATA: lv_file TYPE string.
lv_file = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_file
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = itab_file. -
File upload interface with gui_upload
Hi Experts,
I am trying to use the method GUI_UPLOAD of the class CL_GUI_FRONTEND_SERVICES.
But the problem is I am not getting a dialog box where we can select the file by browsing our computer.( like the browse button in Windows).
I remember getting this dialog box when using the FM WS_UPLOAD.
But this is obsolete and cannot use in Unicode programs.
What should I do? and how?
can anybody help me?
Thanks in advance.
Goldie.May be this way
* At selection screen event *
at selection-screen on value-request for p_file1.
perform f_get_f4_filename using p_file1 changing p_file1.
* Form f_get_f4_filename *
* For F4 help for file name *
form f_get_f4_filename using pfile changing pfile1.
* Private Variables
data :v_subrc type i.
refresh : i_file1. clear i_file1.
call method cl_gui_frontend_services=>file_open_dialog
exporting
window_title = 'Select Files'
default_extension = '*.xls'
default_filename = '*.xls'
initial_directory = 'c:'
multiselection = ' '
changing
file_table = i_file1
rc = v_subrc
exceptions
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
others = 5.
if sy-subrc eq 0.
loop at i_file1 assigning <fs>.
pfile1 = <fs>.
exit.
endloop.
else.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " F_get_f4_filename
a® -
Reading a text file with GUI_UPLOAD
Hello,
I'm trying to read a text file into an internal table of text lines using GUI_UPLOAD. The problem is that I can only read a maximum of 255 characters from each line. So for example, if the first line in the text file contains 260 characters, I lose the last 5 characters of that line.
Any ideas on how to read the ENTIRE contents of a text file into an internal table of text lines? I'd really appreciate any help!
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = 'c:\example.txt'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = SPACE
HEADER_LENGTH = 0
DAT_MODE = SPACE
CODEPAGE = SPACE
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
READ_BY_LINE = 'X'
IMPORTING
FILELENGTH =
HEADER =
CHANGING
data_tab = int_textline
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.
error handling
ENDIF.
thanks,
AhmadHi Ahmad,
The function module can take more that 255 characters. Just follow the declaration Raja suggested. It is working for me.
DATA: BEGIN OF it_datatab OCCURS 0,
row(500) TYPE c,
END OF it_datatab.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'c:\test.txt'
filetype = 'ASC'
TABLES
data_tab = it_datatab
EXCEPTIONS
file_open_error = 1
OTHERS = 2.
Thanks
Vinod -
Problems reading in with gui_upload
Dear forum members,
when I try to read in the text file with the FM gui_upload it doesn`t do exactly what I want!? My code is as follows:
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filetype = 'ASC'
filename = 'C:\Dokumente und Einstellungen\Sabani\Desktop\Projekt_N-Ergy\Textdateien\652316.dat'
READ_BY_LINE = 'X'
filename = h_files
TABLES
data_tab = it_itab.
LOOP AT it_itab INTO wa_itab.
*Kopfzeile
atab = wa_itab+0(laenge_a).
atab = wa_itab(laenge_a).
SHIFT wa_itab BY laenge_a PLACES.
APPEND atab TO lt_btab.
*Datenblock
WHILE wa_itab+0(4) NE '0128' AND wa_itab IS NOT INITIAL.
ls_btab = wa_itab+0(laenge_b).
ls_btab = wa_itab(laenge_b).
APPEND ls_btab TO lt_btab.
SHIFT wa_itab BY laenge_b PLACES.
ENDWHILE.
ENDLOOP.
The text file I`m trying to read in is a DTAUS format that you give to the bank. That means that there are no special signs that work as field seperators. Fields in that format are descreibed by their length.
Here`s the example of the complete file that has to be read in:
0128AGK7605010100000000N-ERGIE 240310 00044182030000652316 25032010 10245C76050101720800010118106300000000000000051000 0000000000076050101000441820300008251885 LEW VERTEILNETZ GMBH N-ERGIE 1 0202ES WURDE EIN AVIS ERSTELLT.02ZAHLBELEGNR 030405851565 0245C76050101770500000302103403000000000000051000 0000000000076050101000441820300000036162 STADTWERKE BAMBERG ENERGIE N-ERGIE 1 0202ES WURDE EIN AVIS ERSTELLT.02ZAHLBELEGNR 030405851566 0245C76050101518500790050077713000000000000051000 0000000000076050101000441820300000001800 OVAG NETZ AG N-ERGIE 1 0202ES WURDE EIN AVIS ERSTELLT.02ZAHLBELEGNR ......0000000000076050101000441820300000756821 SUEDSACHSEN NETZ GMBH N-ERGIE 1 0202ES WURDE EIN AVIS ERSTELLT.02ZAHLBELEGNR 030405851606 0128E 0000044000000000000000000009496764710000000024615318150000025462810
And here`s what I get with my code:
0128 A GK760501 01000000 00N-ERGIE 240310 0 00441820 3000065231 6 25032010 1
0245 C 76050101 72080001 0118106300 0000000000000 51 000 00000000000 76050101 0004418203 00008251885 LEW VERTEILNETZ GMBH N-ERGIE 1 02 02 ES WURDE EIN AVIS ERSTELLT. 02 ZAHLBELEGNR 030405851565
0245 C 76050101 77050000 0302103403 0000000000000 51 000 00000000000 76050101 0004418203 00000036162 STADTWERKE BAMB
Any ideas???
Edited by: Imer Sabani on May 12, 2010 11:31 AM
Edited by: Imer Sabani on May 12, 2010 11:32 AMHi dieter,
1. U already have the answer.
2. User settings are important.
3. If the user settings are ,
then the file data has to be in comma.
4. If we want to use the user settings explicitly,
then we have to use DAT_MODE
DAT_MODE = 'X'.
regards,
amit m. -
hi,
Iam uploading the data using GUI_UPLOAD
the file type im using is .CSV type and is having more than 255 char per record /row
and hence all the data is not being uploaded ....
any advise on the same to get all the data in the file into internal table
thanksREPORT DOWNLOAD_FILE_CSV.
DATA:
BEGIN OF FS_SPFLI,
CARRID TYPE SPFLI-CARRID,
CONNID TYPE SPFLI-CONNID,
COUNTRYFR TYPE SPFLI-COUNTRYFR,
CITYFROM TYPE SPFLI-CITYFROM,
AIRPFROM TYPE SPFLI-AIRPFROM,
COUNTRYTO TYPE SPFLI-COUNTRYTO,
CITYTO TYPE SPFLI-CITYTO,
AIRPTO TYPE SPFLI-AIRPTO,
FLTIME TYPE SPFLI-FLTIME,
DEPTIME TYPE SPFLI-DEPTIME,
ARRTIME TYPE SPFLI-ARRTIME,
DISTANCE TYPE SPFLI-DISTANCE,
DISTID TYPE SPFLI-DISTID,
FLTYPE TYPE SPFLI-FLTYPE,
PERIOD TYPE SPFLI-PERIOD,
END OF FS_SPFLI.
DATA:
T_SPFLI LIKE
STANDARD TABLE
OF FS_SPFLI.
DATA:
W_CHAR(1000) TYPE C.
DATA:
BEGIN OF FS_TABLE,
CHAR(100) TYPE C,
END OF FS_TABLE.
DATA:
T_TABLE LIKE STANDARD TABLE OF FS_TABLE.
FIELD-SYMBOLS <FS1> TYPE ANY.
SELECT CARRID
CONNID
COUNTRYFR
CITYFROM
AIRPFROM
COUNTRYTO
CITYTO
AIRPTO
FLTIME
DEPTIME
ARRTIME
DISTANCE
DISTID
FLTYPE
PERIOD
INTO TABLE T_SPFLI
FROM SPFLI.
LOOP AT T_SPFLI INTO FS_SPFLI.
DO.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE FS_SPFLI TO <FS1>.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
WRITE <FS1> TO W_CHAR.
IF SY-INDEX EQ 1.
MOVE W_CHAR TO FS_TABLE-CHAR.
ELSE.
CONCATENATE FS_TABLE-CHAR ',' W_CHAR INTO FS_TABLE-CHAR.
ENDIF.
ENDDO.
APPEND FS_TABLE TO T_TABLE.
ENDLOOP.
*LOOP AT T_TABLE INTO FS_TABLE.
WRITE:
/ FS_TABLE-CHAR.
*ENDLOOP.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'd:\files\spfli.csv'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = T_TABLE
FIELDNAMES =
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
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Try this code...... Hope this helps you out...
Regards,
Pavan P -
ZTABLES with GUI_UPLOAD
Dear Gurus,
i have five internal tables, now i'm going to upload those tables in same selection screen though GUI_UPLOAD function.
there internal table formats are totaly diffrent.
my problem is how can i use in one time GUI_UPLOAD function for upload ztables.
<b>
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gd_file
has_field_separator = 'X' "file is TAB delimited
TABLES
data_tab = IT_TABLETYPE
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
</b>
how to assigned diffrent table types to <b> IT_TABLETYPE.</b>Looks like you have not seen my reply.
Inside the perform
PERFORM upload USING IT_TABLE TYPE STANDARD TABLE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gd_file
has_field_separator = 'X' "file is TAB delimited
TABLES
data_tab = IT_TABLE
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
ENDFORM.
Now call this perform passing different tables.
PERFORM UPLOAD USING ITAB1.
PERFORM UPLOAD USING ITAB2.
PERFORM UPLOAD USING ITAB3.
Regards,
Ravi
Note - Please mark all the helpful answers -
Problem with GUI_UPLOAD FM
Hi All,
I have trouble using the FM GUI_UPLOAD. I am using this FM to upload text-delimited file data into an ITAB of same structure. The problem is that it is reading only the 1st record and returning sy-subrc = 8. The no of columns in file is 89. When I am reducing the no of columns of this file, then it is reading the data. There is not data format conversion problem, I have check the same. Does any one know why this is happening? Thanks in advance.
Regards,
Prashant.hi prashant,
try this oops concept.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_v_filepc
filetype = 'TXT'
has_field_separator = ' '
header_length = 0
read_by_line = 'X'
dat_mode = SPACE
codepage = SPACE
ignore_cerr = ABAP_TRUE
replacement = '#'
virus_scan_profile =
IMPORTING
filelength =
header =
CHANGING
data_tab = fp_it_pernr_infty "fp_it_pernr
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.
ENDIF.
Maybe you are looking for
-
How much do battery replacements from Apple cost?
For anyone who's sent there ipod in to Apple for a battery replacement (I have a 5th gen.), how much did it cost? (not under warranty) My batterie's not too bad, but it's definitely not new, and I'll need to replace it in the future. Thanks in advanc
-
Alert: Health Set unhealthy - Clustering
We have SCOM 2012 R2 setup to monitor our Exchange 2013 CU5 enviroment and we have gotten this error message about our Clustering going in to an unhealthy state a couple of times. We have checked the FSW and everything seems OK on its end. I cannot
-
Why is the extracting process taking so long on the download?
Why is the extracting part of the download taking forever I have had it running for two days nearly and it doesn'nt seem to be making any difference, I havent saved it to any other file just default as I have read on other parts of the forum that thi
-
Windows 7 shake-window feature in openbox?
Is there a way to implement the windows 7 shake-window (minimize all except shaken window) feature in openbox?
-
I just made a workflow like this 1. Get selected finder items (template files) 2. Copy finder items (to my working folder) 3. Rename finder items (replacing "Name" with product name) I had several products to do this for, so I just ended up copying t