To read flat file from a unix server
We need to read a flat file from a Unix server, where our Database is located.
The location gets created correctly.
But while we are trying to import files from the location in Design Center , we get an error that "directory does not exists", although the directory has all the permissions.
Can someone please suggest how should we create the location so as it can read the files.
Please Reply ASAP......
We have started Design Center on a local machine(Windows Machine) with uaer as repository owner of the server,
In the design center we can not sample the file till we import it,
can you please tell how to sampe the file without importing it.
Also a location pointing to server location gets easily created on the design center and the file module points to that location only, but when we try to import the file through that location, it says directory does not exists, although oracle user has all the read write permissions on the directory......
Please help!
Similar Messages
-
Problem Reading Flat File from Application server
Hi All,
I want to upload a Flat File which is having a Line Length of 3000.
While uploading it to Application server , only upto 555 length it is getting uploaded .
i am using the code :
DATA: BEGIN OF TB_DATA OCCURS 0,
LINE(3000),
END OF TB_DATA.
*----Uploading the flat file from the Local drive using FM "UPLOAD".
OPEN DATASET TB_FILENAM-DATA FOR OUTPUT IN TEXT MODE." ENCODING DEFAULT.
IF SY-SUBRC NE 0.
WRITE:/ 'Unable to open file:', TB_FILENAM-DATA.
ELSE.
LOOP AT TB_DATA.
TRANSFER TB_DATA TO TB_FILENAM-DATA.
ENDLOOP.
ENDIF.
CLOSE DATASET TB_FILENAM-DATA.
What could be the problem?
Could it be due to any Configuration Problem?
Waiting for your replies.
Thanks and Regards.
SukiYour code looks OK, but you may have touble displaying the full width. Try:
WRITE: /001 TB_FILENAM-DATA+555.
(And don't forget to append your ITAB after each read.)
Rob -
Moving of flat file from the application server after upload.
Hi All,
I am uploading data from a flat file placed on the application server by a BDC program.
After the BDC has created the session i want to transfer the flat file from that folder to another folder on the application server by changing the name of the flatfile.
Can any one suggest the best way of doing this particular scenario?
Thanks in advance.
Regards
Satish Nair.Here is a sample program.
report zrich_0001.
data: d1 type localfile value '/usr/sap/TST/SYS/Data1.txt',
d2 type localfile value '/usr/sap/TST/SYS/Data2.txt'.
data: begin of itab occurs 0,
rec(20) type c,
end of itab.
data: wa(20) type c.
start-of-selection.
open dataset d1 for input in text mode.
if sy-subrc = 0.
do.
read dataset d1 into wa.
if sy-subrc <> 0.
exit.
endif.
itab-rec = wa.
append itab.
enddo.
endif.
close dataset d1.
open dataset d2 for output in text mode.
loop at itab.
transfer itab to d2.
endloop.
close dataset d2.
delete dataset d1.
Regards,
Rich Heilman -
"Bad data format" when reading txt file from the presentation server
Hello,
I have a piece of code which reads a txt file from the presentation server to an internal table like below:
DATA : lv_filename type string.
lv_filename = 'C:\abap\Test.txt'. "I created a folder called abap under C:\
CALL method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
EXPORTING
FILENAME = lv_filename
CHANGING
DATA_TAB = lt_tsd. " lt_tab has the exact same fields as the Test.txt's. Test.txt has only one line, tab delimited.
When running this code, exception BAD_DATA_FORMAT is issued.
Is it because of the file encoding or delimiter or other reason?
Thanks,
YangHello,
If its tab delimited then use the has_field_seperator parameter and check
DATA : lv_filename type string.
lv_filename = 'C:\abap\Test.txt'. "I created a folder called abap under C:\
CALL method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
EXPORTING
FILENAME = lv_filename
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = u2018Xu2019
CHANGING
DATA_TAB = lt_tsd.
Vikranth -
How to create UTL file from on Unix server
Hi,
I have created a stored procedure in Oracle (8.0.6) which will create a flat file using UTL_File. The oracle server is running on unix system.
When I am executing the PL/SQL procedure from Unix's Sql Plus, it is creating the file properly. When I try to execute the same from a windows client using SQL Plus / PLSQL Developer, It is not creating the file.
Any input is worh.
also, pls find below the code I am using.
P_Dir = ' /apps/ullcis/dev/data'
P_File = 'test.log'
dbms_output.put_line('In Create Log File ');
l_file_handle := UTL_FILE.FOPEN(P_Dir,P_File, 'w');
dbms_output.put_line('Opened in Write');
UTL_FILE.PUT_LINE (l_file_handle,'sample text');
UTL_File.fflush(l_file_handle);
UTL_FILE.FCLOSE (l_file_handle);
Regards
SamI'm writing to unix file path not onto the windows client.And i have permission in that unix direcotry to create a file.The above code does well if invoked from sql prompt of unix but it does not create file, if i invoke from sqlplus in windows client. Any help ...?
Thanks -
Dynamic Reading of files from App. Server in LSMW
I am having hundreds of file in a particular directory on application server. I want to execute them without specifying the complete path & filename. Is there any solution for this problem in LSMW?
hi ,
as you are saying all have different headers.
there are two options.
1) if all files have different structures ,then you can create diff internal tables and using open dataset read dataset you can read all files in diff internal tables at the same time.
2) or if all files having the same structure then you can append the same internal table using open datset read dataset statement for all fiels one by one while once execution..
hope this will help u.. -
What are the commands available to read a file from application server and
What are the commands available to read a file from application server and store the file into an internal table?
Hi,
To read a file from an Application Server to an Object there is a command in ABAP called <b>READ DATASET</b>. After that file is transported to that object you have to do a loop and put that data in an Internal Table.
This statement exports data from the file specified in dset into the data object dobj. For dobj, variables with elementary data types and flat structures can be specified. In Unicode programs, dobj must be character-type if the file was opened as a text file.
For dset, a character-type data object is expected - that is, an object that contains the platform-specific name of the file. The content is read from the file starting from the current file pointer. After the data transfer, the file pointer is positioned after the section that was read. Using the MAXIMUM LENGTH addition, the number of characters or bytes to be read from the file can be limited. Using ACTUAL LENGTH, the number of characters or bytes actually used can be determined.
In a Unicode program, the file must be opened with an arbitrary access type; otherwise, an exception that cannot be handled will be triggered.
If the file has not yet been opened in anon-Unicode program, it will be implicitly opened as a binary file for read access using the statement
OPEN DATASET dset FOR INPUT IN BINARY MODE.
. If a non-existing file is accessed, an exception that can be handled can be triggered.
Influence of Access Type
Files can be read independently of the access type. Whether data can be read or not depends solely on the position of the file pointer. If the latter is at the end of the file or after the file, no data can be read and sy-subrc will be set to 4.
Influence of the Storage Type
The import function will take place irrespective of the storage type in which the file was opened with the statement OPEN DATASET.
If the file was opened as a text file or as a legacy text file, the data is normally read from the current position of the file pointer to the next end-of-line marking, and the file pointer is positioned after the end-of-line marking. If the data object dobj is too short for the number of read characters, the superfluous characters and bytes are cut off. If it is longer, it will be filled with blanks to the right.
If the file was opened as a binary file or as a legacy-binary file, as much data is read that fits into the data object dobj. If the data object dobj is longer than the number of exported characters, it is filled with hexadecimal 0 on the right.
If the specified storage type makes conversion necessary, this is executed before the assignment to the data object dobj. Afterwards, the read data is placed, byte by byte, into the data object.
System Fields
sy-subrc Meaning
0 Data was read without reaching end of file.
4 Data was read and the end of the file was reached or there was an attempt to read after the end of the file.
Thanks,
Samantak.
<b>Rewards points for useful answers.</b> -
How to read the file from ftp server
Hi
I need to read a file from a ftp server . Iam using apache lib common-net .jar .
FTPClient ftp = new FTPClient();
ftp.connect(server);
ftp.login(username,password);
FTPFile[] files = ftp.listFiles();
for(int i=0 ;i<files.length;i++){
System.out.println(" File : "+ i + " - " + files);
InputStream ip = ftp.retrieveFileStream(path);
I got the inputstream from the ftp server. but iam not able to read the contents of the file ....
help me plzzzzzHi
I have one more problem . first i try to read the file and write the file in local directory . then i try to read the data in the remote file .. iam getting the datas as null.
InputStream ip = ftp.retrieveFileStream(path);
File f = new File("D:\\ftp.txt");
FileOutputStream fo = new FileOutputStream(f);
byte[] buf = new byte[1024];
while ((len = ip.read(buf)) > 0) {
fo.write(buf,0,len);
fo.close();
BufferedReader br = new BufferedReader(new InputStreamReader(ip));
String line;
do {
line = br.readLine();
System.out.println(" data " +line);
}while (line != null); -
Open Data Set Error while trying to read file from non SAP server
Hi all,
is it possible to read data from non-SAP application Sever?
I'm using OPEN DATASET p_filin FOR INPUT IN LEGACY TEXT MODE CODE PAGE '1504',
Where p_filin is other Windows server.Our applicition server is under Unix.Is it a problem?
I make test to read file from SAP application server and it was ok.So how to call other server?
Thanks!Hi,
Yes it is possible to read data from a non SAP server through the statement OPEN DATASET.
The important thing to check is that the SAP Server got enough access to the non SAP server so it can perform a reading/writing process depending on your needs.
You should contact your network administrator and BASIS to help you check the permissions. This can be pretty tricky, specially if the servers are in different domains.
Regards,
Gilberto Li -
Logical path for getting a Flat file from application server
Hi All,
We have loaded some .csv files to application server, what is the logical path we have to mention in the infopackage scheduler screen? please guide me how to give the path for getting a flat file from application server.
Thanks,
Sairam.Hi Sairam,
I hope you know which location you have saved in the Application server.
Now if you go to the Infopackage and click on the "External Data" tab, there you will see Radio Buttons for
1) Client Workstation
2) Application Server
Choose the second radio button, then in the Field "Name of the File" you will be able to use the F4 help and browse AL11 transaction through this option. You can then choose the File.
Hope this helps
Regards,
Praveen. -
FM to tansfer data in flat file from presentation to application server
Hi Experts,
Please tell the FM to tansfer data in flat file from presentation server to application server or vice versa in ECC 6.0.
Thanks.Hi,
This is how you can achieve it:
1. You read the flat file from presentation layer and store the file content in internal table gt_inrec
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gw_filename
filetype = 'ASC'
IMPORTING
filelength = gw_length
header = gw_header
TABLES
data_tab = gt_inrec
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.
2. Create a new file at the application server:
OPEN DATASET p_ofile FOR OUTPUT IN
TEXT MODE ENCODING DEFAULT.
3. Transfer the content from the internal table into the file at the application server:
LOOP AT gt_inrec.
TRANSFER gt_inrec-record TO p_ofile.
ENDLOOP.
Hope it helps,
Lim.... -
Read XML files from remote server
Post Author: TomDegetel
CA Forum: Data Integration
This question may look simple to you but I don't see directly how to do this.The idea is to read data from an XML file which is sent to a UNIX directory on a server.When the JobServer is running on my local PC I can configure a flow that reads the file from the local harddisk but if the JobServer is running on another server I don't know how to reach this file.How can I connect from the jobserver to a remote server in order to read an xml file and read its contents into a query ? Thanks, TomPost Author: bhofmans
CA Forum: Data Integration
you have several options :
1) Make sure the directory is accessible to your jobserver via shares. This can even be done between Windows and UNIX using SAMBA or related software.
2) Use ftp to get the file from the remote location and ftp it to a local drive (DI had built-in options to do ftp)
3) In 11.7 we added the possibility to specify an URL for the XML file in stead of a file name. So if you can make the XML file available via a web server on the UNIX machine, this would be another way to access the file. -
How to read .xls file from FTP server t oInternal table
Hi
am using the FTP_SERVER_TO_R3 to read xls file from FTP server to internal table
but the data i get in LT_TEXT is special characters.
CALL FUNCTION 'FTP_SERVER_TO_R3'
EXPORTING
handle = hdl
fname = f_name "ProdDataFromCRM.xls.
* CHARACTER_MODE = 'X'
* IMPORTING
* BLOB_LENGTH =
TABLES
BLOB = lt_text
* TEXT = lt_text
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4
can any one help me out to get the exact data..
Really appreciate your quick response..
Thank YouHi, if you really retrieve an excel file, you can not see the data in ABAP. You may see them in Excel. For this you may use
CALL METHOD document->open_document_from_table
of the interface i_oi_document_proxy for OLE objects. You can access the data with reference to the interface i_oi_spreadsheet.
Please check [Desktop Office Integration (BC-CI)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIOFFI/BCCIOFFI.pdf] for details.
But, who knows, perhaps you want "And Now For Something Completely Different".
Regards
Clemens -
Load Flat File from App Server
HI, all.
I want load flat file from appliation server. I created CSV file and loaded it on app. server with FM ARCHIVEFILE_CLIENT_TO_SERVER. After I created datasource and tried load data in the infocube. In this procedure I encountered with two problem
1. When I look file in AL11, I doesn't see cyrillic symbols, instead this symbols I see #.
2. When I try load data with data source, I get exception RS_EXCEPTION 000 "File don't open"
Anybody can help me resolve this problem?
wbr, Fanil.Hi, kodanda pani KV.
2. File is was closed.
1. Can me you clearly explain what you meen?
wbr, Fanil -
Reading file from App. Server - Problem.
Hi All
While Reading a file from Application Server into the Presentation Server, in a Notepad its coming fine(Data is coming in a Multiple lines).
Problem:-
When we try to open the same file with Word Pad, Its showing in a single line. But I want the data to be in a multiple lines
Please help me ASAP.
Thanks
Niranjan.
Edited by: Niranjan Thimmareddy on Feb 28, 2009 12:15 PM
Edited by: Niranjan Thimmareddy on Feb 28, 2009 12:15 PMInstead of reading entire file at a time.Restrict it to some length
Check this link
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3d42358411d1829f0000e829fbfe/content.htm
Maybe you are looking for
-
Hi Guys, good product beginning however it's not as good as many of the other Adobe product's workspaces. I cannot change the size of the view during form design work, so it's a visual strain to work in Forms Central. Is there a way to modify the v
-
Connecting IMAC to HP 6500A Multifunction
I own three Apple computer. IMac latest model, MacBook Air latest model, MacBook late 2008. All running Mountain Lion. All three machines connect via WLAN to a Fritzbox 7390 router (also tried a Time Capsule). I have a HP Officejet 6500A connected to
-
Middle mouse button in FF 4.0, Linux, does not open new url from clipboard
In new version FF 4.0 on Linux, middle mouse button doesn't open url (which is copy from clipboard in Linux style) without http:// prefix. It open url in format "http://www.mozilla.com" but doesn't open "www.mozilla.com". It works properly in previou
-
Moving a iphoto album from one user to another
I have a photo album on my macbook pro under one username. Im trying to move it to another general account that my whole family uses but it wont drag and drop to my shared folder. What can I do??
-
Handling the return values and passing values to a dialog
Dear all, I am trying to return values from a dialog to a page. I am following a tutorial: http://www.oracle.com/technology/products/jdev/101/howtos/adfdialog/index.html its okey, but I couldnt understand the following code: public void handleReturn(