Run remote batch file from Web Application Server
Hello,
I've developyed a Java program and deployed it on WAS v7.1.
My java program tries to run a remote batch file which is located on remote Windows file system (and not on the WAS file system itself).
The batch file was launched on the remote server (I saw it on the Task Manager of the remote server), but the remote batch file actually wasn't run (it was stuck).
In order to run the remote batch file from my java program that is deployed on the WAS I've created a batch file on the WAS file system which its contnet is:
cd c:\jobs
psexec.exe
iltlvt40 -u SAPServiceCE1 -p a2i2000! c:\automation\DiskSpace\runDiskSpace.bat
The jobs folder contains the psexec.exe file (you can find more details about the psexec on this link: http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx).
iltlvt40 is the remote server.
SAPServiceCE1/a2i2000! is a user/password on the remote server which has a full permissions.
My java program calls this batch file using the Runtime.exec() java method in order to run the remote batch file.
Please guide me how to solve this problem?
Best regards,
Ahmad
Hi,
To which batch file you have meant to add some commands: for the local one or remote?
I've added to the local one some different commands and it's works.
I think there is a permission problem when we are trying to go out of the WAS file system.
Best regards,
Ahmad
Similar Messages
-
Run a batch file from demantra workflow
I am trying to run a batch file from demantra's workflow by creating an executable step.
I am getting the following error.
Error description ’’Invalid command line:’’"D:\Oracle Demantra Spectrum\Collaborator\demantra\sop\populate_staging.bat"
I am giving the following value in command line of executable step.
"#application_root#\sop\populate_staging.bat"
The batch file exists in the appropriate folder.
Following code is in the batch file.
sqlldr userid=msdem/msdem@demsbx control=load_item_hier.ctl
Please help me.
ThanksThis should work for you-
Create a batch file on your current server (ODI) and write in the path to the other batch file on the other server.
//Server2completename/D$/Path/yourbatchfile.bat
From ODI call your batch file that you created on the same machine.. which will inturn call the other batch file on a different machine to execute batch client.
Also can you paste the errors that you may be getting.. need to check if you are getting any specific issue related to this.
Thanks
Denzz -
File from the Application server
Hi gurus,
I am working on a scenario where I need to get a file from the application server and for this I need to ask user to enter the location and that too at the selection screen and then I need to read this location using open data set and read data set in my program , once I am done with this I need to do some other validations. so can you please help me out how to achieve this.
Thanks
Rajeev GuptaHi
Declare the selection screen with file as parameter so that the user enter the application server file..
the use the OPEND DATASET as mentioned in below code and process
Refer this:
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm
ABAP code for uploading a TAB delimited file into an internal table. See code below for structures.
*& Report ZUPLOADTAB * &----
*& Example of Uploading tab delimited file *
REPORT zuploadtab .
PARAMETERS: p_infile LIKE rlgrap-filename
OBLIGATORY DEFAULT '/usr/sap/'..
DATA: ld_file LIKE rlgrap-filename.
*Internal tabe to store upload data
TYPES: BEGIN OF t_record,
name1 like pa0002-VORNA,
name2 like pa0002-name2,
age type i,
END OF t_record.
DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
wa_record TYPE t_record.
*Text version of data table
TYPES: begin of t_uploadtxt,
name1(10) type c,
name2(15) type c,
age(5) type c,
end of t_uploadtxt.
DATA: wa_uploadtxt TYPE t_uploadtxt.
*String value to data in initially.
DATA: wa_string(255) type c.
constants: con_tab TYPE x VALUE '09'.
*If you have Unicode check active in program attributes then you will
*need to declare constants as follows:
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
*START-OF-SELECTION
START-OF-SELECTION.
ld_file = p_infile.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
ELSE.
DO.
CLEAR: wa_string, wa_uploadtxt.
READ DATASET ld_file INTO wa_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
wa_uploadtxt-name2
wa_uploadtxt-age.
MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
APPEND wa_upload TO it_record.
ENDIF.
ENDDO.
CLOSE DATASET ld_file.
ENDIF.
*END-OF-SELECTION
END-OF-SELECTION.
*!! Text data is now contained within the internal table IT_RECORD
Display report data for illustration purposes
loop at it_record into wa_record.
write:/ sy-vline,
(10) wa_record-name1, sy-vline,
(10) wa_record-name2, sy-vline,
(10) wa_record-age, sy-vline.
endloop.
Regards
Anji -
Upload tab-delimited file from the application server to an internal table
Hello SAPients.
I'm using OPEN DATASET..., READ DATASET..., CLOSE DATASET to upload a file from the application server (SunOS). I'm working with SAP 4.6C. I'm trying to upload a tab-delimited file to an internal table but when I try load it the fields are not correctly separated, in fact, they are all misplaced and the table shows '#' where supposedly there was a tab.
I tried to SPLIT the line using as separator a variable with reference to CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB but for some reason that class doesn't exist in my system.
Do you know what I'm doing wrong? or Do you know a better method to upload a tab-delimited file into an internal table?
Thank you in advance for your help.Try:
REPORT ztest MESSAGE-ID 00.
PARAMETER: p_file LIKE rlgrap-filename OBLIGATORY.
DATA: BEGIN OF data_tab OCCURS 0,
data(4096),
END OF data_tab.
DATA: BEGIN OF vendor_file_x OCCURS 0.
* LFA1 Data
DATA: mandt LIKE bgr00-mandt,
lifnr LIKE blf00-lifnr,
anred LIKE blfa1-anred,
bahns LIKE blfa1-bahns,
bbbnr LIKE blfa1-bbbnr,
bbsnr LIKE blfa1-bbsnr,
begru LIKE blfa1-begru,
brsch LIKE blfa1-brsch,
bubkz LIKE blfa1-bubkz,
datlt LIKE blfa1-datlt,
dtams LIKE blfa1-dtams,
dtaws LIKE blfa1-dtaws,
erdat LIKE lfa1-erdat,
ernam LIKE lfa1-ernam,
esrnr LIKE blfa1-esrnr,
konzs LIKE blfa1-konzs,
ktokk LIKE lfa1-ktokk,
kunnr LIKE blfa1-kunnr,
land1 LIKE blfa1-land1,
lnrza LIKE blfa1-lnrza,
loevm LIKE blfa1-loevm,
name1 LIKE blfa1-name1,
name2 LIKE blfa1-name2,
name3 LIKE blfa1-name3,
name4 LIKE blfa1-name4,
ort01 LIKE blfa1-ort01,
ort02 LIKE blfa1-ort02,
pfach LIKE blfa1-pfach,
pstl2 LIKE blfa1-pstl2,
pstlz LIKE blfa1-pstlz,
regio LIKE blfa1-regio,
sortl LIKE blfa1-sortl,
sperr LIKE blfa1-sperr,
sperm LIKE blfa1-sperm,
spras LIKE blfa1-spras,
stcd1 LIKE blfa1-stcd1,
stcd2 LIKE blfa1-stcd2,
stkza LIKE blfa1-stkza,
stkzu LIKE blfa1-stkzu,
stras LIKE blfa1-stras,
telbx LIKE blfa1-telbx,
telf1 LIKE blfa1-telf1,
telf2 LIKE blfa1-telf2,
telfx LIKE blfa1-telfx,
teltx LIKE blfa1-teltx,
telx1 LIKE blfa1-telx1,
xcpdk LIKE lfa1-xcpdk,
xzemp LIKE blfa1-xzemp,
vbund LIKE blfa1-vbund,
fiskn LIKE blfa1-fiskn,
stceg LIKE blfa1-stceg,
stkzn LIKE blfa1-stkzn,
sperq LIKE blfa1-sperq,
adrnr LIKE lfa1-adrnr,
mcod1 LIKE lfa1-mcod1,
mcod2 LIKE lfa1-mcod2,
mcod3 LIKE lfa1-mcod3,
gbort LIKE blfa1-gbort,
gbdat LIKE blfa1-gbdat,
sexkz LIKE blfa1-sexkz,
kraus LIKE blfa1-kraus,
revdb LIKE blfa1-revdb,
qssys LIKE blfa1-qssys,
ktock LIKE blfa1-ktock,
pfort LIKE blfa1-pfort,
werks LIKE blfa1-werks,
ltsna LIKE blfa1-ltsna,
werkr LIKE blfa1-werkr,
plkal LIKE lfa1-plkal,
duefl LIKE lfa1-duefl,
txjcd LIKE blfa1-txjcd,
sperz LIKE lfa1-sperz,
scacd LIKE blfa1-scacd,
sfrgr LIKE blfa1-sfrgr,
lzone LIKE blfa1-lzone,
xlfza LIKE lfa1-xlfza,
dlgrp LIKE blfa1-dlgrp,
fityp LIKE blfa1-fityp,
stcdt LIKE blfa1-stcdt,
regss LIKE blfa1-regss,
actss LIKE blfa1-actss,
stcd3 LIKE blfa1-stcd3,
stcd4 LIKE blfa1-stcd4,
ipisp LIKE blfa1-ipisp,
taxbs LIKE blfa1-taxbs,
profs LIKE blfa1-profs,
stgdl LIKE blfa1-stgdl,
emnfr LIKE blfa1-emnfr,
lfurl LIKE blfa1-lfurl,
j_1kfrepre LIKE blfa1-j_1kfrepre,
j_1kftbus LIKE blfa1-j_1kftbus,
j_1kftind LIKE blfa1-j_1kftind,
confs LIKE lfa1-confs,
updat LIKE lfa1-updat,
uptim LIKE lfa1-uptim,
nodel LIKE blfa1-nodel.
DATA: END OF vendor_file_x.
FIELD-SYMBOLS: <field>,
<field_1>.
DATA: delim TYPE x VALUE '09'.
DATA: fld_chk(4096),
last_char,
quote_1 TYPE i,
quote_2 TYPE i,
fld_lth TYPE i,
columns TYPE i,
field_end TYPE i,
outp_rec TYPE i,
extras(3) TYPE c VALUE '.,"',
mixed_no(14) TYPE c VALUE '1234567890-.,"'.
OPEN DATASET p_file FOR INPUT.
DO.
READ DATASET p_file INTO data_tab-data.
IF sy-subrc = 0.
APPEND data_tab.
ELSE.
EXIT.
ENDIF.
ENDDO.
* count columns in output structure
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
columns = sy-index.
ENDDO.
* Assign elements of input file to internal table
CLEAR vendor_file_x.
IF columns > 0.
LOOP AT data_tab.
DO columns TIMES.
ASSIGN space TO <field>.
ASSIGN space TO <field_1>.
ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
SEARCH data_tab-data FOR delim.
IF sy-fdpos > 0.
field_end = sy-fdpos + 1.
ASSIGN data_tab-data(sy-fdpos) TO <field_1>.
* Check that numeric fields don't contain any embedded " or ,
IF <field_1> CO mixed_no AND
<field_1> CA extras.
TRANSLATE <field_1> USING '" , '.
CONDENSE <field_1> NO-GAPS.
ENDIF.
* If first and last characters are '"', remove both.
fld_chk = <field_1>.
IF NOT fld_chk IS INITIAL.
fld_lth = strlen( fld_chk ) - 1.
MOVE fld_chk+fld_lth(1) TO last_char.
IF fld_chk(1) = '"' AND
last_char = '"'.
MOVE space TO fld_chk+fld_lth(1).
SHIFT fld_chk.
MOVE fld_chk TO <field_1>.
ENDIF. " for if fld_chk(1)=" & last_char="
ENDIF. " for if not fld_chk is initial
* Replace "" with "
DO.
IF fld_chk CS '""'.
quote_1 = sy-fdpos.
quote_2 = sy-fdpos + 1.
MOVE fld_chk+quote_2 TO fld_chk+quote_1.
ELSE.
MOVE fld_chk TO <field_1>.
EXIT.
ENDIF.
ENDDO.
<field> = <field_1>.
ELSE.
field_end = 1.
ENDIF.
SHIFT data_tab-data LEFT BY field_end PLACES.
ENDDO.
APPEND vendor_file_x.
CLEAR vendor_file_x.
ENDLOOP.
ENDIF.
CLEAR data_tab.
REFRESH data_tab.
FREE data_tab.
Rob -
Error executing batch file within web application
Hi all,
I am trying to execute a batch file from within my web application (struts 1.2).
The batch file is being kept inside the 'src' folder. The batch file contains only one command to open NOTEPAD.
The code inside my Action class is:
URL url = getClass().getResource("/test.bat");
java.io.File file = new java.io.File(url.getPath()) ;
String path = file.getCanonicalPath();
r.exec(path);
I have deployed this on tomcat and get an error like this:
java.io.IOException: Cannot run program "C:\Program%20Files\Apache%20Software%20Foundation\Tomcat%206.0\webapps\CIGTAFAPP\WEB-INF\classes\test.bat": CreateProcess error=2, The system cannot find the file specified
The problem is not with the batch file because when I try to execute the file directly from the classes folder, it opens up the notepad editor.
I have a specific requirement where I need to create/read this batch file from within the project structure.
Can someone please help me with this?
RegardsThe entire content of the file is as below:
set javaTestProjectPath=D:\projects\CIGTAF\LRTestCases
C:
cd %javaTestProjectPath%
set path=C:\Program Files\Java\jdk1.6.0_21\bin
set classpath=%javaTestProjectPath%\bin;%javaTestProjectPath%\lib\selenium-server-standalone-2.20.0.jar;%javaTestProjectPath%\lib\testng-6.4.jar;%javaTestProjectPath%\lib\junit-4.10.jar;%javaTestProjectPath%\lib\poi-3.6-20091214.jar;%javaTestProjectPath%\lib\mail.jar
javac -verbose %javaTestProjectPath%\src\com\core\testscripts\Mailsetup.java -d %javaTestProjectPath%\bin
javac -verbose %javaTestProjectPath%\src\com\core\testscripts\MailAuthenticator.java -d %javaTestProjectPath%\bin
javac -verbose %javaTestProjectPath%\src\com\core\testscripts\ReadData.java -d %javaTestProjectPath%\bin
javac -verbose %javaTestProjectPath%\src\com\core\testscripts\ReadWriteExcelResults.java -d %javaTestProjectPath%\bin
javac -verbose %javaTestProjectPath%\src\com\core\testscripts\SeleniumFramework.java -d %javaTestProjectPath%\bin
java org.testng.TestNG %javaTestProjectPath%\SelXD-Config.xml -d %javaTestProjectPath%\test-output
none of these are getting executed.
regards
Edited by: 887789 on May 4, 2012 1:46 AM -
Running a batch file kept on the server
Hi ,
I need to upload a file onto the application server then i have to call a batch file from my ABAP code kept on the same server .
The batch file takes 3 inputs the uploaded filename onto the server the new file name ( that can be any name ) and the delete flag parameter ( 0 or 1 ).
Is there any function module to do the same ??Hi,
Follow the steps:
1) Define external operating system command say zcopytm1 using SM69 by using the following parameters:
Command name Operating system Type
ZCOPYTM1 Windows NT Customer
Operating system command
e:\tm1out\tm1ph.bat
Parameters for operating system command
Leave this blank
tm1ph.bat is the batch file which it will execute.
2) First test it using SM49. Once satisfied use the following code to execute it thru ABAP:
DATA: BEGIN OF t_copy OCCURS 1.
INCLUDE STRUCTURE btcxpm.
DATA: END OF t_copy.
DATA: statusline LIKE btcxp3-exitstat.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'zcopytm1'
status = statusline
TABLES
exec_protocol = t_copy
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
CASE sy-subrc.
WHEN 0.
MESSAGE s999 WITH 'File has been copied in G:\public\tm1ph'.
WHEN 1.
MESSAGE s999 WITH 'No_permission'.
WHEN 2.
MESSAGE s999 WITH 'Command_not_found'.
WHEN 3.
MESSAGE s999 WITH 'Parameters_too_long'.
WHEN 4.
MESSAGE s999 WITH 'Security_risk'.
WHEN 5.
MESSAGE s999 WITH 'Wrong_check_call_interface'.
WHEN 6.
MESSAGE s999 WITH 'Program_start_error'.
WHEN 7.
MESSAGE s999 WITH 'Program_termination_error'.
WHEN 8.
MESSAGE s999 WITH 'X_error'.
WHEN 9.
MESSAGE s999 WITH 'Parameter_expected'.
WHEN 10.
MESSAGE s999 WITH 'Too_many_parameters'.
WHEN 11.
MESSAGE s999 WITH 'Illegal_command'.
WHEN 12.
MESSAGE s999 WITH 'Wrong_asynchronous_parameters'.
WHEN 13.
MESSAGE s999 WITH 'Cant_enq_tbtco_entry'.
WHEN 14.
MESSAGE s999 WITH 'Jobcount_generation_error'.
ENDCASE.
I hope this helps,
Regards
Raju Chitale
Edited by: Raju Chitale on Dec 22, 2008 5:38 AM -
URGENT:- Running a batch file from java program
Author: pkanury
I am trying to execute a batch file from my java program using RunTime and Process . It can execute any dos command except for a batch file. Can anyone throw
some light ?? My code looks like this .....
cmd = "command.com /c X:\\grits\\scripts\\test.bat"; Runtime rt = Runtime.getRuntime(); Process p = rt.exec(cmd);
The weird part is that p.waitFor() returns a status of 0 implying that the cmd has been executed successfully. But that is not the case. And my batch file is as simple as - type "ADADA" > junk.txt
Any help would be appreciated.I think it should work when you use a String[] array
instead of a single String:
String[] cmd = { "command.com", "/C", "D:\\batch\\do.bat" };
Note: If the batchfile creates any output (i.e. files),
they will be stored in the directory of the application
which calls the batch file, not in d:\batch\... -
How to run a batch file from within an Oracle 9i Form?
Hi, I would like to execute a batch file from within an oracle form - I'm assuming there's some PLSQL command I can use? I am not allowed to use any third party libraries, and I'm hoping I can get away without having to progam any C or Java to do it. I don't want to run my java program from my form, but my lecturer is insisting on it.
Can anyone help?
Thanx
AdamCan u give me an example
I need to run a batch files that does a series of step doing dir ( in 3 different folders)
after each one it shows on screen with a pause & user press enter
can this work out ? -
How to pull all the txt files from an application server to oracle server
hi
i got some 30 txt files on java application server. i have two questions
1) can java guys will be able to move those files to some oracle directory that will be used by create external table command.
2) can oracle do that using a stored procedure ..but then for it i think i have to create ftppkg and ftpbdy and call and connect each time...
which one is better and why?
regards
rajHi,
You can create procedure to move file from application server to oracle server.
Code for list all files in directory
ops$tkyte@8i> GRANT JAVAUSERPRIV to ops$tkyte
2 /
Grant succeeded.
That grant must be given to the owner of the procedure.. Allows them to read
directories.
ops$tkyte@8i> create global temporary table DIR_LIST
2 ( filename varchar2(255) )
3 on commit delete rows
4 /
Table created.
ops$tkyte@8i> create or replace
2 and compile java source named "DirList"
3 as
4 import java.io.*;
5 import java.sql.*;
6
7 public class DirList
8 {
9 public static void getList(String directory)
10 throws SQLException
11 {
12 File path = new File( directory );
13 String[] list = path.list();
14 String element;
15
16 for(int i = 0; i < list.length; i++)
17 {
18 element = list;
19 #sql { INSERT INTO DIR_LIST (FILENAME)
20 VALUES (:element) };
21 }
22 }
23
24 }
25 /
Java created.
ops$tkyte@8i>
ops$tkyte@8i> create or replace
2 procedure get_dir_list( p_directory in varchar2 )
3 as language java
4 name 'DirList.getList( java.lang.String )';
5 /
Procedure created.
ops$tkyte@8i>
ops$tkyte@8i> exec get_dir_list( '/tmp' );
PL/SQL procedure successfully completed.
ops$tkyte@8i> select * from dir_list where rownum < 5;
FILENAME
data.dat
.rpc_door
.pcmcia
ps_data
http://asktom.oracle.com/pls/asktom/f?p=100:11:3597961203953876::::P11_QUESTION_ID:439619916584 -
Run a batch file from separate windows box to invoke DRM batch client
I need your suggestions on the following.
ODI & DRM are installed on separate boxes.
Now I want ODI to invoke a batch file (kept on DRM - Windows box, this batch file invokes DRM batch client to export the metadata). I tried using shared folder concept,but no success.
Any pointers please?This should work for you-
Create a batch file on your current server (ODI) and write in the path to the other batch file on the other server.
//Server2completename/D$/Path/yourbatchfile.bat
From ODI call your batch file that you created on the same machine.. which will inturn call the other batch file on a different machine to execute batch client.
Also can you paste the errors that you may be getting.. need to check if you are getting any specific issue related to this.
Thanks
Denzz -
Error while extracting XML file from the application server
Hi ,
I am writing a XML file into the application server, after which when i try to extract the file to the local server using the report - RFASLDPC ,
the file is extracted, but with a '#' symbol at the first position.
Because of which the XML File does not open. But after i open the file in notepad and manually delete the '#' symbol and then reopen the file, it works fine.
Is there any way to remove the '#' symbol while extracting itself ??
Thanks in advance,
Vikas.Select the option "No Character Set Conversion" in stead of Code page 1100.
However, I still have troubles -> the downloaded xml file misses a space on several places. This causes errors too. -
Show browse files dialog by listing remote machin files in web application
Hi all,
I want to develop a web application which has "Browse Server" button to browse remote server. After selecting files and folders from remote server, need to read all files and folders from server and store that information in Database. Please provide some ideas and help regarding this.
I think that i need to develop a custom component based on jfilechooser to connect to server and show the selection dialog like windows file upload.
I don't no how to list server files and show as browse dialog to select and read those files.
Thanks in advance.
Regards,
Venkata Subba ReddyMost web browsers can browse FTP. You can achieve what you want without writing a single line of code. How cool is that?
-
How run a batch file from VBS script?
I have written a script in which I create a batch file that I want to run. Running it from the Start menu with "Run..." works fine but I would like to do it automatically from the script. I can't find a command that works but I am a beginner, so I'm hoping someone's got a solution?!
Hi again!
Thank you for your help but I've just discovered that my problem probably doesn't have to do with the way that I call for the batch file. It's more like this:
The batch file is run but it only does its job some of the times... The batch contains one name of a converter application (Convert.exe) and the names of some databases and files. I've been told that the conversion should work if Convert.exe is located in the same folder as the files. Which it also does, if I run the batch from "Run..." but not from my code.
I had it working for a while when I had fiddled (as I said, I'm a beginner at this) with setting some drives, such as userDrv and changing some paths in the script settings. Since I didn't really know what I was doing though, I didn't save these settings when closing down DIAdem and now it's not working again. When it worked, it only worked for the file where my .VBS was saved. The point of the program is to convert files in different folders so that wasn't enough.
Just for clearity: I can't write the name as "C:\My Folder..." because the batch file name and the folder it is situated in is different each time so I have variables for the path and the batch, but that part seems to work. (Call ExtProgram(batFilename_) where batFilename_ includes the path).
So I guess what I need to understand is how the different drives work or maybe I need to somehow change my path settings? -
Moving of flat file from the application server after upload.
Hi All,
I am uploading data from a flat file placed on the application server by a BDC program.
After the BDC has created the session i want to transfer the flat file from that folder to another folder on the application server by changing the name of the flatfile.
Can any one suggest the best way of doing this particular scenario?
Thanks in advance.
Regards
Satish Nair.Here is a sample program.
report zrich_0001.
data: d1 type localfile value '/usr/sap/TST/SYS/Data1.txt',
d2 type localfile value '/usr/sap/TST/SYS/Data2.txt'.
data: begin of itab occurs 0,
rec(20) type c,
end of itab.
data: wa(20) type c.
start-of-selection.
open dataset d1 for input in text mode.
if sy-subrc = 0.
do.
read dataset d1 into wa.
if sy-subrc <> 0.
exit.
endif.
itab-rec = wa.
append itab.
enddo.
endif.
close dataset d1.
open dataset d2 for output in text mode.
loop at itab.
transfer itab to d2.
endloop.
close dataset d2.
delete dataset d1.
Regards,
Rich Heilman -
How to delete File from the Application Server,ABAP
Hi Gurus,
I'm using DELETE DATASET Statement ,
Based on Date how can i delete files with in the period in the Application server
Any BAPI/FM for this Delete file based on some Date Period
Thanks in Advance.DATA: BEGIN OF file,
dirname(75) TYPE c, " name of directory. (possibly truncated.)
name(75) TYPE c, " name of entry. (possibly truncated.)
type(10) TYPE c, " type of entry.
len(8) TYPE p, " length in bytes.
owner(8) TYPE c, " owner of the entry.
mtime(6) TYPE p, " last modification date, seconds since 1970
mode(9) TYPE c, " like "rwx-r-x--x": protection mode.
useable(1) TYPE c,
subrc(4) TYPE c,
errno(3) TYPE c,
errmsg(40) TYPE c,
mod_date TYPE d,
mod_time(8) TYPE c, " hh:mm:ss
seen(1) TYPE c,
changed(1) TYPE c,
END OF file.
DATA: BEGIN OF file_list OCCURS 100,
dirname(75) TYPE c, " name of directory. (possibly truncated.)
name(75) TYPE c, " name of entry. (possibly truncated.)
type(10) TYPE c, " type of entry.
len(8) TYPE p, " length in bytes.
owner(8) TYPE c, " owner of the entry.
mtime(6) TYPE p, " last modification date, seconds since 1970
mode(9) TYPE c, " like "rwx-r-x--x": protection mode.
useable(1) TYPE c,
subrc(4) TYPE c,
errno(3) TYPE c,
errmsg(40) TYPE c,
mod_date TYPE d,
mod_time(8) TYPE c, " hh:mm:ss
seen(1) TYPE c,
changed(1) TYPE c,
END OF file_list.
DO.
CLEAR file.
CALL 'C_DIR_READ_NEXT'
ID 'TYPE' FIELD file-type
ID 'NAME' FIELD file-name
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.
if sy-subrc eq 0.
MOVE-CORRESPONDING file TO file_list.
APPEND file_list.
else.
exit.
endif.
enddo.
sort file_list based on date and time ie, MOD_DATE and MOD_TIME fields
and delete the entries
Maybe you are looking for
-
My songs on my playlist wont update on my ipod!
When i try to update my IPod it says- "Songs on the IPod cannot be updated becuase all of the playlists selected for updating no longer exist" but all my music is still in my Itunes and on my Playlist but not on my IPod? PLEASEEE HELP!!!
-
Hello, I have the following code: $ds = odbc_exec($conn,$strSql); //------ Create a new COM Object of Crytal Reports 10 ------ $ObjectFactory= new COM("CrystalReports11.ObjectFactory.1"); //------ Create a instance of library Applicat
-
Quad G5 with Dual 23's and GeForce 6600 problems
I bought this set up to take over as my main Photoshop station. I'm getting a few weird things though: 1. A ghost curser sits on the opposite monitor that I'm working on near the gutter of the two in the middle, very distracting. 2. when I'm working
-
Good Afternoon, Below is the error I have recieved. C:/javac Count.java 'javac' is not reconginezed as an internal or external command, operable program or batch file. I know some people have asked this before but the answers did not help me. I have
-
CP5: Is there a way I can set the resolution size before I start recording?
When I launch Adobe Captivate 5, I click on "Create New.. Software Simulation", but I can't find a way of setting the screen size / resolution before I start recording, like there is when you click "Create New... Blank Project". I prefer to do a new