JSP executing FTP command
Hi All,
I'm a new developer in JSP. I'm just curious about Connecting to FTP Server by JSP. Can JSP use to execute ftp command or execute to FTP server? I want to display the list of files in directory on the ftp server. So, Please suggest your initiative or show the simple code for implement it.
Regards,
catjom
JavaWorld published an article about this topic. It is called "Java FTP client libraries reviewed" and it can be found here :
http://www.javaworld.com/javaworld/jw-04-2003/jw-0404-ftp.html
Best regards
Jean-Pierre Norguet
Jean-Pierre Norguet
JavaWorld Press
http://wasa.ulb.ac.be/jp.html
Similar Messages
-
Could not able to execute FTP commands in windows server machines 2012/ windows server 2008.
From windows server 2012 and windows server 2008, Opened port 20,21,22 in firewall bidirectionally. After Establishing connection by passing credentials 230 log in successful.
ftp commands executing getting as " 425 Use Port or PASV first" , "500 Illegal PORT command".
But I could able to do windows client machines like windows 7 and windows 8 with same environment
Note : Firewall ports are opened. have tested by making firewall down to avoid filters.
Pandiyan MuthuramanHi Pandiyan Muthuraman,
Did you mean even you disable or open the related port the FTP issue still exist? I found this errors most time occur when we use the ISA firewall and the FTP configured passive
mode, if you have ISA firewall please refer the following KB to fix this issue.
How to enable passive CERN FTP connections through ISA Server 2000, 2004, or 2006
http://support.microsoft.com/kb/300641
The have a specific form for the IIS question, if you have the further IIS related question you can ask in IIS forum.
IIS support forum
http://forums.iis.net/
Thanks for your understanding and support
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place. -
Hi,
I'm new to JSP. I'm just curious whether is there a utility in Java that we can use to execute unix command?
thanks.Hi,
You can try this,
import java.io.*;
public class test
public static void main(String args[]) {
try {
Process ps = Runtime.getRuntime().exec("ls -al");
BufferedReader br = new BufferedReader(new InputStreamReader(ps.getInputStream()));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(ps.getOutputStream()));
bw.write("1");
bw.flush();
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
br.close();
bw.close();
System.out.println(ps.exitValue());
catch(Exception e) {
System.out.println(e);
Hope that helps.
Regards,
Senthil Babu
Developer Technical Support
SUN Microsystems
http://www.sun.com/developers/support/ -
Error durig FTP Command Execution
Hi All,
I run the SE38 --> RSFTP002
and putting below parameters
User: ENGO
Pass: xxxxx
Host: 195.212.13.22 10001
Command: put c:/ftp.txt /In_test/ftp.txt
it takes 10 minutes when execute and got bellow error.
Execute FTP Command
put c:/ftp.txt /In_Test/ftp.txt
NIECONN_BROKEN:TCP/IP Network Connection Broken in getreply()
TCP/IP error, connection terminated
FYI .... i m facing this issue in my office LAN while it is working fine when i execute it from my home mean
different connection(DSL).
how can i resolve this issue and where is fault?
advance thanks,
majamilHi ,
Dear, there are execution and output following:
put c:\ftp.txt \In_test\ftp.txt
and
put c:/ftp.txt /In_Test/ftp.txt
Execute FTP Command
put c:\ftp.txt \In_Test\ftp.txt
NIECONN_BROKEN:TCP/IP Network Connection Broken in getreply()
TCP/IP error, connection terminated
and some time i got this error,
Execute FTP Command
put c:/ftp.txt /In_Test/ftp.txt
open c:/ftp.txt errno 22: Invalid argument
about your workstation firewall.
Firewall is Disable in client end and also server end.
Is it allowing the program SAPFTP to execute
when i put SAPFTP in run then i executed mean it display FTP prompt.
Did you check your SAPFTP RFC using RSFTP005?
SA38 --> RSFTP005
SAPFTP check
Check RFC destination SAPFTP..
... OK.
Ping RFC destination SAPFTP...
... OK.
Check RFC destination SAPFTPA.
... OK.
Ping RFC destination SAPFTPA..
... OK.
and also check from SM59 where connection test completed successfully.
regards, -
Executing "at" command of UNIX through JSP
Friends,
1. "at" command in UNIX execute Unix command at a scheduled time. 2. For each user there will be a table maintained internally which can be accessed by "at" with "-l" argument.
3. A mail will be sent to the owner with the output of the commands as a message.
I tried to run the "at" command of Unix in JSP, which gets succesfully executed in Oracle 10g App Server container (Installed in Solaris machine). I have tested the successful execution of command with the log file. But I haven't got any mail for the output. If anyone had any idea, please help me.
The code I have wtitten is
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(new String[] {"sh","-c","at 2115 Dec 7 < /export/home/usr1/abc.sh"});
InputStream stderr = proc.getErrorStream();
InputStreamReader isr = new InputStreamReader(stderr);
BufferedReader br = new BufferedReader(isr);
String line = null;
logger.info("<ERROR>");
while ( (line = br.readLine()) != null)
logger.info(line);
logger.info("</ERROR>");
int exitVal = proc.waitFor();
logger.info("Process exitValue: " + exitVal);
My doubts are:
1. Who is the owner of the output of "at"command, which gets executed under Oracle 10g App Server container?
2. If no one is the owner, then where will the output of "at" command will go?
3. Is there any other way to execute "at" command of UNIX in java program? If so, then please help me.
Thanks in advance.
regards
Nandha Kumar.MI would imagine the process call out will be under the guise of the process owner of the OC4J instance which executing the call.
Have you seen anything different.
cheers
-steve- -
How can I execute Linux commands through a JSP page on a Red Hat Linux 6.1 Machine using Tomcat 3.0
Please Mail your answer
[email protected]Hi Nick,
Thankx a lot, for suggestion,
I wanted to make a page which gives me a text box to write a command and below it shows the result of that command,
Say , I m in directory "/home/dhiraj"
and I write in command text box : "pwd"
it should give me the currrent path in result , which I can show in form of HTML as Results ,
(may be in a String form..)
same way if I write in command box : "ls -l"
it should Return me (say a String) the directory listing of the current path in result,
I have already tried the Runtime & Process class ,
Runtime rt = Runtime.getRuntime();
Process p =null;
p = rt.exec("command here");
p.waitFor();
it has following problems:
1) This way I m not able to get the result ..
2) I tried to make a zip file via my program it did not threw any exception , but could not execute...
I was confused is it 'coz of permission ( rights problem) or some programmatical error as the same program runs via a Java Class file ..
desperately waiting for ur suggestions
Dhiraj Agrawal
MCA student and a Trainee in a local Software House
reply to: [email protected] -
Need to execute Linux Commands in JSP
Hi I am Srinivas,
I am new to this forum,
{color:#ff0000}I want to execute Linux Commands(which is remotely connected through putty) in a JSP Page.{color}
{color:#0000ff}My requirement is to display df -h output on a JSP page.{color}
This is because we will monitor disk space at regular intervals.
Can anyone help me in this regard.
Thanks & Regards
Srinivas V.
Edited by: Srini-XIUS on Mar 24, 2008 2:06 AMI think you might need the java 'robot' class.
However, a JSP page displayed on a browser is running in a secure enviornment that will probably not let you access the computer its running on. Instead, create a serlvet back on the server that runs the robot class. The servlet will send the data to the jsp page for display. The jsp page can send commands to the servlet which will execute it via its robot class. -
How to Execute shell commands in OSB
Team,
My Requirement:
I have two sftp servers name ServerA and ServerB. Need to copy files from ServerA and place it on ServerB and change the file permissions to 777 after placing the files.
The user i am connecting to ServerB has the access to override file permissions.
Steps
1. With help of FTP adapter in OSB I am reading files from ServerA and writing on to ServerB -- Completed and is working.
2. How to override file permissions after placing the file ????? -- Yet to implement.
Please suggest me how can i accomodate 2nd step.
Thanks,
Suman V.If by "execute shell commands" you mean actually
running a shell process (as opposed to just forking
and executing specified programs) then I'd advise
against it. The last thing you want is for the
clients to be running arbitrary commands on the
server. You don't want to make it possible for the
client to run "rm -fr /" on your server.Right.
I was assuming (perhaps with more optimism than is really warranted) that the OP was going to be in complete control of which commands were executed--that there'd be a small, fixed set in response to certain user actions. -
Error while executing jdbc commands but getting connection pool
I was not able to make a simple oracle connection and that hurts me.
The program(jsp) is...
<%@ page language="java" import="java.sql.*,java.io.*,
java.util.*,pac1.*,javax.naming.*,javax.sql.*"%>
<html>
<body>
<%
Context ctx= new InitialContext();
DataSource dsindogulf1=(DataSource)ctx.lookup("jnindogulf1");
Connection conn=dsindogulf1.getConnection();
if(conn!=null)
System.out.println(conn.toString());
else
System.out.println("sorry");
Statement st=conn.createStatement();
String string1="CREATE TABLE Authorr(col1 CHAR(10));";
st.executeUpdate(string1);
%>
</body>
</html>
If i delete the
st.executeUpdate(string1); then there is no problem I get the connection pool. That means i am getting the connection. But when i include the
st.executeUpdate(string1); there is an error which i cannot understand.. the error is
Error 500--Internal Server Error
java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-00911: invalid character
at weblogic.jdbc.base.BaseExceptions.createException(Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
at weblogic.jdbc.base.BaseExceptions.getException(I[Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
at weblogic.jdbc.oracle.OracleImplStatement.execute()V(Optimized Method)
at weblogic.jdbc.base.BaseStatement.commonExecute()V(Optimized Method)
at weblogic.jdbc.base.BaseStatement.executeUpdateInternal()I(Unknown Source)
at weblogic.jdbc.base.BaseStatement.executeUpdate(Ljava.lang.String;)I(Unknown Source)
at weblogic.jdbc.wrapper.Statement.executeUpdate(Ljava.lang.String;)I(Statement.java:360)
at jsp_servlet.__test._jspService(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(__test.java:149)
at weblogic.servlet.jsp.JspBase.service(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(Optimized Method)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava.lang.Object;(Optimized Method)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;Lweblogic.servlet.internal.FilterChainImpl;)V(Optimized Method)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(Optimized Method)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()Ljava.lang.Object;(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(Optimized Method)
at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(Lweblogic.servlet.internal.ServletRequestImpl;Lweblogic.servlet.internal.ServletResponseImpl;)V(WebAppServletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(Lweblogic.kernel.ExecuteThread;)V(ServletRequestImpl.java:2630)
at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest;)V(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Source)
the steps which i have followed are... I have made a connection pool using weblogic type 4 driver in the administrative console... then i have created the data source using jndi name jnindogulf1..... but although i am getting the connection pool i am receiving error ehice executing jdbc commands
please help
thanksbabuli nayak wrote:
I was not able to make a simple oracle connection and that hurts me.
The program(jsp) is...
<%@ page language="java" import="java.sql.*,java.io.*,
java.util.*,pac1.*,javax.naming.*,javax.sql.*"%>
<html>
<body>
<%
Context ctx= new InitialContext();
DataSource dsindogulf1=(DataSource)ctx.lookup("jnindogulf1");
Connection conn=dsindogulf1.getConnection();
if(conn!=null)
System.out.println(conn.toString());
else
System.out.println("sorry");
Statement st=conn.createStatement();
String string1="CREATE TABLE Authorr(col1 CHAR(10));";
st.executeUpdate(string1);
%>
</body>
</html>
If i delete the
st.executeUpdate(string1); then there is no problem I get the connection pool. That means i am getting the connection. But when i include the
st.executeUpdate(string1); there is an error which i cannot understand.. the error is
Error 500--Internal Server Error
java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-00911: invalid character
at weblogic.jdbc.base.BaseExceptions.createException(Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
at weblogic.jdbc.base.BaseExceptions.getException(I[Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
at weblogic.jdbc.oracle.OracleImplStatement.execute()V(Optimized Method)
at weblogic.jdbc.base.BaseStatement.commonExecute()V(Optimized Method)
at weblogic.jdbc.base.BaseStatement.executeUpdateInternal()I(Unknown Source)
at weblogic.jdbc.base.BaseStatement.executeUpdate(Ljava.lang.String;)I(Unknown Source)
at weblogic.jdbc.wrapper.Statement.executeUpdate(Ljava.lang.String;)I(Statement.java:360)
at jsp_servlet.__test._jspService(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(__test.java:149)
at weblogic.servlet.jsp.JspBase.service(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(Optimized Method)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava.lang.Object;(Optimized Method)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;Lweblogic.servlet.internal.FilterChainImpl;)V(Optimized Method)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(Optimized Method)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()Ljava.lang.Object;(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(Optimized Method)
at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(Lweblogic.servlet.internal.ServletRequestImpl;Lweblogic.servlet.internal.ServletResponseImpl;)V(WebAppServletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(Lweblogic.kernel.ExecuteThread;)V(ServletRequestImpl.java:2630)
at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest;)V(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Source)
the steps which i have followed are... I have made a connection pool using weblogic type 4 driver in the administrative console... then i have created the data source using jndi name jnindogulf1..... but although i am getting the connection pool i am receiving error ehice executing jdbc commands
please help
thanks
Hi. Remove the semicolon from your SQL string: stmt.executeUpdate("CREATE TABLE Authorr(col1 CHAR(10))");Joe -
How to execute os command from ABAP program?
I want to execute some window commands from ABAP. What is the way to do it?
Hi,
See ht e coding below, I have used these Fm to connect to FTP server and get the Files..
*types for the ftp command result internal table
TYPES : BEGIN OF ty_result,
text TYPE char512,
END OF ty_result.
data it_result type standard table of ty_result.
*Connect to the FTP server
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = lv_user " user name pass word to connect
password = l_v_pwd
host = 'dev.eu.pm.com' " Host name here
rfc_destination = 'SAPFTPA' "destination name
*Ask your functional people for the above data
IMPORTING
handle = v_handle
EXCEPTIONS
not_connected = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
*Changing directory
CONCATENATE 'cd' '<file path>' INTO l_v_cmd SEPARATED BY space.
you can also ser 'DIR in l_v_cmd which opens the directory and all the folders *get into it_result table..
*Execute the FTP Command
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = v_handle
command = l_v_cmd
TABLES
data = it_result
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
ENDIF.
rewards if useful,
regards,
nazeer -
Calling Windows XP FTP Command in java
Hi there!
Need help in calling Windows XP FTP command in java:
executing the FTP command in DOS works well, but when I tried calling it in java using Process and Runtime objects, it successfully transferred the files from remote to my local pc... but I seemed to be stuck with .exec() and cannot continue with the other statements.
I know that I can use eFTPj or Apache Commons Net .. but I have no more time to study it since I have no more time left.
Any idea or suggestion? I badly need your help�
Take care and God bless,
MaDzSolution:
Better use Apache Commons Net - FTP for greater java support. -
How execute external command .sh in WorkFlow process?
Hi, i need execute a command, for example, <nombre>.sh with 3 parameters in a WF process.
This script .sh has command for execute ftp.
How can i do?
Thanks.Hi,
You need to wrap the call in either PL/SQL or Java and invoke that from a standard Workflow function API.
HTH,
Matt
WorkflowFAQ.com - the ONLY independent resource for Oracle Workflow development
Alpha review chapters from my book "Developing With Oracle Workflow" are available via my website http://www.workflowfaq.com
Have you read the blog at http://thoughts.workflowfaq.com ?
WorkflowFAQ support forum: http://forum.workflowfaq.com -
I am using FTP to save the a file from a local server to a remote server.
in the process, i form a connection and also execute command like ASCII, QUOTE PASV which all get successful.
but the main commands used to transfer or get file like GET, PUT are giving an error "INVALID COMMAND"
What could be any reason for this.Hi,
The below program is to create file on FTP server by taking the data from internal table
To see whether the file is created on the FTP server
use the function module FTP_SERVER_TO_R3.
Check the below code.
You write a same program with the function module FTP_SERVER_TO_R3 instead of
FTP_R3_TO_SERVER to check the existence of the file which is already created.
tables: t777a. "Building Addresses
Internal Table for Building table.
data: begin of it_t777a occurs 0,
build like t777a-build, "Building
stext like t777a-stext, "Object Name
cname like t777a-cname, "Address Supplement (c/o)
ort01 like t777a-ort01, "City
pstlz like t777a-pstlz, "Postal Code
regio like t777a-regio, "Region (State, Province, County)
end of it_t777a.
Internal Table for taking all fields of the above table in one line
separated by u2018|u2019(pipe).
data: begin of it_text occurs 0,
text(131),
end of it_text.
Constants: c_key type i value 26101957,
c_dest type rfcdes-rfcdest value 'SAPFTPA'.
data: g_dhdl type i, "Handle
g_dlen type i, "pass word length
g_dpwd(30). "For storing password
Selection Screen Starts
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE TEXT-001.
parameters: p_user(30) default 't777a' obligatory,
p_pwd(30) default 't777a' obligatory,
p_host(64) default 'XXX.XXX.XX.XXX' obligatory.
SELECTION-SCREEN END OF BLOCK blk1.
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE TEXT-002.
parameters: p_file like rlgrap-filename default 't777a_feed.txt'.
SELECTION-SCREEN END OF BLOCK blk2.
Password not visible.
at Selection-screen output.
loop at screen.
if screen-name = 'P_PWD'.
screen-invisible = '1'.
modify screen.
endif.
endloop.
g_dpwd = p_pwd.
Start of selection
start-of-selection.
To fetch the data records from the table T777A.
select build stext cname ort01 pstlz regio
from t777a
into table it_t777a.
Sort the internal table by build.
if not it_t777a[] is initial.
sort it_t777a by build.
endif.
Concatenate all the fields of above internal table records in one line
separated by u2018|u2019(pipe).
loop at it_t777a.
concatenate it_t777a-build it_t777a-stext it_t777a-cname
it_t777a-ort01 it_t777a-pstlz it_t777a-regio
into it_text-text separated by '|'.
append it_text.
clear it_text.
endloop.
To get the length of the password.
g_dlen = strlen( g_dpwd ).
Below Function module is used to Encrypt the Password.
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = g_dpwd "Actual password
SOURCELEN = g_dlen
KEY = c_key
IMPORTING
DESTINATION = g_dpwd. "Encyrpted Password
*Connects to the FTP Server as specified by user.
Call function 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = 'Connecting to FTP Server'.
Below function module is used to connect the FTP Server.
It Accepts only Encrypted Passwords.
This Function module will provide a handle to perform different
operations on the FTP Server via FTP Commands.
call function 'FTP_CONNECT'
EXPORTING
user = p_user
password = g_dpwd
host = p_host
rfc_destination = c_dest
IMPORTING
handle = g_dhdl
EXCEPTIONS
NOT_CONNECTED.
if sy-subrc ne 0.
format color col_negative.
write:/ 'Error in Connection'.
else.
write:/ 'FTP Connection is opened '.
endif.
**Transferring the data from internal table to FTP Server.
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
HANDLE = g_dhdl
FNAME = p_file
CHARACTER_MODE = 'X'
TABLES
TEXT = it_text
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
write:/ 'File has created on FTP Server'.
ENDIF.
Call function 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = 'File has created on FTP Server'.
To Disconnect the FTP Server.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = g_dhdl.
To Disconnect the Destination.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = c_dest
EXCEPTIONS
others = 1.
Regards,
Kumar Bandanadham -
Executing external commands(vbscript from network drive)
Hello All,
There is a client requirement where a certain number of steps need to be automated as a background job. The current manual process is such that first a vbscript is run, which creates a temporary folder and connects to a FTP location and pick data and dump it into this temporary folder on the network drive. Then a standard SAP program uses this file from the defined path and is executed. Then another vbscript is run, which basically archives the files to a different folder. These steps need to be automated.
Now we can use the cscript command in DOS to execute a .vbs script file. but this will not work with GUI_EXEC as this will fail in background. Will SXPG_COMMAND_EXECUTE/SXPG_CALL_SYSTEM fucntion modules work in this case ? I have not used them, so will they execute the command on the presentation server as I am guessing these work on the application server with the command created in SM69 ?
Thanks and Regards,
Sachinhi all,
You don't have to create a System Commands in transaction SM69 to be able to execute the VBScript or other script within the program in background mode.
When calling function "WS_EXECUTE" just add the "In Background Task" at the end to execute the VBscript or other scripts.
This extra line "In backround task" should not raise the exception
CL_GUI_FRONTEND_SERVICES======CP.
it should look like this.
data: commandline(1000).
commandline = 'P:\sapfrontend.vbs'.
call function 'WS_EXECUTE' in BACKGROUND TASK
exporting
commandline = commandline
program = 'WSCRIPT.EXE'
exceptions
frontend_error = 1
no_batch = 2
prog_not_found = 3
illegal_option = 4
others = 5. -
Executing two commands at the same time from Runtime.getRuntime
Hi everybody,
I m executing a command of imageMagic from javacode to crop and for changing the quality of image.The code is as below :
String changeQuality = new String("convert " + originalImage
+ " -crop " + imageWidth + "x" + imageHeight + "+" + imageX
+ "+" + imageY + " -quality " + quality + " " + finalImage);
Runtime.getRuntime().exec(changeQuality);
But before going to next page of jsp I want the size of the finalImage. So I m calling a new function from the base file, from which i m calling the above function, for getting the size of image:
public String getSize(String finalImage) {
proc = Runtime.getRuntime().exec("identify " + finalImage);
As identify cmd gives the size and various values of image but this command is showing the size zero. and if try to read the file then it shows FileNotFoundException.It means the file is not on the server.
What should i do to execute both the command and getting the right result.
Any help is appreciated.
Thanks in advance.
Vivek Kumar GuptaHi everyone,
Nobody ans my question but finally i got the ans of my question.
I use a input stream for reading the first one imagemagic command. through this the second command execute after the first command finished its execution.
And my images are now displaying without error.
I know now you all are thinking how great mind I am!!! hai na
Hmm woh to main hoon.
post a question if u have over here. Perhaps i can solve your prob.
Maybe you are looking for
-
ALV Filter : Not working for a text field - Strange problem
Dear All, I have a Z-program where the ALV filter is not working on a particular text field. The output on that text field is as below : ABCD JKLM YYZZ ABCD JKLM ABCD JKLM YYZZ YYZZ When we try to filter on YYZZ, it gives blank list. But for other op
-
How do I add a signature not only to newly composed mail but, to reply emails?
I created a signature and I see it being applied to new emails but, not to my reply emails. Is there a way of including it in my replies as well?
-
Is there a limit to the maximum number of columns which can be shown in a view? i am using oracle 8.1.7. Thanks Anupam.
-
Suitable Apple Extention for a PC video
I own a CD Rom of a video that can only be opened by WIndows 95 or higher, PC format only. It is part of a course on vocal improvement. A friend has a PC, and thinks he can copy the video for me, but he is not current with Apple requirements, and has
-
Skype, Soundflower, and Garage Band
I am trying to record podcast with some people around the country, so that put me with iChat, now I can't talk to people on iChat that are on AIM on a pc, so that's out. So now I turn to Skype and Soundflower. Soundflower let's me take the audio from