How to check if file already exist in application server?
Hi there,
Does anyone know a quick way to check if a file has already exists in an application server?
Thanks in advance.
Cheers.
Call the function PFL_CHECK_OS_FILE_EXISTENCE.
Best regards Jack
FUNCTION PFL_CHECK_OS_FILE_EXISTENCE.
""Lokale Schnittstelle:
*" IMPORTING
*" FULLY_QUALIFIED_FILENAME LIKE TPFHT-PFFILE
*" EXPORTING
*" FILE_EXISTS LIKE BTCH0000-CHAR1
OPEN DATASET FULLY_QUALIFIED_FILENAME FOR INPUT.
IF SY-SUBRC EQ 0.
FILE_EXISTS = 'X'.
CLOSE DATASET FULLY_QUALIFIED_FILENAME.
ELSE.
CLEAR FILE_EXISTS.
ENDIF.
ENDFUNCTION.
Similar Messages
-
How to move PDF file from Spool to Application Server?
How to move PDF file from Spool to Application Server?
Cannot use RSTXPDFT4 because that converts OTF to PDF and the file is already PDF.
RSTXPDFT5 doesn't work. It picks the file up and assigns it a 'text' type and outputs a 1 line txt (1kb in size) on the server with the spool number in it!
The program which outputs the file to the spool, in the first place, uses adobe forms and outputs to a printer of type PDF.Hi Gemini ,
Please refer the below links.
[http://sap.ittoolbox.com/groups/technical-functional/sap-hr/convert-a-spool-to-pdf-and-save-on-application-server-in-background-720959]
[http://www.sapfans.com/forums/viewtopic.php?f=13&t=325628&start=15]
Edited by: Prasath Arivazhagan on Apr 13, 2010 4:48 PM -
How to send the file contents in the application server to ftp server
Hi,
how to send the file contents in the application server to ftp server.
regards,
sreeTest SAP FTP functions
DATA: BEGIN OF MTAB_DATA OCCURS 0,
LINE(132) TYPE C,
END OF MTAB_DATA.
DATA: MC_PASSWORD(20) TYPE C,
MI_KEY TYPE I VALUE 26101957,
MI_PWD_LEN TYPE I,
MI_HANDLE TYPE I.
START-OF-SELECTION.
MC_PASSWORD = 'password'.
DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.
*-- FTP_CONNECT requires an encrypted password to work
CALL 'AB_RFC_X_SCRAMBLE_STRING'
ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
ID 'DSTLEN' FIELD MI_PWD_LEN.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
USER = 'userid'
PASSWORD = MC_PASSWORD
HOST = 'servername'
RFC_DESTINATION = 'SAPFTP'
IMPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
NOT_CONNECTED = 1
OTHERS = 2.
CHECK SY-SUBRC = 0.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = MI_HANDLE
COMMAND = 'dir'
TABLES
DATA = MTAB_DATA
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF SY-SUBRC = 0.
LOOP AT MTAB_DATA.
WRITE: / MTAB_DATA.
ENDLOOP.
ELSE.
do some error checking.
ENDIF.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
OTHERS = 1.
Execute external commands (FTP Scripts)
The following code shows the syntax of the FM 'SXPG_COMMAND_EXECUTE'. You pass it the external command created within transaction SM69 and it will execute it.
DATA: ld_comline
LIKE sxpgcolist-name,
ld_param LIKE sxpgcolist-parameters,
ld_status LIKE extcmdexex-status,
ld_output LIKE btcxpm OCCURS 0 WITH HEADER LINE,
ld_subrc LIKE sy-subrc.
REFRESH ld_output.
MOVE 'FTP_DATA_IN' to ld_comline. "Maintained using trans SM69
Execute external command, contained in 'ld_comline'
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = ld_comline
additional_parameters = ld_param "Params passed to script
operatingsystem
= 'UNIX'
IMPORTING
status = ld_status
TABLES
exec_protocol = ld_output
EXCEPTIONS
no_permission
= 1
command_not_found
= 2
parameters_too_long
= 3
security_risk
= 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry
= 13
jobcount_generation_error
= 14
OTHERS
= 15.
IF sy-subrc NE 0.
ENDIF. -
Sql loader issue(How to specify a file that exists on remote server)
In sqlldr infile parameter I'd like to give a data file that exists on remote server.How can I specify???Please help me in the syntax.
Any help would be greatly appreciated.
Edited by: 792353 on Sep 24, 2010 7:22 AMsqlldr can accept any path that is VALID and it can be any type of share as long as the OS supports the share.
so INFILE can be anything you want as sqlldr will simply attempt to access it via the OS.
if you are on a linux box going to another linux box with an NSF mount point on the box running sqlldr simply reference:
INFILE '/mountpoint/fname'
Now I have never tried a UNC path before but I would guess that if you are on a windows box, going to another winddows box and the box running sqlldr was logged in with the right permissions it would simply be:
INFILE '\\server\directory\file'
I doubt that it will accept a URL as in:
INFILE '//servername.com/directory/file'
I don't think that sqlldr does anonymous ftp or htp file transfer protocol, but I could be wrong.
NOTE: I have found that it is best to ALWAYS surround your INFILE parameter with single quotes. -
How to upload a file in bdc from application server
how to upload a file in bdc from application server
Hi
Check if this is useful and reward.
PERFORM UNIX_UPLOAD.
FORM unix_upload.
DATA : lv_string(600) TYPE c.
lv_string = p_fname. "p_fname is the filename in path
OPEN DATASET lv_string FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc <> 0.
MESSAGE 'File Not Found' TYPE 'I'.
LEAVE PROGRAM.
ENDIF.
DO .
READ DATASET lv_string INTO gs_gfile.
IF sy-subrc NE 0 .
EXIT.
ENDIF.
APPEND gs_gfile TO gt_gfile .
CLEAR gs_gfile .
ENDDO.
CLOSE DATASET lv_string.
CLEAR lv_string.
DATA: lc_split TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
LOOP AT gt_gfile INTO gs_gfile .
SPLIT gs_gfile AT lc_split INTO
gs_ipfile-field1
gs_ipfile-field2.
ENDLOOP.
ENDFORM. "unix_upload
here gs_ipfile is the same structure as your input file to upload
and
gs_gfile is the work area of the internal table containing characters as :
TYPES : BEGIN OF ygs_gfile ,
data(600) ,
END OF ygs_gfile .
*Internal table declaration for input file as text
gt_gfile TYPE STANDARD TABLE OF ygs_gfile INITIAL SIZE 0 ,
*Work area declaration for input file
gs_gfile TYPE ygs_gfile .
Thanks and Regards
A Swarna -
How to check if nativemenu already exists?
In my simple example below, everytime you click on the link to reload the page, a new nativemenu is created along with the one that was already there... Click the HOME-INDEX link multiple times and you will see multiple copies of same menu pop up along the top.
How can I check to see if the menu already exists, so that it is NOT recreated everytime?
Using Air 1.5 on Win XP Pro.
Thanks
INDEX.HTML FILE;
<html>
<head>
<title>index.html example</title>
<script type="text/javascript" src="includes/AIRAliases.js"></script>
<script type="text/javascript" src="includes/AIRMenuBuilder.js"></script>
<script type="text/javascript">
var MainMenu = air.ui.Menu.createFromXML("source/MainMenu.xml");
air.ui.Menu.setAsMenu(MainMenu);
</script>
</head>
<body>
<h1>index.html example</h1>
<br>
<a href="index.html">HOME-INDEX</a>
</body>
</html>
SOURCE/MAINMENU.XML FILE:
<?xml version="1.0" encoding="utf-8" ?>
<root>
<menuitem label="File">
<menuitem label="Close" onSelect="doFileClose"/>
</menuitem>
<menuitem label="Help">
<menuitem label="About" onSelect="doHelpAbout"/>
</menuitem>
</root>I have not been able to figure out how to determine if the meny already exists or not, but I did come across using this:
var _MainMenu = air.ui.Menu.createFromXML("source/MainMenu.xml");
air.ui.Menu.setAsMenu(_MainMenu, true); //2nd paramter is Overwrite=true
instead of this:
var _MainMenu = air.ui.Menu.createFromXML("source/MainMenu.xml");
air.ui.Menu.setAsMenu(_MainMenu);//No second parameter specified, so assumes Overwrite=false
Adding the 2nd 'true' parameter still causes the menu to be created everytime, but it will OVERWRITE the previous menu, so there will only ever be one instance of the menu.
Depending on the size of the menu, it would probably be less cpu intensive to just use somekind of IF statement to determine if it already existed, but if that does not exist, then this is the only alternative I can find right now.
Thanks -
File not exist in application server
Dear experts,
Can anybody told me that if file not exist into the application server then what will happen to open dataset statement?
it will show error or what?
regards,
sameek.Dear Sameek,
Please check in code if file is exist then proceed next statement otherwise should not proceed with next statement.
Best Regards
Arun Jaiswal -
How to copy a file from Client to Application Server
Hello,
My requirement is user selects a file from Browse button on oracle form - this location is on client side, and have to copy this file on Application server.
I tried using webutil_file.copy_file function but it gives error - copy_file is not a procedure or is undefined.
There is another way of Client_to_AS but it needs some changes in configuration files of webutil, which is not allowed in our scenario.
Source - client machine resident file
Target- Application server disk location
So can any one help in this regard?Hi Francois,
Thanks for your suggestion, actually i didnt want to use Client_to_As as client doesnt want to make any changes in any configuration files, no matter how small the change is.
Anyways we are able to successfully copy the file using Client_to_AS, but one thing that i couldn't understand is why was our webutil_file.copy_file function failing?
Any hint about this?
Thanks!
Avinash.
Pune- India. -
How to check if Message already exists in the queue and if message is processing currently
Hi everyone
I am new to Azure and worked on adding messages to the queue through workerrole1. Worker role 2 pulls them out from queue and processing them and de-queing them.
Worker role1 runs method gets called after every 10 seconds and puts messages in queue
CloudQueueMessage
message = newCloudQueueMessage(oAzureWorker.WorkerInstanceOf
+ "_"+ oAzureWorker.AgentId.ToString()
+ "|"+ ExecutionId.ToString());
queue.AddMessage(message);
Worker role2 runs method gets called after every 10 seconds too and checks the queue like this
foreach
(CloudQueueMessagemessage
inqueue.GetMessages(20,
TimeSpan.FromMinutes(5)))
// Process all (20) messages in less than 5 minutes, deleting each message after processing.
// Process message
queue.DeleteMessage(message);
Following are my questions
1) How do I check in worker role1 if the message is already in queue, Because I don't want to queue it back again if its not yet processed and is in the queue already
2) How do I check in worker role1 if the message is currently processing. Because I don't want to queue it back again.
3) How do I make sure that ALL the messages get processed in the order they are inserted. I know Queue is FIFO, but I know if the message gets delayed in processing another instance can pick it up, even if it gets picked up by another instance, I want to
make sure that the order remains.
Right now the instances of both these worker roles are 1, in the future when we increase them, I don't want them to queue the same messages multiple times or queue them if the message is already in process mode.Hi Sarah,
I agree to the Frank's suggestion. Why you need to burden the worker role 1 to check if the message really sits on the queue or not? You can do this simply in your code before pushing it on queue instead querying queue.
All you need to do on worker role 1 is - push the message on the queue and forget as the entire queue design in azure is designed from asynchronous processing.
About worker role 2 - Use the GetMessage method which hides retrieved message's from other clients and hence makes sure that only one client is processing it at a time. If processing is successful - delete the message. if it is not - the message will be
visible anyways after the mentioned time provided in the GetMessage method.
I agree that when you will increase number of instances of your worker role 1 which might insert duplicates in the queue - in that case - you might need to introduce the shared entity (like database) and let all instances communicate through it to avoid
the duplication of messages on queue.
Bhushan | http://www.passionatetechie.blogspot.com | http://twitter.com/BhushanGawale -
How to store pdf file to presentation or application server, as i mentioned
hi,
I have used SO_NEW_DOCUMENT_ATT_SEND_API1 function module to send employ details through mail generating individual pdf files for each.but i need a copy of all files on to my computer also which has send through mail, what should i do?, can any one sugest me a function module or a sample code to achive this. Its urgent ,hope any one could help me in thisThanks This really helped.
For other readers, I am summarising what I did.
create table test
id number primary key,
docs BLOB
create or replace directory doc_loc
as 'c:\test';
CREATE OR REPLACE PROCEDURE Load_BLOB_From_File (file_name in varchar2)
AS
src_loc bfile:= bfilename('DOC_LOC',Load_BLOB_From_File.file_name);
dest_loc BLOB;
begin
insert into tkctsf15t values(1,empty_blob()) returning docs
into dest_loc;
dbms_lob.open(src_loc,DBMS_LOB.LOB_READONLY);
DBMS_LOB.OPEN(dest_loc, DBMS_LOB.LOB_READWRITE);
DBMS_LOB.LOADFROMFILE(
dest_lob => dest_loc
,src_lob => src_loc
,amount => DBMS_LOB.getLength(src_loc));
DBMS_LOB.CLOSE(dest_loc);
DBMS_LOB.CLOSE(src_loc);
COMMIT;
end;
show errors;
exec Load_BLOB_From_File('test.pdf');
exec ctx_ddl.create_preference('mylex','BASIC_LEXER');
create index testx on test(docs) indextype is ctxsys.context
parameters
('filter ctxsys.AUTO_FILTER LEXER mylex ');
select id from test where contains(docs,'patch')>0;
Thanks Roger once more -
Validate whether a file path or directory exists on application server
hi,
I need to validate if a directory or file path exist on application server. How do we do that?
thanks.DATA:
ltp_bom TYPE sychar01,
ltp_encoding TYPE sychar01,
ltp_codepage TYPE cpcodepage.
Processing --------------------------------------------------------- *
TRY.
CALL METHOD cl_abap_file_utilities=>check_utf8
EXPORTING
file_name = itp_filename
max_kb = -1
all_if_7bit_ascii = abap_true
IMPORTING
bom = ltp_bom
encoding = ltp_encoding.
CATCH cx_sy_file_open .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING file_open_error.
CATCH cx_sy_file_authority .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING file_authority_error.
CATCH cx_sy_file_io .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING file_io_error.
ENDTRY. -
How to check if the file already exists in the client directory
Hi all.
I'm on devsuite 10g. I'm using webutil to download files from DB using webutil function db_to_client.
What I need is to check if the file already exists in the client directory and if yes to display a message to ask the user if he wants to overwrite or no. How can I make this???
Here is the code that I'm using to download the file.
Thanks all for the collaboration.
Fabrizio
declare
file_path varchar2(2000) := null;
BEGIN
/** I ask where saving the file on the client machine **/
file_path:= webutil_file.file_selection_dialog
(directory_name => null,
file_name => :bin_docs.name,
file_filter => '',
title => 'Saving file',
dialog_type => save_file, --save_file
select_file => TRUE);
/** I download the file from DB to client **/
if webutil_file_transfer.DB_To_Client_With_Progress
( file_path ,
'BIN_DOCS',
'DOC' ,
'doc_id = '||:bin_docs.doc_id,
'Downloading file',
' '||:bin_docs.name) then
msg_alert('Download del file avvenuto con successo','I',false);
else
msg_alert('Si è verificato il seguente errore in fase di download '||SQLERRM,'I',false);
end if;
end;How about something like the below:
Note: I have a yes/no alert to asking if they want to over-write the existing file.
DECLARE
file_path VARCHAR2(2000) := null;
over_write BOOLEAN := TRUE;
BEGIN
/** I ask where saving the file on the client machine **/
file_path:= webutil_file.file_selection_dialog
(directory_name => null,
file_name => :bin_docs.name,
file_filter => '',
title => 'Saving file',
dialog_type => save_file, --save_file
select_file => TRUE);
IF webutil.file_exists(file_path) THEN
/** check a file by the same name exists in the selected directory **/
IF show_alert('Ask_overright') != alert_button1 THEN
/** If we say no then set over_write value to false **/
over_write := FALSE;
END IF;
END IF;
IF over_write THEN
/** I download the file from DB to client **/
IF webutil_file_transfer.DB_To_Client_With_Progress
( file_path ,
'BIN_DOCS',
'DOC' ,
'doc_id = '||:bin_docs.doc_id,
'Downloading file',
' '||:bin_docs.name) then
msg_alert('Download del file avvenuto con successo','I',false);
ELSE
msg_alert('Si è verificato il seguente errore in fase di'
||' download '||SQLERRM,'I',false);
END IF
END IF;
END;
cheers
Q -
How to check if the file already exists in the application server directory
Hi all. I'm on devsuite 10g.
I transfer file from local machine to application server using webutil function webutil_file_transfer.client_to_as and I want to check if the file I'm transfering already exists on the server directory.
How can I make this?
Thanks all,
Fabriziouse the text_io package and open the file in read-mode.
like this
declare
xFileType text_io.file_type;
begin
xFileType := text_io.fopen('c:\temp\test.txt','R'); --file on the middle tier
-- file exists;
text_io.fclose(xFileType);
exception
when others then
--file doesn't exist
end;
regards
Christian -
How do I make my already existing check boxes on a (PDF Document) checkable - So I can check and uncheck them on PDF Expert or Annotate 101.
I am using ADOBE Acrobat PRO with millions of options, but no easy "here is how to do the one thing you want to do" anywhere within reason.
Please help me.
Thank YouCan you check and uncheck the boxes in Acrobat?
-
How to fix 'file already exists, code 6' cs5.03 win7 64bit bluray please
hello,
at the last part of a 31gb bluray h264 iso image burn
encore stops responding for 20 minutes (disappears from task manager
and performance monitor entirely) and then says 'code 6 file already exists'
the same error has occurred twice at the very end of the build
i cleared the preferences each time
any help is appreciated...
jeffreyhello,
after a lot of reading and
some digging, figured out
how my system does things:
when you tell encore to write a bdmv folder
you come out with 2 folders: bdmv and a temp folder
using image burn you load up the first bdmv folder which contains
the streams, etc.
then tell image burn to load up the certificate folder
which is hiding in the temp/db/certificate directory
very clever...
disc burns successfully and menu navigation in tact on pc
and on hdtv through set top bluray
thanks for all the help...
have a great day...
jeffrey
Maybe you are looking for
-
How can I post a simple message in the User Forum's page, immediately after logging in ?
I had earlier asked a question re: including Merriam-Webster online dictionary into the list of search engines in the text area to the right of the location bar. I received a very helpful answer from cor-el, using which, I was able to include both th
-
Integrating XI 3.0 with PI 7.1 directly
Hi We have a need to directly integrate XI 3.0 ( SP23 ) with another Pi 7.1 ( SP7 ). Can we use XI adapter type to do this communication - has anybody out there done this and not faced issue using XI adapters to do this owing to this version diff
-
Some scenes displaced when dyn. linked from Premiere CS4
Hi - I've encountered an odd problem, and I was windering if anyone else has seen it. My system: Win 7 64 Prod Premium CS4 When dynamic linking a sequence from Pr to Encore, the rendered sequence has a few seconds where the image is moved about 1/3
-
New MacBook, New ipod, "Usb port drawing too much power" message?
I just got a new MacBook and ipod Nano, and when I plugged the ipod into the usb 2.0 port, a message came up saying a usb port was drawing too much power and would be shut down. i'm charged and plugged in, is the wire messed up, the port, or the nano
-
For some reason, the photographs I have in one folder won't load in to iPhoto. All I get is an exclamation mark although the images are definitely there because I can see them and the tag information is shown. They are *.jpg images which were importe