File path validation in the background fails - Urgent
Hi,
my program is to download files in the presentation server. so iam validating the file path using method CALL METHOD cl_gui_frontend_services=>directory_exist
but when i execute the program in the back ground its giving dump with a runtime error as OBJECTS_OBJREF_NOT_ASSIGNED.
could some body help on this
Neha
Hi.. neha,
use this function module..
EPS_OPEN_INPUT_FILE
give the file name and directory path as input to this function module..
if any exception raised like OPEN_FAILED then the file doesnot exist..(sy-subrc value will be set to 6 for this exception )..
so you can write the code as
call function '<b>EPS_OPEN_INPUT_FILE</b>'
exporting
file_name = '<b>ASDA</b>'
DIR_NAME = '<b>D:\usr\sap\R3S\DVEBMGS02\work</b>'
TEXT_MODE = ' '
IMPORTING
DIR_NAME =
FILE_PATH =
FILE_SIZE =
EXCEPTIONS
INVALID_EPS_SUBDIR = 1
SAPGPARAM_FAILED = 2
BUILD_DIRECTORY_FAILED = 3
NO_AUTHORIZATION = 4
BUILD_PATH_FAILED = 5
OPEN_FAILED = 6
READ_DIRECTORY_FAILED = 7
READ_ATTRIBUTES_FAILED = 8
OTHERS = 9
<b>if sy-subrc eq 6.
message 'file does not exist' type 'E'.
else.
write : 'file exists.'.
endif.</b>
ASDA is an existing file in my application server in the specified directory.. so am getting the message as FILE EXISTS.
you can see all the directories in Application server in transaction code AL11.
reward all helpful answers,
sai ramesh
Similar Messages
-
Retrieve the date a file was created in the background
EDITED CONTENT----
Apologies all...I just realized there is a specific forum for this type of question. I will post it there.
Thanks Marilyn for point this out>>>>should have read it first as suggested.
/message/2572763#2572763 [original link is broken]
Hi guru's,
I have a custom application that does some windows directory cleaning based an older than 'X' days setting. I have to do some calculation to determine if the file being processed is older than that number of day and delete it if it is. To determine the file created date I use the method DIRECTORY_LIST_FILES from CL_GUI_FRONTEND_SERVICES. This works great in the foreground but dumps in the background because the handle object reference is not created in the class constructor and subsequently does a call to a "NULL" object.
My question:
Does anyone know of a way to get the date a file was created while running in the background? If not, please read on --- I have another question regarding an alternate approach I am trying.
I have tried the following approach FM EPS_GET_DIRECTORY_LISTING to return an internal table with all files in a directory. Works fine in the background, but the created date is not in the return values. Soooooo I looped at the internal table and called this system function:
CALL 'C_FILE_ATTRIBUTES'
ID 'NAME' FIELD tempfile
ID 'TYPE' FIELD singleFile-
ID 'LEN' FIELD file-len
ID 'OWNER' FIELD file-owner
ID 'MTIME' FIELD file-mtime
ID 'MODE' FIELD file-mode
ID 'ERRNO' FIELD file-errno
ID 'ERRMSG' FIELD file-errmsg.
This returns the MTime, which is the Modified time (in Epoch time format: number of seconds since Midnight 1 January 1970), but no created time. Does anyone know the ID for the created time? I tried CTIME but no value is returned.
Along with this question: any idea if a FM or Method exists to convert Epoch time to a standard time. I could do the calculation myself....but it seems someone would have already done this. No point in re-creating the wheel.
Thanks so much,
Quack
Message was edited by:
Ryan QuackenbossI will be happy to.
Please post something to this thread.
Retrieve the date a file was created in the background
I UNMARKED this question as a post and reposted in the data transfer forum.
That post is still open. Once you post there, I will mark it ANSWERED and award points.
Thanks for the help
Quack -
it says there is an error "package name is Adobe Reader XI, upgrading at base path / installer. The upgrade failed.
It does this at 81%. I am using a MACit says there is an error "package name is Adobe Reader XI, upgrading at base path / installer. The upgrade failed.
It does this at 81%. I am using a MAC -
Hi,
I have to move my data from my program to a flat file on the Application/ Presentation Server. Now i need to validate whether the path provided by user is a valid one or not.
For eg. If the User enter \usr\sap\ in the presentation server path. The file shd not be saved there instead the user shd get a message to give the correct file path.
And in case of Application Server if the user enters c:\temp it shd not accept. Also if the user gives some random value ksdjfhakf.txt in the file path it shd not take.
Please let me know how can we acheive this.
Regards,
FSHi
Validating file path on the Presentation Server
To validate a file path on the presentation server, use the method directory_exist available in the class cl_gui_frontend_services.
Demo program to validate the file path on the presentation server:
REPORT zdir_test.
TYPE-POOLS: abap.
DATA: v_dir TYPE string.
DATA: v_bol TYPE abap_bool.
v_dir = 'c:\sap\'.
CALL METHOD cl_gui_frontend_services=>directory_exist
EXPORTING
directory = v_dir
RECEIVING
result = v_bol
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
not_supported_by_gui = 4
OTHERS = 5.IF NOT v_bol IS INITIAL.
WRITE:/ 'Directory exists.'.
ELSE.
WRITE:/ 'Directory does not exist.'.
ENDIF.
PLZ reward if helpful,
Thanks,
S.Gangi reddy. -
SSIS - Loop through files from a file path based on the value in the variable
Experts,
I have a requirement where I'll be loading multiple files in to a SQL server table and archive the files when loaded. However, the challenge is , the file path should be dynamic based on the value of a variable (say, @ProductName).
For example: If I am running the package for variable @ProductName="Product", the file path would be "\\....\Src\Product", in that case the ForEachLoop will loop through all the files in that folder, load them to the table and Archive
the files to the "\\....\Src\Product\Archive" folder.
Similarly, if the @ProductName="Product_NCP", the foreachloop container should loop through files in the "\\....\Src\Product_NCP" folder, load them to the table and archive them to the ""\\....\Src\Product_NCP\Archive"
folder.
Any suggestions? I should be able to run the package manually just by passing the "@Product" value, create Archive folder if it doesn't exist, load the data and archive the files.Yes
1. Have a variable inside SSIS to get folder path. Set path based on your rule using an expression
like
(@[User::ProductName] == "Product" ? "\\....\Src\Product" : (@[User::ProductName] == "Product_NCP" ? \\....\Src\Product_NCP:..))
similary archive
(@[User::ProductName] == "Product" ? "\\....\Src\Product\Archive" : (@[User::ProductName] == "Product_NCP" ? "\\....\Src\Product_NCP\Archive" :..))
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Remove file path and title from PDF? URGENT
I'm creating a PDF from multiple HTML files. The HTML document title appears at the top of the PDF page and the path/filename appears at the bottom of the PDF page. How do I remove those?
I'm working from someone else's PC. When I generate PDFs from other HTML docs on my PC, the title and file path do not appear, so I figured that there must be a setting that I used once and forgot. The help has not helped, not has searching the knowledgebase. I'm using Acrobat 8 on WinXP Pro.
Thanks!But I'm not using the Create from Web Page option. I'm using Create from Multiple Files. I'm combining 20 files from different folders.
-
Hi,
when I drag a pdf file (when working in Preview) into iBooks Author, the background colour in the pdf file changes into the background colour of the book.
This happens not consistently, sometimes the background of the pdf file does not change (and stays white), sometimes it's like the text in the pdf file is 'lifted' of the file, and put on the page in iBooks Author (with a brown/beige background).
All the pdf files are scanned pdf's, nothing comes out of Pages, Word, Excel,...
Anybody?
Thanks a lot!
WouterI have the same question (posted here: https://discussions.apple.com/message/25644741#25644741).
I believe this is because the PDFs have transparent backgrounds. As far as I can tell, the only way to fix it is to export the PDF as another file, such as an image file. Or perhaps convert it to Word and import it that way. -
Browse the File path selection in the selection screen
I want to give the user the option to browse his/her desktop and selct a file path and windows name by clicking on a drop down.
How do I do that?
Thank you in advancehi ,
there are so many function modules which will provide F4 Help for the path.
Suppose you have given a parameter name path.
You have to use these FMs in the event
AT SELECTION-SCREEN ON VALUE-REQUEST FOR path.
Example :
data : C_FNH_MASK TYPE DXFIELDS-FILEMASK VALUE '.',
SEARCH_DIR TYPE DXFIELDS-LONGPATH VALUE '/SAPGLOBAL/USERS',
FILE_PATH LIKE DXFIELDS-LONGPATH.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR path.
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
I_LOCATION_FLAG = 'P'
I_SERVER = ' '
I_PATH = SEARCH_DIR
FILEMASK = C_FNH_MASK
FILEOPERATION = 'R'
IMPORTING
O_PATH = PATH
EXCEPTIONS
RFC_ERROR = 1
OTHERS = 2.
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
I_LOCATION_FLAG = 'A'
I_SERVER = ' '
I_PATH = SEARCH_DIR
FILEMASK = C_FNH_MASK
FILEOPERATION = 'R'
IMPORTING
O_PATH = FILE_PATH
EXCEPTIONS
RFC_ERROR = 1
OTHERS = 2.
If you remove 'P' and put 'A', then it is used for application server F4 help.
you have F4_FILENAMEand F4_FILENAME_SERVER for presentation and application servers respectively
Reward points if helpful.
Thanks and Regards. -
File operation process at the background
Tell me please is background copying in explorere is action by design ? As well as confirmations on delete/remove - they are appearing at the background too.
For example i am at some folder, i choose some iso and press ctrl+c, then i press ctrl+v and what i see ? Nothing - process started at the background!Roger, he's talking about where the dialogs appear - BEHIND the other windows.
Yes, Windows 8.1 has "pop behind" Explorer dialogs. It has been happening since Windows 8 came out.
It CANNOT be by (good) design, though I am starting to wonder whether it's because of a lack of design.
When you REALLY learn to appreciate the gravity of this is when something like this happens:
You drag and drop a file to copy it and one of the dialogs pops behind
and prompts you for something (e.g., "do you want to overwrite"). You don't happen to notice its button light up on the Taskbar so you think the copy succeeded, then you do a bunch of work on the assumption that you're using the new
file, then only LATER do you realize it's still waiting for you to answer, to complete the copy.
A few weeks ago I went most of the way through a software release process and nearly released the old software again because of this.
It really does need to be fixed.
-Noel
Detailed how-to in my eBooks:
Configure The Windows 7 "To Work" Options
Configure The Windows 8 "To Work" Options -
Hi, I am trying to implement custom hold order / send to in sharepoint 2010 to send files in to holds / record center.
I am at the last step where I am trying submit the metadata using soap call- submit file
[SoapDocumentMethod("http://schemas.microsoft.com/sharepoint/soap/recordsrepository/SubmitFile", RequestNamespace = "http://schemas.microsoft.com/sharepoint/soap/recordsrepository/", ResponseNamespace = "http://schemas.microsoft.com/sharepoint/soap/recordsrepository/", Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public string SubmitFile([XmlElement(DataType = "base64Binary")] byte[] fileToSubmit, [XmlArrayItem(IsNullable = false)] Microsoft.SharePoint.RecordsRepositoryProperty[] properties, string recordRouting, string sourceUrl, string userName)
return (string)base.Invoke("SubmitFile", new object[] { fileToSubmit, properties, recordRouting, sourceUrl, userName })[0];
I am getting an error "The request failed with http status 401: Unauthorized".
Actual file was transferred successfully but while transferring the properties (metadata) I am getting this exception.
ganeshHi ganesh,
Please try to disable the loop back check, compare the result:
In Registry Editor, locate and then click the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
Right-click Lsa, point to New, and then click DWORD Value.
Type DisableLoopbackCheck, and then press ENTER.
Right-click DisableLoopbackCheck, and then click Modify.
In the Value data box, type 1, and then click OK.
Quit Registry Editor, and then restart your computer.
In addition, please check if these links are useful:
http://www.sharepointpills.com/2011/10/send-sharepoint-2010-document-to.html
http://www.codeproject.com/Articles/497729/UploadingplusDocumentsplusProgramaticallyplustoplu
I hope this helps.
Thanks,
Wendy
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Wendy Li
TechNet Community Support -
So i started an edit and had the whole thing finished and ready to export in Final Cut X, when i went to export I had a message pop up say that it couldn't export while FCP X is still referencing media. I went through trying to solve the problem and ended up deleting the source media folders in the Final Cut Events folder and reimporting the clips. This lead to a whole can of worms opening up and now i'm left with a whole edit with 90% of the clips in the timeline unable to relink to source media.
Can anyone help?First find the files. Then File>Relink Event Files and point to the folder.
-
How to check pc file path validity?
Hi,
In my program I have to extract so much SAP data and write in a file in the fornt-end PC. In the selection screen I will input the filepath\name to write the data.
But how should I check whether the filepath is valid or not in the 'AT SELECTION-SCREEN' event itself? so that if it is not valid path, I can give an error message before extracting all the SAP data.
Thank you!
Sunitha.Hi Sunitha,
Please check the following sample code from other thread at selection screen value request event.
Using ABAP Objects:
PARAMETER : p_file LIKE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR path.
DATA: directory TYPE string,
filetable TYPE filetable,
line TYPE LINE OF filetable,
rc TYPE i.
CALL METHOD cl_gui_frontend_services=>get_temp_directory
CHANGING
temp_dir = directory.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'SELECT THE FILE'
initial_directory = directory
file_filter = '*.XLS'
multiselection = ' '
CHANGING
file_table = filetable
rc = rc.
IF rc = 1.
READ TABLE filetable INDEX 1 INTO line.
P_FILE = line-filename.
ENDIF.
Using Normal ABAP:
DATA: P_FILE LIKE RLGRAP-FILENAME,
DPATH LIKE RLGRAP-FILENAME,
UPATH LIKE RLGRAP-FILENAME,
MODE TYPE C,
FLG_UD TYPE C.
CALL FUNCTION 'WS_ULDL_PATH'
IMPORTING
DOWNLOAD_PATH = DPATH
UPLOAD_PATH = UPATH.
IF FLG_UD <> 'D'.
DPATH = UPATH.
MODE = 'O'.
ELSE.
MODE = 'S'.
ENDIF.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = '*.XLS'
DEF_PATH = DPATH
MASK = ',*.XLS,*.*,*.*.'
MODE = MODE
IMPORTING
FILENAME = P_FILE
EXCEPTIONS
SELECTION_CANCEL = 3.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
Hope this will help.
Regards,
Ferry Lianto -
Background job finished but flat file not created in the Background
Dear all,
ZHR_CSD program is scheduled to run daily at 00:01:00. This program is generating the flat file in the folder CSD/HR.
when i schedule this program to run immediately it is generating the flat file.
But when i schedule this program in Background it is not generating flat file .
RegardsHi,
As suggested by Eric, your Z Program is probably using GUI_DOWNLOAD Function Module.
GUI_DOWNLOAD or any other GUI function modules (FM) will only run in foreground, not in Background.
Ask your developer to code that Z Program with OPEN DATASET logic, if its possible.
The Reverse situation is well described in [this thread|Background Job assigment with variant in SM37 , for Textfile uploading], please refer it to get some relative information for the same.
Regards,
Bhavik G. Shroff -
Hi,
I'm tryin to load an html file packaged in an Android app via loadURL of StageWebView.
On Flash Builder 4.5, the lightweight sim is available and I ran the following code on it (I set it as Nexus S).
webView = new StageWebView();
webView.loadURL("file:///android_asset/a.html");
a.html is put in the src directory of the mobile AS project and it's included in the assets directory of the release-build apk. But loadURL fails with exception. Does the built-in sim support android_asset access?OK. Then it's not an Android sim but just an AIR sim...
I wish it's possible to debug on the Android emulator. Flash Develop can do that. -
File path selected by the user!!! (File Download)
Hi,
Does exist a component, code line or any thing which emulate the Windows option <b>SAVE AS:</b> when the user does right click, but using a button to do this?
If somebody knows? I will appreciate it.
Thanks in advance!!!
Tokio Franco ChangNoufal
Thanks for your information!!! I found this post Re: Looking for example to export data from a DynPro table to Excel file which has code lines to export data from a Web Dynpro table to Excel file, it is saved perfectly in the local machine and save it in the server won't be problem.
Your recomendation about the post it is to provide a popup window to change the name and extension of the file, how can I make it? ... Is there an UI Element in NWDS?
Regards,
Tokio
Maybe you are looking for
-
Hi i have coded a button and added a Actionlistner that when the button is pressed then it should repaint the dice.but I don't know why it is not working. here i my code import java.awt.*; import javax.swing.*; import java.awt.event.*; import javax.s
-
How to alter the default profile for multiple users
I am trying to alter the default profile assigned to users during user creation to a new profile. I know to change the profile for one user using the syntax alter user abc profile profileabc The issue I have is that there are 100's of users under def
-
I up graded to 3.6 and want to go back to 3.5 version. How do i do this?
only older version is accepted at the school website i need to use
-
I have a Windows 7 Professional, 64 bits on my computer and have recently installed iTunes 11.1.3.8. but i started having this msg :"The folder iTunes is on a locked disk or you do not have write permission for this folder" issues: how can i solve it
-
Form / Layout template conversion
Hi, I have several form templates / layouts that have been created in Adobe Output Designer 5.5 (for mySAP) and I want to migrate these form templates so that they can been used in SAP Adobe Document Server. Does anyone have any information on this?