Call VB Script From ABAP Program
Hi,
I need to call a VBS program from an abap program. This abap will run on both 4.6 and 4.0.
I would be very grateful for any suggestions on how this can be done.
Thanks and Kindest Regards
Danielle
data: commandline(1000).
commandline = v_vbs_filename. "complete path of vbs file
call function 'WS_EXECUTE'
exporting
commandline = commandline
program = 'WSCRIPT.EXE'
exceptions
frontend_error = 1
no_batch = 2
prog_not_found = 3
illegal_option = 4
others = 5.
if sy-subrc <> 0.
raise execution_failed.
endif.
Raja
Similar Messages
-
Calling GUI Scripting from ABAP program
Is it possible to call GUI Scripting from ABAP and thus to use GUI Scripting as an alternative to CALL TRANSACTION?
Is the class CL_JAVA_SCRIPT suitable to access GUI Scripting engine? Accessing ABAP data object would work as well in this case as i think. What SAP Logon and WAS releases are required? Is the 6.20 release sufficient for this case?
I would appreciate if somebody could post an example.Hi,
CL_JAVA_SCRIPT has nothing to do with SAPGUI Scripting.
Calling SAPGUI Scripting API from ABAP could be possible for programmes experienced with OLE automation calls from ABAP coding.
The hardest thing will be, to access the scripting engine handle as an entry point. Once you have a handle in your abap session, any api function can be invoked.
Best regards
Jens
BTW: SAP testtool eCATT does call SAPGUI-Scripting from ABAP. -
Call SXPG _ CALL _ SYSTEM from ABAP program
Hi,
Someone may help me? I need to call the function module SXPG _ CALL _ SYSTEM from ABAP program for to encrypt a file.
I created the command by SM49 , but I don't know how I can call it from ABAP program.
Thanks
Maria CHi Maria.
This is a possible code you can use:
DATA: log LIKE TABLE OF btcxpm WITH HEADER LINE.
Can contain STDOUT, STDERR
commandname =
CALL FUNCTION SXPG_CALL_SYSTEM
IMPORTING
COMMANDNAME = commandname
PARAMETERS = parameters
EXPORTING
STATUS = status
TABLES
EXEC_PROTOCOL = log
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
OTHERS = 12.
The following are the comments of the parameters taken from:
http://help.sap.com/saphelp_40b/helpdata/en/fa/0971ee543b11d1898e0000e8322d00/content.htm
Parameters
IMPORTING Parameters
Parameter name
Use
COMMANDNAME
The name of the definition of the external command, as specified in the maintenance function (transaction SM69).
PARAMETERS
Arguments for the external command as specified by the definition in the R/3 System and by the calling program or user.
These arguments are checked for impermissible characters, such as the ; under UNIX. Problems are registered with the SECURITY_RISK exception.
EXPORTING Parameters
Parameter name
Use
STATUS
Returns the final status of the execution of the external command:
· Value O: The external command was started and ran to end successfully.
· Value E: An error occurred; the external command was not run successfully.
Tables Parameters
Parameter name
Use
EXEC_PROTOCOL
Contains the STDOUT and STDERR output of the external command and any output from the target host system.
Exceptions
Exception name
Meaning
X_ERROR
Reserved for future use.
NO_PERMISSION
The AUTHORITY-CHECK of the users authorization for the authorization object S_LOG_COM failed. The user is not authorized to carry out the command named with the specified arguments on the target system.
COMMAND_NOT_FOUND
Command name, as identified by COMMANDNAME and OPERATINGSYSTEM, has not been defined in the maintenance function (transaction SM69).
PARAMETERS_TOO_LONG
The combined argument string (ADDITIONAL_PARAMETERS and the DEFINED_PARAMETERS, as returned in ALL_PARAMETERS) exceeds the limit of 128 characters in length.
SECURITY_RISK
Either:
· The command contains impermissible characters. These are characters with potentially dangerous properties, such as ; under UNIX.
· The command definition specifies that an extra-check function module be run. This function module has rejected execution of the command.
WRONG_CHECK_CALL_
INTERFACE
The command definition specifies that an extra-check function module is to be run. Either this function module is missing, or the interface defined for this function module does not match that of the standard R/3 function module SXPG_DUMMY_COMMAND_CHECK. For more information, please see SXPG_DUMMY_COMMAND_CHECK: Interface for Extra-Check Function Modules.
TOO_MANY_PARAMETERS
The command definition specifies that user-specified arguments for the external command are not allowed. However, an additional string of command arguments was specified.
PARAMETER_EXPECTED
The command definition includes the placeholder character ?, which signifies that additional user-defined arguments are required. However, no additional arguments string was supplied.
PROGRAM_START_ERROR
An error occurred while starting the external command. The R/3 system field SY-MSGV1 contains additional information on the problem.
PROGRAM_TERMINATION_
ERROR
An error occurred while trying to obtain the return code of the external program. The R/3 system field SY-MSGV1 contains additional information on the problem.
ILLEGAL_COMMAND
The external command definition was modified "illegally". That is, the command was not modified by means of the maintenance function (transaction SM69).
The modified command is registered in the system log in its substituted form. The message is registered under the system log ID "LC".
OTHERS
Catch any new exceptions added to this function module.
Hope this will be useful.
Sandro Lombardo -
Procedure to Call Workflow Object from ABAP program in Se38
Hi All,
I have one scenario like i have to call one Workflow object from ABAP program in SE38.The scenario is like below.....
I have to select some records from database table.For example there are 100 records in the internal table.
For all that records i have to invoke Workflow for getting approval from the authorized persons. Once Approval has come to program, It will post one document in SAP and process ends.
Please suggest me how to move forward with this scenario.
Regards
Manas Ranjan PandaHi,
So you want to start a workflow from an ABAP, if an event exists for that particular workflow then the best way is to use fm SAP_WAPI_CREATE_EVENT,
to start a workflow from an ABAP you can use fm SAP_WAPI_START_WORKFLOW.
Kind regards, Rob Dielemans -
Calling oracle procedure from ABAP program
There is a requirement to call the oracle stored procedure with some input parameter from ABAP program.
Suppose we have order number which is entered by the user in ABAP program.
This order number needs to be passed to oracle stored procedure as an input parameter in the same ABAP program.
We can call the oracle stored procedure without parameter using the following syntax
exec sql
execute procedure <procedure name>
end exec.
But do not know how to execute the oracle stored procedure with some input parameter?Apologies , following is the correct code.
This will definetly solve your problem.
DATA scarr_carrid TYPE scarr-carrid.
SELECT-OPTIONS s_carrid FOR scarr_carrid NO INTERVALS.
DATA s_carrid_wa LIKE LINE OF s_carrid.
DATA name TYPE c LENGTH 20.
TRY.
EXEC SQL.
CREATE FUNCTION selfunc( input CHAR(3) )
RETURNING char(20);
DEFINE output char(20);
SELECT carrname
INTO output
FROM scarr
WHERE mandt = '000' AND
carrid = input;
RETURN output;
END FUNCTION;
ENDEXEC.
LOOP AT s_carrid INTO s_carrid_wa
WHERE sign = 'I' AND option = 'EQ'.
TRY.
EXEC SQL.
EXECUTE PROCEDURE selfunc( IN :s_carrid_wa-low,
OUT :name )
ENDEXEC.
WRITE: / s_carrid_wa-low, name.
CATCH cx_sy_native_sql_error.
MESSAGE `Error in procedure execution` TYPE 'I'.
ENDTRY.
ENDLOOP.
EXEC SQL.
DROP FUNCTION selfunc;
ENDEXEC.
CATCH cx_sy_native_sql_error.
MESSAGE `Error in procedure handling` TYPE 'I'.
ENDTRY.
Reward points if usefull.
Thanks and regards,
Veerendranath. -
Not able to call sql script from shell program
Hi Gurus,
I am facing issue while calling sqlplus script from my shell program. Please find below my shell script. This program I've written and registered as for one of concurrent program
in oracle applications.
p_userid_passwd=$1
p_appl_login=$2
p_user_name=$3
p_request_id=$4
v_conc_request_id=${5}
p_to_role=${6}
p_from_role=${7}
p_subject=${8}
p_body=${9}
p_dist_list=${10}
v_request=${11}
v_file_path_name=/u01/oraspt/REQUEST
cd $APPLCSF/$APPLOUT
echo "v_conc_request_id" $v_conc_request_id
echo "p_to_role" $p_to_role
echo "p_from_role" $p_from_role
echo "p_subject" $p_subject
echo "p_body" $p_body
echo "p_dist_list" $p_dist_list
echo "v_request" $v_request
ls -l $v_request
if [ $? -ne 0 ]
then
echo "No output request generated"
else
echo "Output request generated"
fi
echo "connecting to ftp for placing out file to DB server"
echo FTP to 99.60.17.11
echo username: "oraspt"
echo pw:
ftp -i -n 99.60.17.11 << EOF2
user "oraspt" orakdk
cd $v_file_path_name
put $v_request
bye
EOF2
output=`sqlplus -s /nolog <<EOT
whenever sqlerror exit failure;
connect apps/apps
set verify off;
set serveroutput on size 120000;
DECLARE
l_errbuf varchar2(300);
l_retcode varchar2(300);
BEGIN
XXFND_SEND_MAIL.SEND_NOTIFICATIONS( errbuf => l_errbuf
, retcode => l_retcode
, p_request_id => $v_conc_request_id
, p_to_role => $p_to_role
, p_from_role => $p_from_role
, p_subject => $p_subject
, p_body => $p_body
, p_dist_list => $p_dist_list);
EXCEPTION
when others then
dbms_output.put_line('Error encountered :'||SQLERRM);
END;
EOT
`
echo "connecting to ftp for deleting output file"
echo FTP to 99.60.17.11
echo username: "oraspt"
echo pw:
ftp -i -n 99.60.17.11 << EOF2
user "oraspt" orakdk
cd $v_file_path_name
delete $v_request
bye
EOF2
echo "Deleted successfully"Output for script is as below
v_conc_request_id 451906
p_to_role DC.DKHOO
p_from_role DC.DKHOO
p_subject Receivable audit report10
p_body Please find Audit Report Attachment.
p_dist_list
v_request o451906.out
-rw-r--r-- 1 applspt dba 2368 Dec 28 15:06 o451906.out
Output request generated
connecting to ftp for placing out file to DB server
FTP to 10.60.17.11
username: oraspt
pw:
connecting to ftp for deleting output file
FTP to 10.60.17.11
username: oraspt
pw:
Deleted successfullyPlease let me know how to trigger pl/sql script.
Thanks in advance for your help.
Regards
Nagendra
Edited by: 838961 on Dec 27, 2011 11:25 PMPlease find output as suggested, I've placed set -x in script.
+ p_userid_passwd=APPS/APPS
+ p_appl_login=1110
+ p_user_name=DC.DKHOO
+ p_request_id=451949
+ v_conc_request_id=451945
+ p_to_role=DC.DKHOO
+ p_from_role=DC.DKHOO
+ p_subject=Receivabless
+ p_body=report
+ p_dist_list=
+ v_request=o451945.out
+ v_file_path_name=/u01/oraspt/REQUEST
+ cd /u01/applspt/inst/apps/SPT_nfs-stg-app1/logs/appl/conc/out
+ echo v_conc_request_id 451945
v_conc_request_id 451945
+ echo p_to_role DC.DKHOO
p_to_role DC.DKHOO
+ echo p_from_role DC.DKHOO
p_from_role DC.DKHOO
+ echo p_subject Receivabless
p_subject Receivabless
+ echo p_body report
p_body report
+ echo p_dist_list
p_dist_list
+ echo v_request o451945.out
v_request o451945.out
+ ls -l o451945.out
-rw-r--r-- 1 applspt dba 2368 Dec 28 15:54 o451945.out
+ '[' 0 -ne 0 ']'
+ echo 'Output request generated'
Output request generated
+ echo 'connecting to ftp for placing out file to DB server'
connecting to ftp for placing out file to DB server
+ echo FTP to 10.60.17.11
FTP to 10.60.17.11
+ echo username: oraspt
username: oraspt
+ echo pw:
pw:
+ ftp -i -n 10.60.17.11
++ sqlplus -s /nolog
+ output=Connected.
+ echo 'connecting to ftp for deleting output file'
connecting to ftp for deleting output file
+ echo FTP to 10.60.17.11
FTP to 10.60.17.11
+ echo username: oraspt
username: oraspt
+ echo pw:
pw:
+ ftp -i -n 10.60.17.11
+ echo 'Deleted successfully'
Deleted successfully -
Calling javaFX script from Java program
I am trying to call JavaFX script from a simple Java program. code as follows:
import java.io.*;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
public class My{
public static void main(String[] args) {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByExtension("fx");
try {
InputStreamReader reader = new InputStreamReader(My.class.getResourceAsStream("first.fx"));
engine.eval(reader);
reader.close();
} catch (Exception e) {
e.printStackTrace();
my first.fx file code is here:
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.scene.text.TextAlignment;
Stage {
title: "My First JavaFX Sphere"
scene: Scene {
width: 250
height: 250
content: [
Text {
font: Font { size: 24 }
x: 20, y: 90
textAlignment: TextAlignment.CENTER
content:"Welcome to \nJavaFX World"
} //Text
] // content
} // Scene
} // Stage
I am not able to run My.java. runtime error as follows:
java.lang.NullpointerException
Kindly correct me, where I am wrongI am able to call .fx file from Java. Thank you all for helping me to resolve this problem
Regards,
Ritu -
Call a unix script from ABAP program
Can anybody help me on how to call a unix script from an ABAP program
Regards
AnjaliHi try the below code
parameters : p_sfile(60) lower case
"File to be moved
"Eg : /home/in/SFILE1.txt
p_dfile(60) lower case.
"File's Destination
"Eg: /home/archive/SFILE1.txt
data : t_btcxpm
like btcxpm occurs 0,
p_addparam
like sxpgcolist-parameters.
concatenate
'/home/ABAP/scripts/Archive_file.sh'
p_sfile
p_dfile
into p_addparam separated by space.
refresh t_btcxpm. clear t_btcxpm.
call function 'SXPG_CALL_SYSTEM'
exporting
commandname = 'ZSHELL'
additional_parameters = p_addparam
tables
exec_protocol = t_btcxpm
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
others = 12.
if sy-subrc = 0.
write : /
'File',p_sfile,'moved to',p_dfile.
else.
write : / 'Error Occured'.
endif. -
Hi,
I Create WS in BE1 (Server ) and i want to call it explicitly via Code from other backend BE2 (Client) .
I followed this procedure
1. Create WS on the Target system (in the Server).
2. Generate proxy on the client (in the client).
3. Create logical port Via Lpconfig (in client).
I use this code to call to the service :
DATA: lv_port_name TYPE srt_lp_name,
lv_text TYPE string,
lt_return TYPE bapirettab.
DATA: lref_client_proxy TYPE REF TO z_ser_test_perf,
in TYPE z_ser_tst_per,
out TYPE z_ser_tst_per_r.
* Get Default Logical Port for Proxy
CONSTANTS: lc_proxy TYPE srt_lp_proxyclass VALUE 'ZHCO_SER_T_PER'.
in-user = 'AST'.
in-work_id = '00570538637'.
CALL METHOD cl_srt_lp_maintenance=>get_default_port_by_proxy
EXPORTING
proxyclass = lc_proxy
RECEIVING
lp_name = lv_port_name.
TRY.
CREATE OBJECT lref_client_proxy
EXPORTING
logical_port_name = lv_port_name.
CATCH cx_ai_system_fault.
ENDTRY.
TRY.
CALL METHOD lref_client_proxy->z_tst_performance
EXPORTING
input = in
IMPORTING
output = out.
catch CX_AI_SYSTEM_FAULT into lr_error.
lv_message = lr_error->get_text( ).
CATCH cx_ai_application_fault.
ENDTRY.
In the method lref_client_proxy- i get exception :
SOAP:14 Unexpected element -el=definitions ns=http://schemas.xmlsoap.org/wsdl/
Does anyone have an idea how to avoid this exception?
P.S.
I also create logical port via Soamanager but the first and the second method don't find it (i saw the entry in table SRT_CFG_CLI_ASGN ) and when i call to the third method alone i get dump for null reference.
Best Regards
Nina
Edited by: Nina C on May 5, 2009 10:33 PMhi , nina
the null poitnexception is that u r referring to the logicl port while creatign the object
dotn pass anything , just use
create object proxy name
Data : l_proxy type ref to ZSTRCO_ZSTARWEB,
lo_sys_exception TYPE REF TO cx_ai_system_fault,
out type ZSTRZSTAR_RESPONSE,
in type ZSTRZSTAR,
it_controller type PRXCTRLTAB,
wa_controller type prxctrl.
create object l_proxy.
in-a = 8.
in-b = 4.
TRY.
CALL METHOD l_proxy->zstar
EXPORTING
input = in
IMPORTING
output = out
. CATCH cx_ai_system_fault into lo_sys_exception .
ENDTRY.
write : out-c.
i never used logical port , i created it but never used
just instantiate the object and pass the input an dout put paramters , the logical port will be picked form run time
and u can test the proxy from se80
1) just double click on th eproxy name in SE80 , u can select the package in which u created the pproxy , then under enterprise services --> client proxy and ur proxy name
just test from there u get a pop up of test service consumer and select the logical port from drop down and seelct the generate template data and execute it , u will get a screen where the input values will be autmatically proposed and then u execute from there u wil get the output.
2) seond method is when in SE80 when u select the proxy u can see the prxy name in the prpoerties which will be Proxy Class (generated) , then test this class by using execute button u get a screen where u haev to instantiate the class , give the logical port name and click the instance button, then ur method wil be shown execute it and u get ur input paramters just clikc them, give the values and come back and execute u will get the output
hope it solves ur prob
regards
afzal -
Is it possible to call website from ABAP Program?
Hi Experts,
Is it possible to call website from ABAP Program?
It is very Urgent Help me.
Regards,
Ashok.Hi,
Check the following program:
REPORT ZURL NO STANDARD PAGE HEADING.
DATA: BEGIN OF URL_TABLE OCCURS 10,
L(25),
END OF URL_TABLE.
URL_TABLE-L = 'http://www.lycos.com'.APPEND URL_TABLE.
URL_TABLE-L = 'http://www.hotbot.com'.APPEND URL_TABLE.
URL_TABLE-L = 'http://www.sap.com'.APPEND URL_TABLE.
LOOP AT URL_TABLE.
SKIP. FORMAT INTENSIFIED OFF.
WRITE: / 'Single click on '.
FORMAT HOTSPOT ON.FORMAT INTENSIFIED ON.
WRITE: URL_TABLE. HIDE URL_TABLE.
FORMAT HOTSPOT OFF.FORMAT INTENSIFIED OFF.
WRITE: 'to go to', URL_TABLE.
ENDLOOP.
CLEAR URL_TABLE.
AT LINE-SELECTION.
IF NOT URL_TABLE IS INITIAL.
CALL FUNCTION 'WS_EXECUTE'
EXPORTING
program = 'C:\Program Files\Internet Explorer\IEXPLORE.EXE'
commandline = URL_TABLE
INFORM = ''
EXCEPTIONS
PROG_NOT_FOUND = 1.
IF SY-SUBRC <> 0.
WRITE:/ 'Cannot find program to open Internet'.
ENDIF.
ENDIF.
Regards,
Bhaskar -
Call workflow from ABAP program
created a zbusiness object (ZPRODH)with
one key field product hierarchy,
one attribute level number and
one method display.
I tested that zobject and using this object created workflow to display product hierarchy ,it is displaying it. now I have to call it from one abap program.
In the abap program I am calling the funcion module, I
CALL FUNCTION 'SWW_WI_START_SIMPLE'
EXPORTING
TASK = TASK
IMPORTING
WI_ID = WI_ID
TABLES
AGENTS = AGENTS
WI_CONTAINER = WI_CONTAINER.
It is calling the workflow and subrc is 0, but not passing the value to the workflow. Because of that the method is not working, any idea?
Thanks in advancettpa,
Please check this thread:
Re: Workflow from abap program
Also check that your Fm do requires any explicit commit or not?
Hope it will help u
Cheers
Jai -
Call to Java web service from abap program
HI,
I want to call to Java WS from abap program and i read some post how to do that in release of NW 6.4 but I want to know what is the simplest way to do that in release 7.0 .
Many Thanks,
NinaHi Uwe,
Thank you.
I have WSDL or URL how i can call to them ,in the example that you send i don't find the place that it called.
Do i have to create proxy for that ?
BR
Nina -
Execute webdynpro from abap program and return to the caller program
Guys,
I have a question here.
I know there is a way to call an abap webdynpro application from normal abap program by either using a class method, or use a function module WDY_EXECUTE_IN_PLACE by providing
the webdynpro application or using CALL TRANSACTION statement.
But, is there anyways that we can call the webdynpro application from abap program by supplying data to the webdynpro and display to the user from the portal, and then
once the user do some manipulation on the data, can we transfer back the data to the caller abap program?hey ,
you can pack any web-dynpro program in tranasaction code and run it from R/3 and not via portal :
search in " SAPTECHNICAL" how to do so - for some reason i cant post a link here
than you can use call transaction .
regards
ASA -
Call Java Program from ABAP Program
Dear all,
In our scenario, we need to let ABAP call services provided by a standalone Java program. From online help I found some overview introduction and I'd make the called program a registered program in a RFC with type "T" (TCP/IP Connection). Can anybody give some concrete documentation? A step-by-step guide would be greatly appreciated.
Best Regards
Jeromecheck this thread
Re: Calling Java API from ABAP using JCo -
Method class for calling/executing VB script from abap
Hi All,
I need to call a vb script from abap.
This vb script performs some function then.
For executing this VB script i use the method CL CL_GUI_FRONTEND_SERVICES=>Execute.
Now i need to pass data to the vb script in the from of a structure/workarea.
Does anyone have any idea on what class/method shoul i use?
Regards,
Harshit RungtaCheck Connect VB to SAP
Kanagaraja L
Maybe you are looking for
-
The question pretty much says it all: the old versions of Firefox used to allow you to select "open" when downloading a file instead of saving it to a directory. I am fully aware that that's what selecting "open" does anyway, but I still like that op
-
Unable to do Allocation with Reference to Sales Order For SAP AFS
Dear Experts Error is showing while doing Allocation for Sales Order . Our Business Scenario is ( Sales Order ( VA01)- Allocation Run(J3AT) - Delivery (VL01N) - Invoice ( VF01). Yesterday a user C
-
My computer keeps asking me to get a genuine windows 7
so i have been using this computer for a few months, almost a year, and i bought this computer from a real licensed computer store. it is not secondhand . but recently it has been telling me thatmy windows is not genuine, after i turn it on it turns
-
Attachment from item master to SO
The Client (on 11.5.10) needs to carry forward the attachments from item master to the SO. None of the document categories were carried to SO. I created a new document category in OM and enabled it for Forms 'Sales Orders' and 'Item master'. But this
-
Hello Acrobat Forum: I've had an annoying problem with PDF created from InDesign CC for months now, and I can't figure out what's wrong because it seems intermittent, and I can't narrow the variables to figure out when it's happening or why. Sometime