Read local file in background
hi everyone,
i need to read local file in background,
wich function do i need to use?
thanks,
dana.
if you are reading in background file needs to be on application server.
you can use following function modules.
CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE
MESSAGE MSG_TXT.
IF SY-SUBRC NE 0.
WRITE: 'Err', MSG_TXT.
EXIT.
ENDIF.
LOOP AT INT_TAB
*your code
ENDLOOP.
Closing the File
CLOSE DATASET FILENAME.
Similar Messages
-
I need to read local files in C with Alchemy (at least on
developer's machine). This should allow more rapid application
development with Lua Alchemy -- as developer would be able to
exclude swf build step.
I have added directory with my .swf to the FlashTrust config.
I'm able to load the file with URLLoader. However fopen() on it
returns NULL. Please see the attached code.
Executables, compiled with Alchemy (and run with swfbridge),
are able to work with local files. What should I do to allow my
application to work with local files in the same manner?
Alexander.quote:
Originally posted by:
notnick
You have not tried?- funopen ()
returns a FILE pointer.
Just in
samples / libpng
I have not tried it yet
I have tried fopen(), and it does not work (see code in
original post). I would like to get working fopen() (and family)
somehow, so I would be able to get vanilla Lua sources to work with
files.
My other option, of course, is to replace file-related
functions in core Lua libraries. This is not that hard, and even
doable without modifying of Lua sources, but I'd like to avoid this
solution.
UPD: I have looked at the libpng sample. If I get it
correctly, funopen() there operates on ByteArray, not on actual
file. (I have no experience with BSD API, so it was not immediately
clear for me.)
I need to operate on actual file on local file system.
Thank you,
Alexander. -
AccessControlException in signed applet for simply reading local file
I have a simple applet that reads specified local image files and uploads them to our server. On both Mac OS X and WinXP (firefox and IE7), I get the following error. I signed the applet using an InstantSSL code signing certificate (not so easy getting this to work, but I'm pretty confident I did it correctly).
java.security.AccessControlException: access denied (java.io.FilePermission /Users/scott/Documents/photos/Ken_and_Scott.jpg read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
at java.security.AccessController.checkPermission(AccessController.java:427)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
at java.io.File.length(File.java:813)
at org.apache.http.entity.mime.content.FileBody.getContentLength(FileBody.java:89)So just on getting the file length, it's throwing this exception. Interestingly, this file passed both file.exists() and file.canRead() checks within the applet (in windows the path is a bit different of course but also passes both those checks). Also, that file has no read restrictions and I can load it in a browser no problem.
I assume I'm missing a step in the applet code signing process, maybe a step that says I'm allowed to read local files?I figured out my issue, the apache HttpClient library needed to be signed too apparently.
-
Update table form local file as background Job
Hi Expert,
I have a requirement to update a database table through Text file in a background. I am trying to do through OPEN Database to upload the file to Application server and then triggerind a event for background job. please provide method to update the table in background job.
Regards,
Kapil.hi,
if i have understood you can try this:
1) create a custom event with transaction SM62.
2) schedule the update job ( with the update program in its step ) trigging the event set in (1) .
3) execute the program that upload the local file from presentation server to application server . The last istruction of this program has to be the call ot the custom event using BP_event raise fn module in the uplaoad is ok..
4) if the event has been raised, the background job has been executed.
Regards, luigi. -
Exporting Local File in background
Hi,
I want to export a flat file in background mode. I am currently using WS_DOWNLOAD but this doesn't work in background. What I think is that I will save it in UNIX directory. Can you please give some sample codes for this? or if there's still a way using WS_DOWNLOAD to do this in background?
I appreciate your response.
Thanks!Use the transaction CG3Z to upload your file into application server.
Then you can use
open dataset.
transfer dataset.
close dataset.
commands to access that file from application server. -
I use the open dataset for uploading CSV file in background but I get the values with "' and , characters.
What am I doing wrong? Can I get an example ?
Thanks,
RebekaHi,
If I remember correctly, when using OPEN DATASET, the file name can not have spaces in the name. Try renaming your file removing spaces and retry.
For your code, you'll need to breakdown the CSV file by the delimiter.
This code makes an archive file while reading the main file.
OPEN DATASET filname IN TEXT MODE MESSAGE t_mesg.
IF sy-subrc NE 0.
MOVE 'X' TO t_error.
MESSAGE e100(z0) WITH 'Error reading file:' t_mesg.
EXIT.
ENDIF.
IF p_load = 'X'.
OPEN DATASET archfilname FOR OUTPUT IN TEXT MODE MESSAGE t_mesg.
IF sy-subrc NE 0.
MOVE 'X' TO t_error.
MESSAGE e100(z0) WITH 'Error opening achrive file:' t_mesg.
EXIT.
ENDIF.
ENDIF.
DO.
READ DATASET filname INTO my_rec.
IF sy-subrc NE 0.
EXIT.
ENDIF.
IF p_load = 'X'.
TRANSFER my_rec TO archfilname.
ENDIF.
SPLIT my_rec AT c_tab " Here my delimter was a tab change to ',' for comma
INTO in_rec-id
in_rec-fname
in_rec-lname
in_rec-addr
in_rec-apt
in_rec-city
in_rec-state
in_rec-zip
in_rec-branch
in_rec-phone1
in_rec-phone2
in_rec-phone3
in_rec-phone3_ext
in_rec-email
in_rec-hear
in_rec-prefcont
in_rec-ownland
in_rec-build
in_rec-ownhome
in_rec-get_promo
in_rec-cmt1
in_rec-subdate.
APPEND in_rec TO it_input.
ENDDO.
CLOSE DATASET filname.
IF p_load = 'X'.
CLOSE DATASET archfilname.
DELETE DATASET filname.
ENDIF.
ENDIF.
Refer This:
Upload CSV file from Application server
How to Upload/Download '.CSV' file from application Server (AL11) in BI -
Applet can't read local file on web server, security issue!
There is any way to read/write files of web server through the applet except the Signed Applet.
If any idea the reply me soon.
Thanks in advanceApplets are downloaded from web servers and execute on the client machine.
Therefore they have no access to the web server file system, signed or not.
They could have access to the client file system (the machine where they run),
but for security reasons only signed applets have this privilege.
So to answer your question, you sign if you want to access client files.
To access web server files, you don't need to sign the applet, but you need
to provide some method of accessing files remotely, for instance:
- Files published for the web can be read using HTTP
- Files can be read or writen with the help of an FTP server on the same machine as the web server
- A servlet running on the HTTP server can collaborate with your applet to exchange files -
Is reading local file possible?
Hi,
My intention is to use Flash 8 Pro as a tool allowing to
upload large files
into the server (something like FTP client). Unfortunately a
lot of servers
have tight restrictions for transmition time (sometimes
limited to 30s).
Work around to this could be a Flash. I couldn't find any
information in
Flash documentation about reading binary files selected by
user by
HTML-like file field. I would like to read selected file,
split it into
severeal smaller parts and then upload every part separately
into the
server. Is it possible?
Regards,
Marek> Czesc Marek
Hi! It seems you speak my native language :-)))
> Flash itself has no FTP capabilities. The only thing you
can do is use
> middle ware
> like php or asp and server side to upload stuff to
server and use flash to
> prompt
> the Browse for File dialog, and than upload your files.
Flash itself has
> no way of
> doing it at all unless with middle ware.
Yes, I know that. That is the reason why I have written
'somethig like FTP'.
Ok, once again... I can create PHP script to receive POST
uploads. This is
no problem to me. The problem is that iddle time for scripts
on this
particular server is set to 30 seconds only. It means that I
can't upload
files for which transfer time will be longer then 30s. To
work around this
issue it is necessary SPLIT uploaded file into the chunks
then transfer it
to the server and join using e.g. PHP script. I need a tool
embeded on web
page which allows me to select large file (large sometimes
means 1MB) and
send into the server jumping over server time limitations.
Flash contains
build-in FileReference class but there is no described in the
documentation
how to send selected file as e.g. 4 separate parts of it.
> There is an upload samples which comes with
> flash and can be located under the SAMPLE directory on
your C drive in the
> Macromedia
> folder. This is as far as it goes.
It is also described in Flash help under FileReference class
description. -
Hi All,
Is it possible to open a local file with some path like C:\temp\...... in VC?
Regards,
MurtuzaHi Govinda,
Do you know the format how to write the path of the file in the field 'file name' of the HTML view?
Is there a possibility that the user is prompted to enter the file path on runtime?
Best regards
Salvador Gimeno -
Hi experts,
Is it possible to upload data from local drive(presentation server) to sap in background mode.
As I know ,in the background mode we can upload files from application server only.
but here my functional consultant saying they did upload data from local drive to sap in background mode.
please suggest.
thanks in advance.
sastry.hey,
Yes it can be made possible,
The only way to access files in a background job is to have them on the application server and opened via OPEN DATASET or similar.
*--Local Variables
DATA : l_file TYPE string,
l_line TYPE string,
l_index TYPE sy-tabix.
*--Clear
CLEAR : l_file.
l_file = p_ipfile.
*--Read the data from application server file.
OPEN DATASET l_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
*--Error in opening file
MESSAGE i368(00) WITH text-005.
ENDIF.
*--Get all the records from the specified location.
DO.
READ DATASET l_file INTO l_line.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT l_line AT cl_abap_char_utilities=>horizontal_tab
INTO st_ipfile-vbeln
st_ipfile-posnr
st_ipfile-edatu
st_ipfile-wmeng.
APPEND st_ipfile TO it_ipfile.
ENDIF.
ENDDO.
Regards,
Midhun Abraham
Edited by: Midhun Abraham on Oct 8, 2008 4:36 AM -
How to download the application file to local file by back ground job?
hi:
can any one tell me how to download the application file to local file by back ground job? thanks in advance..
MonsonHi,
In order to download a file from application layer to a local file in background,
first write a report(ZREPORT1) in which do the following steps:
OPEN DATASET g_file_1 FOR INPUT IN TEXT MODE ENCODING DEFAULT.
loop the g_file and append all the data into another internal table.
end of this report you shd have all the data in the application layer file into your internal table.
Now create another report(ZREPORT2) and submit this report in background.
that is,
JOB_OPEN
JOB_SUBMIT and
JOB_CLOSE
and in job_submit submit ZREPORT1 which downloads the file in application layer.
Please reward points if helpful.
Regards,
Arul. -
Problem with File panel and Local files
I am having a couple of problem using Dreamweaver (which may be related) and can’t find any appropriate help on the web site.
I have created a small website and have it up and running. I’m now trying to do some minor modifications. But Dreamweaver seems to have lost the address of my local files on my home computer (although files are still there in the same place.) In the on-line training material it shows how to define where the root directory is when you start developing a site, but I can’t find where these setting are so I can check and if nessessary amend them. If I go to Define Site from the Site drop down options, this does not allow me to check or define the root directory.
Secondly, in the File panel (lower right on the screen) the address bar at the top only shows the remote files and the icons to the right (“put”, “get”, etc) have disappeared and I can’t seem to get them back. Also that lower panel seems to be floating rather than being fixed like it was. I have tried clicking on Classic View in the Workspace layout options but this doesn’t move things back to how they were when I first started using Dreamweaver (just a few weeks ago).
Can you offer any advice on what the problem is and how to manage it? Many thanks. I'm using Dreamweaver CS4 and an iMac.Immediately below the Tabs saying "Files" and Assets" is a small box
with arrow on the right to show the drop down list. In the box
on the right there's an icon of two networked computers. Then it
says, "ftp://Hill farm Web Site" which is the name of my website.
If I click on the arrows to pull up the drop-down box, I get four
options divided by a line. Above the line the options are Computer,
HD and ftp://Hill farm Web Site. Below the line it says manage sites.
Below this is list of files that make up my website in a directory
structure. The header for the first column reads, "Local Files",
which appears to be untrue, because the top line in the directory
structure below reads, "ftp://Hill farm Web Site".
Does this help?
regards
David -
Code to read local notepad.txt from applet
Hi.
Further to my (unanswered) queries about reading a notepad.txt file from the local directory i.e. the same directory from which the html and applet were launched, the following code is supposed to be able to read the local file. It failed to do so both in Netscape 7.1 and in IE5
I've also received conflicting advices : some says we can read local files without using a signed applet or chaning the ACL, whereas others I'll need to use signed applets and / or acl to allow the applet to read a local file.
My research has shown that java applets are supposed to be able to read local files. Has something changed:
public class FileAccess extends Applet
implements ActionListener {
Button loadButton, saveButton;
TextField filename;
TextArea content;
String browserName;
boolean securitySupported = false;
public void init() {
setLayout(new FlowLayout());
Label label =
new Label("Simple file editor");
add(label);
loadButton = new Button("Load");
saveButton = new Button("Save");
add(loadButton);
add(saveButton);
loadButton.addActionListener(this);
saveButton.addActionListener(this);
filename = new TextField(20);
add(filename);
content = new TextArea(5,20);
add(content);
browserName = System.getProperty("java.vendor");
if (browserName.indexOf("Netscape") > -1)
securitySupported = true;
setSize(200, 200);
public void actionPerformed(ActionEvent evt) {
if (securitySupported) {
if (evt.getSource() == saveButton) {
PrivilegeManager.enablePrivilege("UniversalFileAccess");
try {
FileWriter aWriter = new FileWriter(filename.getText(), false);
aWriter.write(content.getText());
aWriter.flush();
aWriter.close();
catch(Exception e) {
e.printStackTrace();
else if (evt.getSource() == loadButton) {
PrivilegeManager.enablePrivilege("UniversalFileAccess");
try {
BufferedReader aReader =
new BufferedReader
(new FileReader(filename.getText()));
content.setText(aReader.readLine());
aReader.close();
catch(Exception e) {
e.printStackTrace();
else {
getAppletContext().showStatus("security not installed");
}Hi acinhk,
I read your note with great interest. I am trying to solve almost exactly the same problem as you are -
Reading a .txt file in IE5 from the same directory where the html and the applet were lauched.
Your code looks fine to me.
My code is very similar, and again generates a security exception - as I am having the same problem you had getting around Java security.
If you have been able to solve the problem, can you please let me know what you did.
Any modifications to your sample code that actually made it work would be greatly appreciated.
Also, is signing the applet to read a local file under IE5 really necessary ?
Can the file be read from the local IE file system without signing the applet ?
Please let me know your thoughts.
Thanks !
drbob -
How to convert the local file into unicode file?
Hi All,
I need read local file (GUI_UPLOAD) and save it as unicode file?
I've found class CL_ABAP_CONV_OUT_CE but I've no idea how to use it.
Should I read file in binary mode and then convert it into unicode? AT the and save it (GUI_DOWNLOAD) ?
Thanks
AdamHi,
Check these classes, will help you
CL_ABAP_CONV_IN_CE : Reading binary data
CL_ABAP_CONV_OUT_CE : exporting binary data
CL_ABAP_CONV_X2X_CE : reading and exporting binary data and changing the format
Regards,
Satish -
Good Morning,
This is the scenario:
I put my applet in webserver. User go to this server (eg. http://www.test.com) and execute my applet
through web-browser. Now, this user wants to upload files. Is this possible?
I want the applet to be able to read the local file and save it to the database (JDBC). But all I need
is the technique to read local file. Sample source code will be appreciated.
Please help.
Thank You.konglomerat_muda wrote:
Good day,
I need an example how to upload file using applet. If there's one out there, you can search for it here or try Google, but I don't recommend this approach.
Applet is a must.I seriously doubt that, as I can't recall hearing of this type of a requirement since the invention of Applets.
Maybe you are looking for
-
Error when I plug my iPhone in usb and itunes comes up
when I plug my iPhone in with usb connected to my computer, iTunes pops up ofcourse and opens but then a box appears and says: This iPhone cannot be used because the apple mobil device service is not started. never had this come up before, now I do h
-
While downloading a particular project we are getting this error "An import error occurred The element <ExternalAtrribute> in the <Task> element with UID = 61 has invalid data." This error does not come the first time we press Download. It is thrown
-
SuccessFactors LMS not showing completion on Captivate 5.5 courses
THis is the only info SuccessFactors is telling us. I dont know where to find this settings in Preferences or Publishing settings. Please double check the publishing settings to ensure the content is set to update lesson_status as soon as the user
-
Split report with different column headers
Hey everyone, I've done quite a bit of googling and searching on this forum, and I'm wondering if anyone has tried to do the same thing as me, and found a solution. I'm looking to make a report like this: REPORT GROUP-1 SUB-GROUP1 HEADING 1
-
How to use unload query using JDBC with Informix database
Hi friends, How can i use unload query using JDBC with Informix database? When i use it as "unload to 'abc.txt' select * from ........" it gives syntax error.I want to take the data of a table to a file.With dbaccess i can use it but i need to do it