READ DATASET fails!
Hi,
data: dsn(95) value '/usr/sap/U6B/D85/work/jana10'. "dsn data is filled by another program
DATA: BEGIN OF STR,
STLNR LIKE STZU-STLNR,
CNTRL,
END OF STR. " this is a pure character type structure
OPEN DATASET DSN IN TEXT MODE FOR OUTPUT ENCODING UTF-8.
READ DATASET DSN INTO STR.
Read always fails in here with subrc = 4.
Any idea what i have to change to get this working?
Thanks,
Ashvini.
Hello Ashvini
Combine ... FOR OUTPUT... with ...TRANSFER... and
... FOR INPUT... with ...READ DATASET...
Regards
Uwe
Similar Messages
-
Upload xml file from aplication server using read dataset, parser error.
Hi,
I would like to upload xml file from app. server but parser failed. If I upload this xml file from workstation (using ws_upload) it is correct. For uploading xml file from app. server I use open dataset... read dataset. In loop section I remove '#' char. How do You upload xml file from app server? What Could be incorrect.
I try to open dataset in binary mode, text mode...
TYPES: BEGIN OF xml_line,
data(255) TYPE c,
END OF xml_line.
DATA: gt_xml_table TYPE TABLE OF xml_line,
gs_xml_structure TYPE xml_line,
gv_xml_table_size TYPE i.
OPEN DATASET s FOR INPUT IN BINARY MODE.
IF sy-subrc <> 0.
MESSAGE e001(zet) WITH '....'.
ENDIF.
DO.
READ DATASET s INTO gs_xml_structure.
IF sy-subrc <> 0.
EXIT.
ELSE.
len = STRLEN( gs_xml_structure ).
len = len - 1.
check len > 0.
WRITE gs_xml_structure(len) TO gs_xml_structure.
APPEND gs_xml_structure TO gt_xml_table.
ENDIF.
ENDDO.You Can do this too
parameters: p_file like rlgrap-filename.
data: subrc like sy-subrc.
create object me.
REFRESH t_data.
* Open XML File
CALL METHOD me->CREATE_WITH_FILE
EXPORTING
filename = p_file
RECEIVING
retcode = subrc.
* Saves Data in an itab from XML File.
CALL METHOD me->get_data
IMPORTING
retcode = subrc
CHANGING
dataobject = t_data[].
Regards,
Claudio. -
Open dataset fails...says "error opening input file"
Hi,
I am trying to open a file in my BDC program and get the following error "error opening input file". Its a text file with continuous data. No delimiters and hence character count will be used to parse the data.
I am using the following statement to open it..
OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
but sy-subrc is set to 8 !!
what could be the problem ??
thanksThis is pretty confusing !!I would explain to you my exact issue !!
I have a program in which there is no GUI_UPLOAD call but just a direct open dataset statement !!
This program runs fine for my collegue who has the file in a server (not the application server). She gives the full path name as
servername\foldername\filename.
I tried doing the same but as I did not have access to that server, it failed. So I received that file from her and stored it in my local system. So on program execution, i gave the path as c:\filename and I got the error message "Error opening the file"
Find below some code extracts..
PARAMETERS : p_sname TYPE d0100_mapn ,
p_file(136) TYPE c ,
FORM open_file .
*open file in textmode
OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
DO.
Read the file data and tranfer to workarea to internal table
READ DATASET p_file INTO x_legacy_rec.
Please help in debugging this issue !!
thanks -
Problem with READ DATASET when reading file from app server
Hi,
wondering if anyone can help, I'm using the following code to read from a file on app server, the file is of type .rtf
OPEN DATASET file_rtf FOR INPUT IN TEXT MODE
ENCODING DEFAULT
WITH SMART LINEFEED.
DO.
READ DATASET file_rtf INTO string.
IF SY-SUBRC = 0.
EXIT.
ENDIF.
ENDDO.
the open dataset part works sy-subrc = 0, but the read returns sy-subrc = 8 and no data is passed to string.
Any ideas as to what is causing this problem appreciated, <removed>
Thanks
Edited by: Thomas Zloch on Mar 17, 2010 3:57 PM - please don't offer p...Hi Adam,
The source code in the below link has details about how to read/write to application server.
[Application server file operartions|http://www.divulgesap.com/blog.php?p=NDk=]
Please let us know if you have any issues.
Regards,
Ravi -
My computer is T61 (8891CT), but Blue Screen came out and reported--unmountable boot volume. I ran the diagnostic program and got the error code 0000: Read verification failed. I can’t run anything now including the restore and rescue. Has the hard drive died?
If the hard drive has died, I have to change the hard drive, but how to transfer the system (I don’t have any CD) and think vantage software? Thank you very much for you help.Hi equalefk,
Yes, definitely sounds like it's time to replace the HDD.
Hope it helps.
Maliha (I don't work for lenovo)
ThinkPads:- T400[Win 7], T60[Win 7], IBM 240[Win XP]
IdeaPad: U350
Apple:- Macbook Air [Snow Leopard]
Did someone help you today? Compliment them with a Kudos!
Was your question answered today? Mark it as an Accepted Solution!
Lenovo Deutsche Community Lenovo Comunidad en Español
Visit my YouTube Channel -
Not able to get file from application server with read dataset
Hi,
Firstly i download a file from application server from read data set and then i sent this file as attachment. But problem is that i am able to send .jpg .bmp file but i am not able to send .pdf or .doc file so what can i do for that. ?
My code is like below...
DATA : PATH TYPE STRING.
DATA: E_FILE LIKE RLGRAP-FILENAME.
CONCATENATE '/tmp/' NAME_WITH_EXT INTO E_FILE SEPARATED BY SPACE.
CONDENSE E_FILE NO-GAPS.
IF EXTENSION = 'TXT'.
OPEN DATASET E_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT WITH WINDOWS LINEFEED . " MESSAGE MSG.
IF SY-SUBRC <> 0.
WRITE: SY-SUBRC, MSG, ' LIKE ', C_FNAME.
ELSE.
WHILE SY-SUBRC = 0.
READ DATASET E_FILE INTO WA_C.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
APPEND WA_C TO IT_C.
ENDWHILE.
CLOSE DATASET E_FILE.
ENDIF.
ELSE.
OPEN DATASET E_FILE FOR INPUT IN BINARY MODE. " ENCODING DEFAULT. " INPUT IN BINARY MODE . " TEXT MODE ENCODING NON-UNICODE.
IF SY-SUBRC = 0.
DO .
READ DATASET E_FILE INTO GS_PDF_TAB.
IF SY-SUBRC = 0.
APPEND GS_PDF_TAB TO GT_PDF_TAB.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET E_FILE.
ENDIF.
ENDIF.
Regards,
Gurprit Bhatiadelete this line DEFAULT WITH WINDOWS LINEFEED and check this..
-
# problem while reading dataset from application server.
hi all,
I uplodaed a text file which is tab delimeted, to the application server using transaction code cg3z directly. now that file is stored with # in place of tab(space) in application server.
my broblem is that when i am reading that file using READ DATASET its comming with that # symbol also.
how i split that dataset .
or if there is any other solution ,like openning file into another mode,
help me.
thank uouHi Pawan..
you can access the Tab character using CL_CHAR_ABAP_UTILITIES=>HORIZONTAL_TAB
Do like this After READ DATASET.
DATA : V_RECORD(100).
DO.
READ DATASET P_FILE INTO V_RECORD.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
SPLIT V_RECORD INTO FIELD1 FIELD2 SEPARATED BY <b>CL_CHAR_ABAP_UTILITIES=>HORIZONTAL_TAB.</b>
<<<<further operations here>>>>
ENDDO.
reward if Helpful.
<b></b> -
Reading File from Application Server using Read Dataset
Hi,
i am trying to read excel file from Application Server and has multiple records in that based on structure below. but when i execute its giving me error message.here is the code, can sumone suggest me on this please ??
FORM f_data_upload .
DATA:
l_filename TYPE string, "file name
l_wa_string TYPE string. "file record
l_filename = p_inp_as. "File path from Application Server
OPEN DATASET l_filename FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
IF sy-subrc <> 0.
EXIT.
ENDIF.
Read the data from the file in Application server.
READ DATASET l_filename INTO l_wa_string.
IF sy-subrc = 0.
SPLIT l_wa_string AT cl_abap_char_utilities=>horizontal_tab
INTO w_data-tcode
w_data-matnr
w_data-mtart
w_data-werks
w_data-vkorg
w_data-vtweg
w_data-lgort
w_data-meins
w_data-maktx
w_data-spart
w_data-kosch
w_data-mstae
w_data-brgew
w_data-ntgew
w_data-groes
w_data-matkl
w_data-prdha
w_data-mstde
w_data-mtpos_mara
w_data-gewei
w_data-spart
w_data-mstav
w_data-mstdv
w_data-dwerk
w_data-taxkm
w_data-versg
w_data-kondm
w_data-ktgrm
w_data-mtpos
w_data-mtvfp
w_data-tragr
w_data-ladgr
w_data-herkl
w_data-ekgrp
w_data-webaz
w_data-dismm
w_data-beskz
w_data-prctr
w_data-bklas
w_data-bwtty
w_data-vprsv
w_data-verpr
IN CHARACTER MODE.
APPEND w_data TO i_data.
CLEAR w_data.
ENDIF.
ENDDO.
CLOSE DATASET l_filename.
Error Message while executing
What happened?
At the conversion of a text from codepage '4110' to codepage '4102':
- a character was found that cannot be displayed in one of the two
codepages;
- or it was detected that this conversion is not supported
The running ABAP program 'ZHDI_LOMM_VEHI_MAT_MASS_CREATE' had to be terminated
as the conversion
would have produced incorrect data.
The number of characters that could not be displayed (and therefore not
be converted), is 449. If this number is 0, the second error case, as
mentioned above, has occurred.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was not
caught in
procedure "F_DATA_UPLOAD" "(FORM)", nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
Characters are always displayed in only a certain codepage. Many
codepages only define a limited set of characters. If a text from a
codepage should be converted into another codepage, and if this text
contains characters that are not defined in one of the two codepages, a
conversion error occurs.
Moreover, a conversion error can occur if one of the needed codepages
'4110' or '4102' is not known to the system.
If the conversion error occurred at read or write of screen, the file
name was '/usr/sap/interfaces/conversion/pioneer/ddm/data/test_data1.xls'.
(further information about the file: "X 549
24064rw-rw----200812232135082008122307293120081223072931")
Please help me
Thank YouWoah ... perfect guru
but data looks like all junk characters ? its filling with special characters, hashes # and other characters but not with Excel data.. any idea ??
Temesh
Edited by: New2Sap Abap on Dec 24, 2008 6:42 AM -
Hi Friends,
I'm getting problem in reading only 100 records from the application server using the READ DATASET statement. The file on the application server may have 8000 records but i wanted to get only 100 records and process them. Then i wanted to get next 100 records from the file stored on app.server and process and so on.
After I get the 100 records, I wanted to do further operations such as putting them into a custom table.
Will the below code work?
DATA l_item(100) type c.
*Open the .DAT file for reading
OPEN DATASET p_file1 FOR INPUT IN TEXT MODE ENCODING UTF-8 MESSAGE
x_error.
IF sy-subrc NE 0.
*An error occured during opening the dataset !
MESSAGE x_error TYPE 'E'.
CLEAR x_error.
ENDIF.
DO.
*Read the .DAT file into an internal table
READ DATASET p_file1 INTO l_item.
IF sy-subrc EQ 0.
*split the records into data fields based on delimiter ','
*then append the current record to an internal table
SPLIT l_item AT ',' INTO
x_item-inv_item_id
x_item-intl_aa_nbr
x_item-intl_pba_nbr
x_item-intl_ta_nbr
x_item-intl_product_code
x_item-descr254
x_item-intl_stck_id
x_item-awr_disallowed_flg
x_item-returnable_flg
x_item-fulfillment_flg
x_item-refund_only_flg
x_item-prod_returnable_flg
x_item-stock_cat_id.
APPEND x_item TO i_item.
CLEAR x_item.
ELSE.
*Data was read and the end of the file was reached
MESSAGE i006.
EXIT.
ENDIF.
ENDDO.Hi,
If you want to process every 100 records once, you can in ways.
1.
DO.
*Read the .DAT file into an internal table
READ DATASET p_file1 INTO l_item.
IF sy-subrc EQ 0.
*split the records into data fields based on delimiter ','
*then append the current record to an internal table
SPLIT l_item AT ',' INTO
x_item-inv_item_id
x_item-intl_aa_nbr
x_item-intl_pba_nbr
x_item-intl_ta_nbr
x_item-intl_product_code
x_item-descr254
x_item-intl_stck_id
x_item-awr_disallowed_flg
x_item-returnable_flg
x_item-fulfillment_flg
x_item-refund_only_flg
x_item-prod_returnable_flg
x_item-stock_cat_id.
APPEND x_item TO i_item.
CLEAR x_item.
lv_count = lv_count + 1.
if lv_count = 100.
perform process 100 records.
clear: lv_count, x_items.
refresh x_items.
endif.
ELSE.
*Data was read and the end of the file was reached
MESSAGE i006.
EXIT.
ENDIF.
ENDDO.
2. Download all records into an internal table once.
then loop internaltable.
data: lv_count type i,
lv_count1 type i,
lv_previous type i.
lv_count = lv_count + 1.
lv_count1 = lv_count1 + 1.
if lv_count1 < = 100.
copy 100 records into another internal table2.
else.
lv_previous = lv_count - lv_previous.
if lv_previous = 100.
process records.
clear: lv_count1, internal table2.
refresh internal table2
endif.
endif.
endloop.
regards,
Ganesh -
I installed itunes and quick time but when I try to open itunes I get a message that reads "quicktime failed to initialize (error -2096). I have removed both itunes and quicktime from my computer and re-installed them and I still get the same message. What do I do to get itunes to work?
That one is often a compatibility mode problem. Try the following document, only be sure that none of the boxes in the compatibility mode tab are checked (not just the compatibility mode box itself):
iTunes for Windows: How to turn off Compatibility Mode -
Error on line read dataset p_zfile into it_int
hi while executing this below code..
open dataset p_zfile for input in text mode ENCODING DEFAULT.
if sy-subrc = 0.
v_one = 1.
do.
v_no = v_no + 1.
*read dataset pzfile into it_record*_ this is giving short dump as below
code to read file
end do
short dump
the following error is being prompted
CONVT_CODEPAGE
CX_SY_CONVERSION_CODEPAGE
A character set conversion is not possible.
At the conversion of a text from codepage '4110' to codepage '4103':
- a character was found that cannot be displayed in one of the two
codepages;
- or it was detected that this conversion is not supported
where
it_record is type infile_struct,
and infile_struct is as below
types: begin of infile_struct,
data(1150) type c,
end of infile_struct.
and p_zfile is used in fm call file_get_nam
please suggest this code is working fine in 4.6 c not upgraded to SAP ECC 6.0 this error is occuring in the code
regarda
arorahere is code
open dataset p_infile for input in text mode ENCODING DEFAULT.
f sy-subrc = 0.
v_one = 1.
do.
v_no = v_no + 1.
read dataset p_infile into in_record. if sy-subrc = 0. here dump is occuring at last record i deleted the last record in the file but again the dump comes on last record only when all records are read and finally when the cursor come to read dataset statement last time
if v_no <> v_one.
split in_record at v_tab into wa_record-idno
wa_record-stonumber
wa_record-stolineno
wa_record-sched_line
wa_record-pur_group
wa_record-frmplant
wa_record-frmstglocatin
wa_record-toplant
wa_record-tostglocation
wa_record-material
wa_record-matdesc
wa_record-quantity
wa_record-dockdate
wa_record-splinst1
wa_record-splinst2
wa_record-splinst3
wa_record-splinst4
wa_record-delete
wa_record-block. -
Read dataset - read data randomly
Dear All,
I am facing a strange problem while reading data through READ DATASET statement.
The data is getting read randomly from the file.
For example, if my text file contains 10,000 records, i am able to see around 800 in my internal table.
Also, with read dataset statement, sometimes first record gets read, second time fifth record and so on. There is no particular order.
Read dataset statement is skipping a lot of records while reading data from the file.
Has anyone face this problem earlier?
Any clue in this direction will be highly appreciated.
Many thanks.
Best Regards,
TarunHi,
how you are looking your input file, if it is in NOTEPAD check menu option 'Format----> Word wrap' is unchecked and then see the how many entries are there in the file.
Regards,
Sreeram. -
i have to read an excel sheet from the application server into an internal table that i hv created.can you help me to write select query &read dataset statement?
suppose the internal table name is T_a and it has fields f1 to f7 which are all present in the excel sheet.
<REMOVED BY MODERATOR>
Thanks in advance,
Anand.
Edited by: Alvaro Tejada Galindo on Feb 14, 2008 2:33 PMHi
select f1 f2 f3 f4 f5 f6 f7
from TABLE
into table T_a.
read table T_a with key f1 = <val1>.
<REMOVED BY MODERATOR>
Regards,
Mansi.
Edited by: Alvaro Tejada Galindo on Feb 14, 2008 2:33 PM -
Upload read dataset only one line
hi all
i have a problem, i want to upload a file from applikation server. When i want to read dataset into a xstring field,
it read only the first line not all why?
here is my code
type-pools dset.
data lf_filename type string value '/opt/interface/indtrans/d58_sst/integrale/output/PLU.plu'.
data lf_line type xstring.
data lf_str_line type string.
data lf_hex_code type swxmlcont.
data lt_attr type dset_attributes.
start-of-selection.
open dataset lf_filename for input in binary mode.
do.
read dataset lf_filename into lf_line.
if sy-subrc <> 0.
exit.
else.
* get dataset lf_filename attributes lt_attr.
append lf_line to lf_hex_code.
endif.
enddo.
close dataset lf_filename.
thx abap_begin....that to be functional, but when i read with the file with cl_gui_frontend_services=>gui_upload with file Typ "BIN"
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
FILENAME = l_filename
FILETYPE = 'BIN'
* HAS_FIELD_SEPARATOR = SPACE
* HEADER_LENGTH = 0
IMPORTING
FILELENGTH = l_size
* HEADER =
CHANGING
data_tab = lt_data
EXCEPTIONS
FILE_OPEN_ERROR = c_not_found
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
GUI_REFUSE_FILETRANSFER = 7
others = 99.
i becam a other result then, when i read with
open dataset lf_filename for input in binary mode.
why?
Now i have a idea, i read the file value in text mode and save this in an internal table.
Then make the loop over table, and convert the value in identical princple such as cl_gui_frontend_services=>gui_upload with the filetype "BIN".
I dont' know, how you do this?
thx abap_begin -
Explain why READ DATASET conversion from codepage '4110' to codepage '4102'
I am unfamiliar with unicode but I am trying to solve a problem in an ABAP program.
Our code is
OPEN DATA p_in FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET p_in INTO i_tab.
The program gives me the error 'At the conversion of a text from codepage '4110' to codepage '4102'. The program abends on a line in the file that contains the special character '#'.
Does this mean that the file I am reading is in codepage '4110' and the internal format of i_tab is codepage '4102'? If so, how do the codepages get assigned to unix files and internal structures How can I make the both codepage '4110' or codepage '4102'? Also, what is the difference between these two codepages?
thanks.
Ryan
MyHi,
Use
open dataset DSN in text mode for input encoding utf-8.
a®
Maybe you are looking for
-
Profile value per_person_id is not listed for $PROFILE$ block
Hi All, I have reqirement to retrive the person_id to default Employee number in Personal analysis descriptive flex filed segment. When i tried using $PROFILES$.PER_PERSON_ID or fnd_profile.value('PER_PERSON_ID') is not working for me. Then i have ch
-
Best practice for maintaining URLs between Dev, Test, Production servers
We sometimes send order confirmations which include links to other services in requestcenter. For example, we might use the link <href="http://#Site.URL#/myservices/navigate.do?query=orderform&sid=54>Also see these services</a> However, the service I
-
HTML5 to Android quiz very slow.
I have a 32 questions quiz created in CP7 (with no random questions) and outputted it to HTML5 and then used ' apps packager ' and 'phonegap' to create the Android .apk app file. Installed it in my phone and also in my tablet via USB and it worked gr
-
Integrating Outlook with Form 6
I want to integrate MS Outlook with my application running on Forms 6. From the database in Oracle, user should be able to send email directly by clicking on the email id field of the database. i.e. on clicking on the email id field, Outlook should o
-
Hey all, I got a MySQL server running remotely, the connection is running fine. Im currently using netbeans and I have the database in the Services tab ready to go. Can anyone tell me how I can bind a table in the database to a JTable? Thanks Kyle G