FM to get desktop path
Hi Exports,
Is there any function module to get the desktop path in our presentation server? It means that I should not browse the path using F4_FILENAME and all. That function module should give my desktop path automatically.
Or otherwise is there any function module to get my windows user id. Through this I can create desktop path.
Thanks and regards,
Venkat
each user will have different ID ... so i dont think its possible
Below code opens the desktop path for a specific user
check whether there is any other alternative to get the desktop path
DATA:g_error TYPE c.
DATA: t_file_in TYPE filetable,
w_file_in TYPE file_table,
rc TYPE i,
p_file TYPE string,
lv_user_action TYPE i,
user_name TYPE string,
path TYPE string.
START-OF-SELECTION.
PERFORM get_file.
CHECK g_error IS INITIAL.
CHECK rc = 1.
READ TABLE t_file_in INTO w_file_in INDEX 1.
MOVE w_file_in TO p_file.
*& Form get_file
* text
FORM get_file .
CALL METHOD cl_gui_frontend_services=>get_user_name
CHANGING
user_name = user_name
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF user_name is not INITIAL.
CONCATENATE 'C:\Documents and Settings\' user_name '\Desktop\' INTO path.
else.
path = 'C:\Documents and Settings\Desktop\'.
ENDIF.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select File'
default_extension = '.Txt'
initial_directory = path
CHANGING
file_table = t_file_in
rc = rc
user_action = lv_user_action.
IF lv_user_action <> cl_gui_frontend_services=>action_ok.
g_error = 'X'.
ENDIF.
ENDFORM. "get_file
Edited by: Keshu Thekkillam on Aug 31, 2009 11:45 AM
Similar Messages
-
I want to get desktop path for client user using webutil
oracle database 11g
oracle forms 10 g
client windows
i want to get desktop path for client user using webutil
as i want to save file in this pathTo get the user's path to their Desktop is a two step process. First, you have to echo the %USERPROFILE% to a output file and secondly, read the directory from the output file in to Forms. The code would look similar to the following:
/* When-Button-Pressed trigger */
DECLARE
v_temp_path VARCHAR2(250);
v_temp_file VARCHAR2(12) := 'webutil.log';
f_file Client_Text_IO.File_Type;
BEGIN
Client_Host('cmd /c echo %USERPROFILE%\Desktop > c:\'||v_temp_file);
f_file := Client_Text_Io.FOpen('c:\'||v_temp_file, 'R');
Client_Text_Io.Get_Line(f_file,v_temp_path);
Client_Text_Io.FClose(f_file);
b_dummy := WebUtil_File.Delete_File('C:\'||v_temp_file);
--At this point, you have the path stored in the v_temp_path variable.
--You can assign this variable to a block item or reference it directly in your code.
END;
When you reference the value of the v_temp_path, don't forget to wrap the value in double-quotes (" ") becuase the path will have spaces. Since your plan is to write a file to the user's desktop, your call to FOPEN will look like this:
f_file := Client_Text_Io.FOpen('"'||v_temp_file||'"','W');
Hope this helps,
Craig... -
Function module to get desktop path
Hi All,
Is there any function module to get the desktop path?
I have tried using CL_GUI_FRONTEND_SERVICES=>GET_DESKTOP_DIRECTORY, but it is not returning any value.
I can't hardcode "C:\Documents and Settings\<<<user-name>>>\Desktop" as some users have their desktop in "D:\Documents and Settings\<<<user-name>>>\Desktop".
Thanks in advance.
Regards,
Arun MohanHello
No problem:
data: str TYPE string.
CALL METHOD cl_gui_frontend_services=>GET_DESKTOP_DIRECTORY
changing
DESKTOP_DIRECTORY = str
EXCEPTIONS
cntl_error = 1.
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=>UPDATE_VIEW.
WRITE: str. -
F4 Help to get the path for a File source directory
There are numerous function modules for browsing a particular file in desktop and getting the file path (including the fine name) , like F4_FILENAME , KD_GET_FILENAME_ON_F4 , WS_FILENAME_GET etc. But can anyone tell me how to fetch only the directory path to the field were the F4 help is given. Actually the filename has to come in some other field in the selection screen. Is there separate funtion modules for these OR will changing parameters in the above function modules work?
Pls Help....
Also are there function modules for providing F4 help for getting the path to a file in application directory?Try this method CL_GUI_FRONTEND_SERVICES.
It is a Global CLASS which is having different methods for different purposes
see the documentation of it and use the methods of it
see
CL CL_GUI_FRONTEND_SERVICES
Short Text
Frontend Services
Functionality
The class CL_GUI_FRONTEND_SERVICES contains static methods for the following areas:
File functions
Directory functions
Registry
Environment
Write to / read from clipboard
Upload / download files
Execute programs / open documents
Query functions, such as Windows directory, Windows version, and so on
Standard dialogs (open, save, directory selection)
Example
Determine the temp directory on your PC:
DATA: TEMP_DIR TYPE STRING.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_TEMP_DIRECTORY
CHANGING
TEMP_DIR = TEMP_DIR
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2.
IF SY-SUBRC 0.
Error handling
ENDIF.
flush to send previous call to frontend
CALL METHOD CL_GUI_CFW=>FLUSH
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2
OTHERS = 3.
IF SY-SUBRC 0.
Error handling
ENDIF.
WRITE: / 'Temporary directory is:', TEMP_DIR.
Notes
The class CL_GUI_FRONTEND_SERVICES is based on the Control Framework. See the documentation for more information, in particular on CL_GUI_CFW=>FLUSH which must be called after many CL_GUI_FRONTEND_SERVICES methods.
Migration Information
The old file transfer model was based on function modules of the function group GRAP. The old features have been replaced by the class CL_GUI_FRONTEND_SERVICES. The following list contains the old function modules (italic) and the new methods (bold) that replace them:
CLPB_EXPORT
CLIPBOARD_EXPORT
CLPB_IMPORT
CLIPBOARD_IMPORT
DOWNLOAD
GUI_DOWNLOAD, dialog replaced by FILE_SAVE_DIALOG
PROFILE_GET
No replacement, use REGISTRY_* methods instead
PROFILE_SET
No replacement, use REGISTRY_* methods instead
REGISTRY_GET
REGISTRY_GET_VALUE, REGISTRY_GET_DWORD_VALUE
REGISTRY_SET
REGISTRY_SET_VALUE, REGISTRY_SET_DWORD_VALUE
UPLOAD
GUI_UPLOAD, dialog replaced by FILE_OPEN_DIALOG
WS_DDE
Obsolete: This function is no longer supported.
SET_DOWNLOAD_AUTHORITY
Obsolete: This function is no longer supported.
WS_DOWNLOAD
GUI_DOWNLOAD
WS_DOWNLOAD_WAN
Obsolete: This function is no longer supported.
WS_EXCEL
Obsolete: This function is no longer supported.
WS_EXECUTE
EXECUTE
WS_FILENAME_GET
FILE_SAVE_DIALOG, FILE_OPEN_DIALOG
WS_FILE_ATTRIB
FILE_SET_ATTRIBUTES, FILE_GET_ATTRIBUTES
WS_FILE_COPY
FILE_COPY
WS_FILE_DELETE
FILE_DELETE
WS_MSG
Obsolete: This function is no longer supported.
WS_QUERY
CD (current directory)
DIRECTORY_GET_CURRENT
EN (read/write environment)
ENVIRONMENT_GET_VARIABLE
ENVIRONMENT_SET_VARIABLE
FL (determine file length)
FILE_GET_SIZE
FE (check if file exists)
FILE_EXIST
DE (check if directory exists)
DIRECTORY_EXIST
WS (determine Windows system)
GET_PLATFORM
OS (operating system)
GET_PLATFORM
WS_UPLDL_PATH
Obsolete: This function is no longer supported.
WS_UPLOAD
GUI_UPLOAD
WS_VOLUME_GET
Obsolete: This function is no longer supported.
Reward points if useful. -
I need to place a shortcut in the desktop and at the startup in Windows.
In the run time itself I need to find the path of the desktop and startMenu in the current system.
How can I get the path? suggest me
Thanks in advance.not sure if this will do the trick...
String UserDesktop = System.getProperty("user.home") + "/Desktop";
System.out.print(UserDesktop.replace("\\", "/")); -
How can I get the path name and rename it?
I Hope someone who knows more about automator than I can help me out here. What I'm trying to do is get the path file name, while also changing part of it. Here is my example:
I can get the path name with this "Get Path" script I found http://automatorworld.com/archives/get-path/all-comments/
It does half the job so I just need to tweak it but know how. When I get the path this is what I'll get: /Volumes/Public/Creative Services/Campaigns/2010/NCDDiv-32CDV Upgrade/NCDDIV-32Versions.xls
I need to remove the beginning part"/volumes" to "file://///nhmanmkt01"
This is so I can send the path from our sever where we keep our files to my windows friends so they can open it.
Thanks for any help you can provide!ok, make the following workflow.
1. get selected finder items.
2. run shell script
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #ADD8E6;
overflow: auto;"
title="this text can be pasted into the Script Editor">
for f in "$@"
do
echo "$f"|sed 's%/Volumes%file://///nhmanmkt01%'
done</pre>
set the script to accept input as arguments
3. copy to clipboard
save it as a finder plugin. -
Get current path in Java LINUX?
Hi,
I m trying to get the current path of file using the getAbsolutePath.Its works fine (gets the current working directory) in Windows both in debug & release mode.Whereas, in LINUX ,It is not working.
i.e.,It gets home path instead current path while running in release(by clicking jar file).
File objfile = new java.io.File("SampleCloud.txt").getAbsoluteFile();
JOptionPane.showMessageDialog(null, objfile.getAbsolutePath());
Message box display home path instead of current path on linux.
I dont know why its so.Ur help would be appreciated.
System.getProperty("user.dir")
I used it but its also taking the home dir path on linux
Sonal
Edited by: 850979 on 13-Apr-2011 06:04Thanks for your reply.
I have copied the .jar file in a new directory under <user name>/Documents. The SampleRTLCloud.txt is also in the same directory. How do I get the path of the directory where the application is run from?
Your help will be much appreciated.
Sonal -
How to get desktop information in background?
Dear all,
I need to get desktop information, such as computer name, when running program in background. How to do that? Thanks.I got the answer for you:
DATA: BEGIN OF usr_tabl OCCURS 10.
INCLUDE STRUCTURE uinfo.
DATA: END OF usr_tabl.
DATA th_opcode(1) TYPE x.
DATA: size TYPE i.
CONSTANTS: opcode_list LIKE th_opcode VALUE 2.
CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_list
ID 'TAB' FIELD usr_tabl-*sys*.
DESCRIBE TABLE usr_tabl LINES size.
READ TABLE usr_tabl INDEX size.
WRITE usr_tabl-term.
From:GUI_GET_DESKTOP_INFO is not worked when run in background -
How can i get the path to config folder placed inside the jar file?
Hi i have developed an RCP application using eclipse.
In my application config directory is there.
When i export my RCP application as JNLP Project the jar file is created which contains config folder inside it.
When i download the application using java web start , how can i get the path to config folder placed inside the jar file?
Will the config folder exists in local cache in my system?
Help needed.
-Deepak-- This works in CS6:
tell application "Adobe InDesign CS6"
set myDocument to active document
set selectedRectangles to selection of myDocument
set theGraphicsLink to file path of item link of (graphic 1 of (item 1 of selectedRectangles))
--> "Macintosh HD:folder/folder/filename.tif"
end tell -
File dialog box: how get full path and filename (firefox 3.0 problem)
Hi,
I have a smilar problem then discussed in this thread: file dialog box: how get full path and filename
Now this solution doesn't seem to work in firefox 3.0,I only get the filename but not the full path.
I have tried to solve this problem by adding *"netscape.security.PrivilegeManager.enablePrivilege("UniversalFileRead");"* in a javacript function but that doesn't do the trick
Although when i tested it local it does work.
Any idees how to solve this?
Best Regards
StijnActually, that is strange and scarry. With 20% of the browser market share they decide to behave like Microsoft did in the past - they want to decide what users need and what they do not need. With 3.0 I have a real problem with some of my applications. They are all tested in IE6, IE7, FF2.0 and they all work the same way (they even work with Opera and Safari). Now, I will for sure not go there and make it work for 3.0, just because 2 out of 200 users use FF3.0. Up to now I have always recomended FF as the best browser. 3.0 causes my opinion to change completely. Competition is always good but it is a question if it is good if we have 20 different browsers out there with equal market shares.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
How to get the path of local folder in native services in windows phone 8.1 ?
I used to get the path of local folder path in managed code by following -Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;But now I need to get the local folder path in native services .Please help me out ?
What do you mean by "native services"? Windows.ApplicationData.Lo alFolder is the way to access the local folder.
-
How to get the Path of the Current File using Import & Export File -Reg.
Dear all,
I have a mega (big) doubt. I have manually inserted the Figures from the figure folders. Now i need, fully automated. So How can I get the Figure path
Example :
PMString path = "E://development/Figures/";
now i checked, How many subFolders is there in "path", get the All Subfolders and check to the Article Name.
Example
Article Name == subFolder name then get the Files from the SubFolders(E://development/Figures/ChapterF/*.eps files").
now I paste the Document using to For Loop.
Please any one can suggest me, How can We get the Path in SDK.
Note:
Should I have to create the relative path by myself?
No method supplied in SDK to do this directly?
Please I need a help of this Query as soon as posible.
Thanks & Regards
T.R.Harihara SudhaNhttp://msdn.microsoft.com/workshop/author/dhtml/reference/objects/input_file.asp?frame=true
When a file is uploaded, the file name is also submitted. The path of the file is available only to the machine within the Local Machine security zone. The value property returns only the file name to machines outside the Local Machine security zone. See About URL Security Zones for more information on security zones.
i need to know on how to get the compelete path /directory of the filename
using <input type="file"> tag You can't. Its a security thing.
is there any other way to get an input file from a local host aside from <input type="file"> tag?No. Not using just html.
You could always go into activex components, but thats different again.
Cheers,
evnafets -
hi
i wanted to get the path of the file.i just need to get the path not the file.i wanted to do using swing.may be filechooser or tree. but i need to know how could i get tht if i know the exampl for this it would be useful for me ..i need it in a way that like in windows explore.. so tht if i get the path of it i can use that in another class file.
anyway i am looking out in File class also. -
How to get the Path of the WebDynpro page
Hi All,
Can any one say how to get the path of the JSPDynPage ina Portlet in Portal Application.
Becoz i have to display that Page in another JSPDynPagee
Thanks in Advance....Hi,
You can call your JSPDynPage component by calling the URL as:
http://localhost:50000/irj/servlet/prt/portal/prtroot/YourApplicationName.YourComponentName
Check this:
Calling portal component
Greetings,
Praveen Gudapati
[Points are welcome for helpful answers] -
How to get the path when i select a directory or a file in a JTree
How to get the path when i select a directory or a file in a JTree
import java.lang.*;
import java.io.*;
import javax.swing.*;
import javax.swing.tree.*;
import java.awt.HeadlessException;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Iterator;
* @author Frederic FOURGEOT
* @version 1.0
public class JTreeFolder extends JPanel {
protected DefaultMutableTreeNode racine;
JTree tree;
protected JScrollPane scrollpane;
final static int MAX_LEVEL = 1; // niveau max de descente "direct" dans l'arborescence
* Sous-classe FSNode
* @author Frederic FOURGEOT
* @version 1.0
private class FSNode extends DefaultMutableTreeNode {
File file; // contient le fichier li� au noeud
* Constructeur non visible
private FSNode() {
super();
* Constructeur par initialisation
* @param userObject Object
FSNode(Object userObject) {
super(userObject);
* Constructeur par initialisation
* @param userObject Object
* @param newFile File
FSNode(Object userObject, File newFile) {
super(userObject);
file = newFile;
* Definit le fichier lie au noeud
* @param newFile File
public void setFile(File newFile) {
file = newFile;
* Renvoi le fichier lie au noeud
* @return File
public File getFile() {
return file;
public JTree getJTree(){
return tree ;
* Constructeur
* @throws HeadlessException
public JTreeFolder() throws HeadlessException {
File[] drive;
tree = new JTree();
// cr�ation du noeud sup�rieur
racine = new DefaultMutableTreeNode("Poste de travail");
// cr�ation d'un noeud pour chaque lecteur
drive = File.listRoots();
for (int i = 0 ; i < drive.length ; i++) {
FSNode node = new FSNode(drive, drive[i]);
addFolder(drive[i], node); // on descend dans l'arborescence du lecteur jusqu'� MAX_LEVEL
racine.add(node);
// Gestion d'evenement sur JTree (on �coute les evenements TreeExpansion)
tree.addTreeExpansionListener(new TreeExpansionListener() {
public void treeExpanded(TreeExpansionEvent e) {
// lorsqu'un noeud est ouvert
// on descend dans l'arborescence du noeud jusqu'� MAX_LEVEL
TreePath path = e.getPath();
FSNode node = (FSNode)path.getLastPathComponent();
addFolder(node);
((DefaultTreeModel)tree.getModel()).reload(node); // on recharche uniquement le noeud
public void treeCollapsed(TreeExpansionEvent e) {
// lorsqu'un noeud est referm�
//RIEN
// alimentation du JTree
DefaultTreeModel model = new DefaultTreeModel(racine);
tree.setModel(model);
setLayout(null);
// ajout du JTree au formulaire
tree.setBounds(0, 0, 240, 290);
scrollpane = new JScrollPane(tree);
add(scrollpane);
scrollpane.setBounds(0, 0, 240, 290);
* Recuperation des sous-elements d'un repertoire
* @param driveOrDir
* @param node
public void addFolder(File driveOrDir, DefaultMutableTreeNode node) {
setCursor(new Cursor(3)); // WAIT_CURSOR est DEPRECATED
addFolder(driveOrDir, node, 0);
setCursor(new Cursor(0)); // DEFAULT_CURSOR est DEPRECATED
* Recuperation des sous-elements d'un repertoire
* (avec niveau pour r�cursivit� et arr�t sur MAX_LEVEL)
* @param driveOrDir File
* @param node DefaultMutableTreeNode
* @param level int
private void addFolder(File driveOrDir, DefaultMutableTreeNode node, int level) {
File[] fileList;
fileList = driveOrDir.listFiles();
if (fileList != null) {
sortFiles(fileList); // on tri les elements
// on ne cherche pas plus loin que le niveau maximal d�finit
if (level > MAX_LEVEL - 1) {return;}
// pour chaque �l�ment
try {
for (int i = 0; i < fileList.length; i++) {
// en fonction du type d'�l�ment
if (fileList[i].isDirectory()) {
// si c'est un r�pertoire on cr�� un nouveau noeud
FSNode dir = new FSNode(fileList[i].getName(), fileList[i]);
node.add(dir);
// on recherche les �l�ments (r�cursivit�)
addFolder(fileList[i], dir, ++level);
if (fileList[i].isFile()) {
// si c'est un fichier on ajoute l'�l�ment au noeud
node.add(new FSNode(fileList[i].getName(), fileList[i]));
catch (NullPointerException e) {
// rien
* Recuperation des sous-elements d'un noeud
* @param node
public void addFolder(FSNode node) {
setCursor(new Cursor(3)); // WAIT_CURSOR est DEPRECATED
for (int i = 0 ; i < node.getChildCount() ; i++) {
addFolder(((FSNode)node.getChildAt(i)).getFile(), (FSNode)node.getChildAt(i));
setCursor(new Cursor(0)); // DEFAULT_CURSOR est DEPRECATED
* Tri une liste de fichier
* @param listFile
public void sortFiles(File[] listFile) {
triRapide(listFile, 0, listFile.length - 1);
* QuickSort : Partition
* @param listFile
* @param deb
* @param fin
* @return
private int partition(File[] listFile, int deb, int fin) {
int compt = deb;
File pivot = listFile[deb];
int i = deb - 1;
int j = fin + 1;
while (true) {
do {
j--;
} while (listFile[j].getName().compareToIgnoreCase(pivot.getName()) > 0);
do {
i++;
} while (listFile[i].getName().compareToIgnoreCase(pivot.getName()) < 0);
if (i < j) {
echanger(listFile, i, j);
} else {
return j;
* Tri rapide : quick sort
* @param listFile
* @param deb
* @param fin
private void triRapide(File[] listFile, int deb, int fin) {
if (deb < fin) {
int positionPivot = partition(listFile, deb, fin);
triRapide(listFile, deb, positionPivot);
triRapide(listFile, positionPivot + 1, fin);
* QuickSort : echanger
* @param listFile
* @param posa
* @param posb
private void echanger(File[] listFile, int posa, int posb) {
File tmpFile = listFile[posa];
listFile[posa] = listFile[posb];
listFile[posb] = tmpFile;
Maybe you are looking for
-
Add a second hard drive to the T-400
I would like to add a second internal hard drive to my T400. That requires a hard drive bay adapter and the 2nd drive. The 2nd drive is added to the bay adapter, and then the adapter is inserted in the T-400, in an existing media bay (?). Anyone done
-
Using Javascript to reset a form on document load
I am trying to reset all field vaules on a acrobat form to the default values, when the form is initially loaded. I am trying to use the resetForm() method in a document level script, but not having any luck. I have been able to reset fields after u
-
Hi Is it possible to create a formula that converts a resource available hours into full time equivalent units in project server 2010? Say a resource has 160 available hours for any given month this will translate into 1 FTE for this month. If it is
-
Problem with CMIS-Connector in version 4.2
Hi, we are developing our own CMIS-Server to connect our DAM with Adobe Drive. Since Drive was updated to 4.2, we noticed that it sends a lot of parent-requests to the server (/parents?id=) after getting the children of a folder. We don't see why the
-
Where are the Auidio/ Video Settings
Capture tells me to adjust the Audio/Video settings. Where are these settings and what do I set them to.