Writing the file to a specific directory on server using DATASET
Hello Friends
I know that using dataset command we can create a file, write to a file, read from a file etc.,
But by default it uses the directory DIR_SAPUSERS which is the ./ directory.
But this particular directory DIR_SAPUSERS also has other system related log files etc.,
Is there a way to make the command DATASET write to a user created directory instead of this ./ ??
Any suggestions or comments will be highly appreciated.
Thanks
Ram
IF NOT p_ufile IS INITIAL.
OPEN DATASET p_ufile FOR INPUT IN TEXT MODE.
IF sy-subrc <> 0.
EXIT.
ENDIF.
here p_ufile will contain the path where ever u need to place the file i.e. use specific path.... ex: "usr/sap/bin/interface"
Similar Messages
-
Setting the UNIX file permissions after writing the file to a directory
Hi Experts,
Can we set the UNIX file permissions after writing the file to a directory using Receiver File Adpater in SAP PI 7.1 ?
Thanks in Advance.
Regards,
JyotiHi
you can use the option "Run Operatiing system Command after File Processing" in the file adapter.
Thanks
Rinku Gangwani -
File path from specific directory
hi all ,
How to get full file path from specific directory having many folder inside that directory.
I have file name and main directory name,please help me if you know about itI recognize that this post is half a year old at this writing, and the OP has probably long since either solved or abandoned the problem in question. That being stipulated: if I understand the question properly, the OP is stating that there is a directory named A, and contained somewhere within that directory or one (or more) of its subdirectories is one (or more) file(s) named abc.txt, and OP would like to be able to locate and obtain the canonical path to said file(s). While I am in no way a java maven, I've written a brief program which appears to do exactly that:
import java.io.*;
public class Main {
public Main() {
String whatImLookingFor = "abc.txt";
String startingDirectory = "A";
File path = new File("A");
recursivelySearch(path, whatImLookingFor);
private void recursivelySearch(File path, String whatImLookingFor) {
try {
if (path.isFile()) {
if (path.getName().equals(whatImLookingFor))
System.out.println(path.getCanonicalPath());
else
if (path.isDirectory()) {
File[] currentFiles = path.listFiles();
for (int i=0; i<currentFiles.length; i++)
recursivelySearch(currentFiles, whatImLookingFor);
catch(IOException ioe) {
System.out.println("During search got error "+ioe.getMessage());
public static void main(String[] args) {
new Main(); -
Open files from a specific directory
Dear all,
I have the following source code that simply selects files from a directory.
private void openFile()
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(
JFileChooser.FILES_ONLY );
int result = fileChooser.showOpenDialog( this );
// user clicked Cancel button on dialog
if (result == JFileChooser.CANCEL_OPTION )
return;
File filename = fileChooser.getSelectedFile();
if (filename == null || filename.getName().equals( "" ))
JOptionPane.showMessageDialog( this,
"Invalid File Name",
"Invalid File Name", JOptionPane.ERROR_MESSAGE );
else
// open the file
try
// Open an input stream
FileInputStream fin1 = new FileInputStream(filename);
// Read and print a line of text
BufferedReader d1 = new BufferedReader(new InputStreamReader(fin1));
abs = d1.readLine();
outputArea1.setText("");
outputArea1.append(abs + "\n\n");
outputArea1.setCaretPosition(0);
// Close our input and output stream
fin1.close();
catch (IOException e5) {
JOptionPane.showMessageDialog(this, "Error Opening File", "Error", JOptionPane.ERROR_MESSAGE);
} // end catch
} // end else
} // end private
My question is: Can I force it to open files from a specific directory, and NOT from MyDocuments directory????
thanks,
vxc\r = return
\n = linefeed
\j = illegal escape character
JFileChooser fileChooser = new JFileChooser("C:\j2sdk1.4.2\bin");
You could/should use:
(new File).pathSeparator
or
(new File).pathSeparatorChar
and
(new File).separator
or
(new File).separatorChar
http://java.sun.com/j2se/1.4.1/docs/api/java/io/File.html -
File with list of .txt files in a specific directory
Hi,
I need to create a file with list of .txt files in a specific directory (actually the command will be used by a java application).
I am using the below command,
ls home/apptmt/park/*.txt > home/apptmt/park/reportgen.txt
but this command prints output as
home/apptmt/park/report1.txt
home/apptmt/park/report2.txt
home/apptmt/park/report3.txt
I need only the files in reportgen.txt file, like
report1.txt
report2.txt
report3.txt
any one help me on the command I should use to get this output?
Thanks
MTThank you Dude!
I just found out that
cd /home/apptmt/park;ls *.txt > reportgen.lst works for me...
I will try this one as well... thank you very much...
MT -
Urgent!doubt in upload the file to a particular directory.
Hi
Actually i'm developing a site using JSP.
Main concept of the project is the user should be
able to access his files or dabases from anywhere
in the world thru internet via intranet.
i've placed upload option in my site.
each user should b given a separate directory.
can anyone tell me how to make the user to store
the file in a particular directory(the one alloted to him).
And to view the file, if the user enters the file name
it should open the file in the particular format.
i need the coding since i'm new to jsp.
can anyone help me or refer any site tht can solve
my problem?
thanx in advance.I'd just answered a similar case. I believe this is what you are looking for;
<%@ page contentType="MIME-Type; Charset=Character-Set" %>
Read up on MIME-Type and Character-Set for info.
Here some exmaple;
By default:
<%@ page contentType="text.html; Charset=ISO-8859-1" %>
Show an MS Excel file;
<%@ page contentType="application/vnd.ms-excel" %>
or
<%
String mimeType = "application/vnd.ms-excel"
response.seContentType(mimeType);
%>
Cheers -
Functional module to get the File from a given Directory
Hi all,
I am using a FM name 'subst_get_file_list' to get the file from a given directory but it is accepting only 40 Character length file only my requirement is to accept file name other than 40 char,
give me good sugestion
regards
paulHi Paul,
Check the Function Module Gayathri has given. ie. 'SO_SPLIT_FILE_AND_PATH'.
In the exporting parameter FULL_NAME , give the path name and in the importing parameter stripped_name , you will get the filename.
Check this code.
REPORT ZSHAIL_SPLITFILE.
data: it_tab type filetable with header line,
gd_subrc type i.
tables: rlgrap.
data: path type string,
file_name type string.
parameters file_nam type rlgrap-filename .
data: user_act type i.
at selection-screen on value-request for file_nam.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
WINDOW_TITLE = 'select a file'
DEFAULT_EXTENSION = '*.txt
DEFAULT_FILENAME = ''
FILE_FILTER = '*.txt'
INITIAL_DIRECTORY = ''
MULTISELECTION = abap_false
WITH_ENCODING =
CHANGING
file_table = it_tab[]
rc = gd_subrc
USER_ACTION = user_act
FILE_ENCODING =
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
if user_act = '0'.
loop at it_tab.
file_nam = it_tab-filename.
endloop.
endif.
path = file_nam.
CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
EXPORTING
full_name = path
IMPORTING
STRIPPED_NAME = file_name
FILE_PATH =
EXCEPTIONS
X_ERROR = 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.
at selection-screen.
message i001(zmess) with file_name.
Regards,
SP. -
Unable to convert the file name in Target directory
Dear Experts,
Currently iam facing a problem with some files.my interface is a File to file .As per the interface the sender will pick the flatfiles from source directory which the file name was BNP_NE201.txt once my file reached to target directory the name of the file willrenamed as VENDOR_Payment.NE201 automatically for this they have done some OS level script in receiver communication channel of the first interface which we have added "un operating system command after message processing" in processing parameters tab.again one more sender comm channel wil pick the file from first target directory which is having naming convesion of "VENDOR_Payment.NE201 " and post it to target. all the two interfaces are file to file (NFS) . for a parctuclar day files has been posted to 1 st target directory and the receiver communication channel is not yet convert the file names bcz of that the second communication channel can't able to pick the files from target directory. for some times that is working fine and some times it is unable to convert.
from our side i check every thing .could you please suggest me the way to approch
Reagrs,
Kiran tanuku>> for a parctuclar day files has been posted to 1 st target directory and the receiver communication channel is not yet convert the file names bcz of that the second communication channel can't able to pick the files from target directory. for some times that is working fine and some times it is unable to convert.
You need to wait until the file is converted. After when it is converted then the second interface sender communication channel will pick the files.
What do u mean by unable to convert?
Is it unable to do the content conversion? if so then check the data as you said that it sometimes it works fine.
> The best approach is to change the name of the file in the receiver communciation channel instead of using a script.
Thanks, -
File adapter Need to wait When Other Applicatio is writing the file
Hi All,
This is File to File Interface, iam using NFS here.
While other application is writing the file to the Folder, XI Sender File Adapter shld wait for certain time and then pick it up.
We have the Option " MSecs to Wait Before Modification Check" on File Sender Advanced TAB.
But it is no Use, it is not behaving correctly.
Please assist me on this
RegardsHey Vamsi,
I think you're good to go here. The behaviour is exactly as it should be. The polling interval takes priority when there is no file there but when there is a file there the modification check will take priority over polling interval so it will still wait the mandatory 2 minutes to ensure that no modification is taking place & that's exactly what you want. You don't want to pick up an incomplete file irrespective of when it was put there. So there will always be just over a 2 minute delay (or whatever you set the Msecs value to + a few seconds depending on where the polling cycle is when a file is written out but a max of 2 minutes & 19 seconds delay) when there is a file there but at least you'll have consistent data. If there is no file there the adapter will just poll every 20 seconds until a file arrives.
The 2 minute 'wait' step is exactly that. The adapter will see the file then wait 2 minutes & probably does a timestamp comparison or something. It doesn't do a modification check within those 2 minutes. Having said that, I don't see why you can't reduce the Msecs interval. My reasoning is that you basically want to establish whether it's still being wriiten out before you pick it up. Even if you set it to 5 seconds you should still be able to pickup whether the file is being modified (I'm assuming that the check is doing a timestamp comparison). That will significantly reduce your time wait period.
My assumption on the timestamp comparison was wrong It's actually does a comparison on file size when it reads the data in, see SAP Note (Point 3): [http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bc_xi/~form/handler%7b5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d383231323637%7d]
Another suggestion made on the note: Get the writing application to write the file out with an extension different to the one you're polling for. Then, after they have completed writing out the file, they can do a re-name to the extension that you're polling for. That could also speed up things.
Regards, Trevor
Edited by: Trevor Naidoo on Oct 8, 2009 9:38 AM -
Is there a way in an unstructered Frame11.0 file to change all anchored frames in the file to a specific size at the same time?
Rog,
This is perfect use case for ExtendScript. You could easily iterate over all anchored frames and resize them. You would probably want to resize the contents as well, though, which would add a few extra lines of code.
Russ -
Writing the file in SRM system to FTP
Hi experts,
The FTP location for the file has been setup with some server,user/password.How do i dump the file in SRM system there.For this requirement, the above data ie., server name,user and password is enough or we need anything else?Can anyone please give me the required coding.
Thanks,
venkatesh.Hi,
The following batch file (UPWIP001.BAT) will start an FTP session and pass the name of a text file (UPWIP001.TXT) to the FTP program. This text file will be processed by the FTP program and each of the statements in the text file will be processed in the sequence they appear.
echo * This batch and text file illustrate the use of FTP to upload an
echo * ASCII file and an EBCDIC or Binary file. The UPWIP001.BAT file
echo * references UPWIP001.TXT that contains...
echo *
echo * user
echo * password
echo * cd /web
echo * pwd
echo * ascii
echo * put d:\simoweb1\cbltxn01.htm
echo * binary
echo * put d:\simoweb1\cbltxn01.zip
echo * quit
echo *
ftp -s:upwip001.txt www.simotime.com
The following is a listing of the contents of the text file (UPWIP001.TXT).
user
password
cd /web
pwd
ascii
put d:\simoweb1\cbltxn01.htm
binary
put d:\simoweb1\cbltxn01.zip
quit
Thanks
Amit -
FM to select the file path for download into application server
Hello,
I need a FM to select the file path for download into application server. It is a F4 help .
Its functionality should be simmilar to the one used for presentation server i.e. as fol
CALL METHOD cl_gui_frontend_services=>file_save_dialogHello,
What about F4_DXFILENAME_TOPRECURSION? You can check other FMs of the group DX_FILE.
BR,
Suhas
PS: I think these FMs are not released by SAP, so need to be cautious while using these -
UBE: Retrieve of UBE file failed. The file may not exist on Enterprise Serv
Hi,
I'm getting the following message in my pdf file , after running the batch R3465 :
UBE: Retrieve of UBE file failed. The file may not exist on Enterprise Server.
What does that mean ? Can anyone help ?
Thanks,
thiensu2810Thank you for your good suggestion. Here is what the new home folder permissions looks like:
Last login: Fri Dec 22 14:45:24 on ttyp1
Welcome to Darwin!
Louise-Heifetzs-Computer:~ joy$
Louise-Heifetzs-Computer:~ joy$ id
uid=503(joy) gid=503(joy) groups=503(joy), 81(appserveradm), 79(appserverusr), 80(admin)
Louise-Heifetzs-Computer:~ joy$ ls -ln
total 0
drwx------ 3 503 503 102 Dec 16 18:39 Desktop
drwx------ 3 503 503 102 Dec 16 18:39 Documents
drwx------ 22 503 503 748 Dec 16 18:45 Library
drwx------ 3 503 503 102 Dec 16 18:39 Movies
drwx------ 3 503 503 102 Dec 16 18:39 Music
drwx------ 4 503 503 136 Dec 16 18:39 Pictures
drwxr-xr-x 4 503 503 136 Dec 16 18:39 Public
drwxr-xr-x 7 503 503 238 Dec 16 18:52 Sites
Louise-Heifetzs-Computer:~ joy$ ls -ln /Users
I see the differences between the two, but am not sure how to proceed. I feel in over my head and would be grateful for guidance. Many thanks. -
Hi,
When trying with Postman sending a REST call to Azure Storage Queues I get:
The MAC signature found in the HTTP request '***' is not the same as any computed signature. Server used following string to sign: 'POST.
The code I have for creating the Authorization Header:
var accountName = "my_account";
string key = ConfigurationManager.AppSettings["my_access_key"];
DateTime dt = DateTime.Now;
string formattedDate = String.Format("{0:r}", dt);
var canonicalizedHeaders = "x-ms-date:" + formattedDate + "\n" + "x-ms-version:2009-09-19" + "\n" ;
var canonicalizedResource = "/my_account/myqueue/messages";
var stringToSign = String.Format("POST,\n\n\n\n\n\n\n\n\n\n\n{0}{1}", canonicalizedHeaders, canonicalizedResource);
stringToSign = HttpUtility.UrlEncode(stringToSign);
HMACSHA256 hmac = new HMACSHA256(Encoding.UTF8.GetBytes(key));
var signature = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(stringToSign)));
var authorizationHeader = String.Format(CultureInfo.InvariantCulture, "SharedKey {0}:{1}", accountName, signature);
return authorizationHeader;
Anyone any idea what I'm missing/doing wrong?
Additional question: do i have to create for every message I want to send a new Authorization header? Or is there an option (as with Service Bus Topics) to create a header that can be used for a certain timeframe?
Thanks.One issue is with this line of code:
HMACSHA256 hmac = new HMACSHA256(Encoding.UTF8.GetBytes(key));
Please use the following:
HMACSHA256 hmac = new HMACSHA256(Convert.FromBase64String(key));
and that should take care of the problem.
Regarding your question, "do i have to create for every message I want to send a new Authorization header? Or is there an option (as with Service Bus Topics) to create a header that can be used for a certain timeframe?"
With your current approach, the answer is yes. What you can do is create a Shared Access Signature on the queue which will be valid for certain duration and then use that for posting messages to a queue using simple HttpWebRequest/HttpWebResponse.
Hope this helps. -
Is it possible to lock the keyboard of a client from a server using java
please explain wheterit is possible to lock the keyboard of a client from a server using java
You want to process code on one machine, and thereby lock the keyboard on another machine? No, that's not possible. It is extremely far from possible.
Of course, if the client is running software with security holes in it you might hack into it and crash the thing. This will lock up the keyboard pretty good. I hope that's not what you want ...
Or are you talking about a setup where you already have code running on the client, and some sort of communication between client and server? In that case what you need to know is whether it is possible to lock the keyboard at all. Once you have figured that out, it is trivial to add the communication code to have the server software tell the client software to lock the keyboard.
So what do you mean with "lock the keyboard"? It's pretty easy to remove/disable all keyboard related listeners in your own application. It's a lot harder (and AFAIK impossible with pure java) to disable alt-tabbing out of the application. And impossible, except from exploiting security holes, to lock the ctrl-alt-delete-combination on windows machine.
Maybe you are looking for
-
RGZPFM stopped working after OS upgrade to V5R4 from V5R3
Hi Guys, We recently upgraded the operating system on our DEV & TEST boxes from V5R3 to V5R4. Before the upgrade, we used to use the program ZRGZPFM attached in SAP note number: 84081 Reorganization of database tables (RGZPFM) for Re-Organizing the
-
my iphone 3g battery died. When I recharged it the large icon with a lightning bolt under it showed up and it booted after a while. After that the charge does not go higher than 2% and it turns off after barely a minute of usage and there is no charg
-
Last clip on each page won't play
Hi. I just made a website in iWeb. Four of my pages have a few clips on them. In all four cases the bottom-most clip will not play, nor are any of the buttons on the QT controller usable. It will load however. Here's the urls: http://web.mac.com/salt
-
In the Add-ons Manager when I click on Extensions, the Extensions window is empty. How can I get my Extensions to show up in the Extensions window in the Add-ons Manager?
-
Why is my G3 running so slow?
I recently upgraded to Panther. I did the permission repairs. I optimized. I moved the iTunes and iPhoto to a Iomega external HD. Firmware is good. I have had nothing but problems on startup and when clicking on apps. The spinning wheel forever.... O