To get the File path dynamically
Hi all,
I am using the <b>Gui_upload function, and i want to get the file dynamically from the search help</b>,
So please help me in finding the answer.
Thanks,
Girish
Hai Girish
Check the following Code
DATA: I_FILETABLE TYPE FILETABLE,
V_RC TYPE I.
PARAMETERS: P_FILE LIKE RLGRAP-FILENAME. "local file with contracts
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = 'Find File'
DEFAULT_EXTENSION = 'C:\'
DEFAULT_FILENAME = ''
FILE_FILTER = ',..'
INITIAL_DIRECTORY =
MULTISELECTION =
WITH_ENCODING =
CHANGING
FILE_TABLE = I_FILETABLE
RC = V_RC
USER_ACTION =
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.
READ TABLE I_FILETABLE INTO P_FILE INDEX 1.
Thanks & Regards
Sreenivasulu P
Message was edited by: Sreenivasulu Ponnadi
Similar Messages
-
How to get the file path from HTML input form in Firefox3
In IE7 (and probably all famous browsers, including old Firefox 2), if we submit a file like 'C:\folder1\folder2\folder3\filename' it works properly and gives the full path to the file and the filename.
In Firefox 3, it returns only 'filename', because of their new 'security feature' to truncate the path, as explained in Firefox bug tracking system (https://bugzilla.mozilla.org/show_bug.cgi?id=143220)
I have no clue how to overcome this 'new feature'.
Can anyone help to find a single solution to get the file path both on Firefox 3 and IE7?
Thanks in advance....Doubleposted and ignored any previous answer: [http://forums.sun.com/thread.jspa?threadID=5342405]. Don't do that. It's rude.
Regarding to your "problem": why do you need the file path? -
How to get the file path from HTML input form in Firefox 3...
In IE7 (and probably all famous browsers, including old Firefox 2), if we submit a file like 'C:\folder1\folder2\folder3\filename' it works properly and gives the full path to the file and the filename.
In Firefox 3, it returns only 'filename', because of their new 'security feature' to truncate the path, as explained in Firefox bug tracking system (https://bugzilla.mozilla.org/show_bug.cgi?id=143220)
I have no clue how to overcome this 'new feature' because it causes all upload forms in my webapp to stop working on Firefox 3.
Can anyone help to find a single solution to get the file path both on Firefox 3 and IE7?
Thanks in advance....As you're posting this in the JSF forum and looking at your [previous topic|http://forums.sun.com/thread.jspa?threadID=5342365], I assume that you're using Tomahawk's t:inputFileUpload. In this case, just use UploadedFile#getInputStream(). You may find this article useful: [http://balusc.blogspot.com/2008/02/uploading-files-with-jsf.html].
By the way, are you lazy or just dumb? You wasted one week to this! I've posted the aforementioned article one week ago. How did you stuck? -
Function module to get the file path in the system for TEMP folder
Hi All,
Is there any function module that I can use to get the file path in the system for TEMP folder.
I mean, i am supposed to give only TEMP as the input for that function module and I need to get the path of that in the system as the output.
I am unsing 4.0 version.
Please advice.
Regards
RameshIn Higher versions, we can use the below code:
call method CL_GUI_FRONTEND_SERVICES=>ENVIRONMENT_GET_VARIABLE
exporting
VARIABLE = 'TEMP'
importing
VALUE = LV_TMP
exceptions
CNTL_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.
call method CL_GUI_CFW=>FLUSH
exceptions
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2
others = 3.
if SY-SUBRC <> 0.
Error handling
endif.
concatenate lv_tmp '\' into folder_path.
But need to know in the lower versions like 3.1h and 4.0, -
How to get the file path in adf application
hii all,
i have a txt file that i am using in my adf application,
i am passing this txt file through a File Reader, for which i have to mention the file path.
The file is in web-content and when i am hard coding the complete file path i.e C:/JDeveloper/myApp/ViewController/public_html/log.txt
the application is working fine when run on integrated weblogic server.
My requirement is to access this file without giving the static file path, as in case i have to use this application on any other machine..
for that how to mention the file path-
i tried using FacesContext to get the context path :-
FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
which gives me
\myApp-ViewController-context-root
after appending public_html\log.txt
I am using the following path to access the file :-
\myApp-ViewController-context-root\public_html\log.txt
again i am getting the java.io.FileNotFoundException
Does anyone know how to use file from inside the web-content without giving the complete path..???
ThanksHi,
If you put your file under public_html folder, you can use this code to access the file:
For example file is : log.txt
FacesContext.getCurrentInstance().getExternalContext().getRealPath('/log.txt').toString().trim();
Thanks.
- LSR -
Issue with Getting the file path from InputFile component
Hi,
One of our requirement is like below:
I am working on ADF 11g (latest release R1) page. User will select the file and when he/she clicks on the Save button we need to store the file path in the database.
In the database file_path is varchar2(300). We need to store just the file path. I am using InputFile component but filepath is not getting inserted.
This is really urgent. It would be really appreciate if anyone can guide me on this.
Thanks
MCHi Mahesh,
I have manage to store the file path from the InputFile component in Jdev 11g. I found the file upload script from this forum and manage to alter it so that i could save the file path to the database. But my problem is to retrieve it back to view as a document. Hope this will help you :)
This is an example of what I have manage to save to my DB :
(CLOB) //192.168.238.53/c$/Research/Docs/0906160744/EyeCandyLog.txt
In my form, I save the file path first before I update the other fields. My code is something like this :
public void uploadFile(ValueChangeEvent valueChangeEvent) {
// Add event code here...
InputStream in;
FileOutputStream out;
if(tanda == 0){
try {
// final Context context = getInitialContext();
RS01Proposal rS01Proposal = (RS01Proposal)new InitialContext().lookup("Phase2-RS01Proposal#sr.model.RS01Proposal");
id = rS01Proposal.dptProposalid();
tanda = tanda + 1;
System.out.println("tanda"+ tanda);
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("id"+id);
proposal = id.substring(6);
System.out.println("proposal"+proposal);
UploadedFile file = (UploadedFile)valueChangeEvent.getNewValue();
String fileUploadLoc = "//192.168.238.53/c$/Research/Docs/"+id+"/";//The place where file will saved
//create upload directory
boolean exists = (new File(fileUploadLoc)).exists();
if (!exists) {
(new File(fileUploadLoc)).mkdirs();
if (file != null && file.getLength() > 0) {
FacesContext context = FacesContext.getCurrentInstance();
FacesMessage message =
new FacesMessage("File Uploaded " + file.getFilename() +
" (" + file.getLength() + " bytes)");
*// extracting the file message to get the path*
context.addMessage(valueChangeEvent.getComponent().getClientId(context), message);
columnL = valueChangeEvent.getComponent().getClientId(context);
column = columnL.substring(9);
System.out.println(column);
columnLengkap = "RS01"+column.toUpperCase();
System.out.println("columnLengkap"+columnLengkap);
*try {*
out = new FileOutputStream(fileUploadLoc + "" + file.getFilename());
in = file.getInputStream();
*for (int bytes = 0; bytes < file.getLength(); bytes++) {*
out.write(in.read());
in.close();
out.close();
} catch (IOException e) {
e.printStackTrace();
} else {
String filename = file != null ? file.getFilename() : null;
String byteLength = file != null ? "" + file.getLength() : "0";
FacesContext context = FacesContext.getCurrentInstance();
FacesMessage message =
new FacesMessage(FacesMessage.SEVERITY_WARN, " " + " " +
filename + " (" + byteLength + " bytes)",
null);
context.addMessage(valueChangeEvent.getComponent().getClientId(context),
message);
System.out.println(fileUploadLoc+file.getFilename());
a = fileUploadLoc+file.getFilename();
b = b + 1;
if (flagInsert == 0){
try {
// final Context context = getInitialContext();
RS01Proposal rS01Proposal = (RS01Proposal)new InitialContext().lookup("Phase2-RS01Proposal#sr.model.RS01Proposal");
rS01Proposal.insertDoc(id,proposal,columnLengkap,a);
flagInsert = flagInsert + 1;
System.out.println("tanda"+ tanda);
//session
ProposalSession.storeCurrentProposalId(id);
} catch (Exception ex) {
ex.printStackTrace();
}else{
// update proses
try {
// final Context context = getInitialContext();
RS01Proposal rS01Proposal = (RS01Proposal)new InitialContext().lookup("Phase2-RS01Proposal#sr.model.RS01Proposal");
rS01Proposal.updateDoc(id,proposal,columnLengkap,a);
flagInsert = flagInsert + 1;
//session
ProposalSession.storeCurrentProposalId(id);
System.out.println("tanda"+ tanda);
} catch (Exception ex) {
ex.printStackTrace();
} -
Getting the file path from a File browse button
Hi,
I was wondering if there is a way to extract the whole file path (not just the file name) from a file which is selected using a file browse button?
I am trying to save the file path as text in my database (I don't want to upload the file). I have linked the file browse object to a table field in the database. But when entered in the database, all I get is a series of random characters, followed by the file name. I would like to have the complete file path instead.
TomHi thanks
I've placed the java script into the head of the page, but unsure as to how to change the taget url for my submit button from doSubmit('SUBMIT') to doPrepareAndSubmit('SUBMIT'). In fact I don't actually have a submit button, but a save new record (which performs an SQL INSERT into the database using the values contained in the fields on the page) or a update record buttons instead.
I'm sorry but my knowledge of java scripts is not very good either.
How do I do the follwoing?: if your submit button has not any target set its target to url:
javascript: doPrepareAndSubmit('SUBMIT')
Cheers, Tom -
How to set the file path dynamically based on sytem, username, and date
Hi All,
My requirement is upload the data into one structure like xyz that is related to t.code MCSZ.
file will be in UNIx SERVER .
PATH IS: /sapif
file name is xy789 load .txt
I have to write code in one user-exit
how can i set the file path for this.
shall i put hard code file path?
because i have to writecode in user-exit.
plz tell me how to set the file path based ons syetem, username, date
Thanks in advance
Ram.AConcatenate the field SY-SYSID, SY-UNAME and SY-DATUM for the file path
-
Getting the File Path of file attached to Document(CV03N)
Hi,
We are migrating DOCUMENTS(Document Info Record)data from SAP 3.1i Version to SAP ECC6.0 Version. Here i want to transfer file path of file attached in 3.1i(From DRAW-FILEP) but, i can not able to find complete path of that particular file in FILEP field, it holds only the file name.
Please help me getting that complete file path.
JMPHi Maruthi,
If you want access or see the file name in the document you need to supply three fields.
FILEP, DTTRG, DAPPL in DRAW table.
I have used the LSMW with IDOC method and assigned the fields DOCFILE1, DATACARRIER1 and WSAPPLICATION1.
Thanks,
Satheesh -
Hi,
I am doing an add-in on MS Project. Basically I have an embedded Excel file which I want to write on the same folder where the MSproject is located. How will I be able to get the exact location of the file?
Thanks,
Gilbert WongHi,
This is the forum to discuss questions and feedback for Microsoft Office, I'll move your question to the MSDN forum for Office DEV
http://social.msdn.microsoft.com/Forums/en-US/home?forum=officegeneral&filter=alltypes&sort=lastpostdesc
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
George Zhao
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs.
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected] -
How to get the file path of selected file using JFileChooser
Hi All,
I am trying to store the file on my FTP server after selecting the file from the user workstation using JFileChooser. But I am not able to write the file on FTP server or on user local machine where application is running. I am new to this FTP server coding. Can anyone help me in this.
This is the code I wrote on button click user will able to select the file:
String filename1;
File file;
JFileChooser fc = new JFileChooser();
fc.showOpenDialog(this);
file = fc.getSelectedFile();
filename1 = file.getPath();
txtFilePath.setText(filename1);
Below is the code to write the file on my local machine first:
BufferedWriter outFile = new BufferedWriter( fileName ) );
outFile.write();
outFile.flush( );
outFile.close( );
Any help will be greatly appriciatedrp0428 wrote:
>
BufferedWriter outFile = new BufferedWriter( fileName ) );
>
There is NOTHING named 'fileName' in any of the code you posted so that code can't possibly compile let alone actually run.
How can anyone help you if you won't post the actual code you are using?Its just a random snippet of other code that is totally irrelevant to this thread if you ask me. -
Method to get the file path that invoked a servlet
i have a html file that invokes a servlet.Within the servlet i want a method that gives me the path of the html file.Is this possible without using cookies.or is there any method that serves my purpose?
Hi,
after reading the last posts I think you should try what KPSeal said (althought I haven't tried it) or use my last suggestion :
on your HTML link (which will be handled by server) add an extra parameter (e.g. http://handle.xxx?page=mypage.HTML) and catch it inside the servlet code to know from what page it came.
nevertheless, about the getRequestURL() (and getRequestURI()) it's a method from the interface HttpServletRequest, in the package javax.servlet.http that comes in the Servlet API. (you can find the servlet API at http://java.sun.com/products/servlet/download.html), but I believe if you have a servlet you already should have inside it the request object. -
How can I get the file path which located on webapps/MY_APPS ?
Hi,
I use tomcat as our servlet container.OS is win2k srv
my project was put on x:\tomcat\webapps\MY_APPS
and I could use getServletContext().getRealPath("/") within a servlet to get x:\tomcat\webapps\ROOT\MY_APPS,
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
String myAppsPath = getServletContext().getRealPath("/");
}but I could not utilize this method within a normal help class
any suggestion will be welcome.
thanks in advance.try this:
package com.sample;
import java.io.File;
public class SampleClass
public SampleClass()
* @param args
public static void main(String[] args)
SampleClass sampleClass = new SampleClass();
File f = new File("SampleClass.class");
System.out.println(f.getAbsolutePath());
} -
How do I get iTunes to show the file path for music
I am trying to get iTunes to show me where songs are located on my computer, Hoiw do I get this to show up in iTunes? Thank you
PTIIIk wrote:
I am trying to get iTunes to show me where songs are located on my computer, Hoiw do I get this to show up in iTunes? Thank you
Right-click the track in the library, and choose Show in Windows Explorer.
If you were hoping to get the file path displayed in a column, as is possible in Windows Media Player, note that iTunes does not have that ability. -
How to get full file path while uploading a file in flex Applications
How to get full file path while uploading a file in flex applications.
FileReference Object is giving file name and other details but not the actual path.
Is there any workaround to to get the file path?.
ThanksWhy not ask in the Flex forum; it is more likely that someone over there knows.
Maybe you are looking for
-
Can anyone help me ? all songs on my ipod are gone, but still in library.
can anyone help me ? when i plug my ipod into my computer, itunes comes up,and i noticed that everything under the "playlist" section,for ex."recently added" "recently played" etc., are no longer there. when i try syncing my ipod an error comes up an
-
How can I transfer my iTunes from one laptop to another?
Is it possible to transfer iTunes from one laptop to another?
-
X201 Windows 8.1 Keyboard driver issue
I tried clean installing Windows 8.1 on my ThinkPad X201T The Windows itself installs without any issue, but for some reason the keyboard drivers seem to be out of order. They will either not load up at all, or take incredibly long time to load up. I
-
What's with the non-existant free trial download for Photoshop?
What's with the non-existant free trial download for Photoshop? You click on "Download free trial" and it takes you to a page that takes you to a forum- nothing happens. I've done this about 6 times on two browsers. Of course, there's no help from
-
Publishing Indesign Document in Certain Style
Hi, I've been working on a project using InDesign and want to have it so when it's finished it looks like this: http://content.mcfc.co.uk/~/media/Files/Annual%20Report/MCFC_AR.pdf i.e. I want the 2 consecutive pages to merge seamlessly with no dotted