Call a unix script from ABAP program
Can anybody help me on how to call a unix script from an ABAP program
Regards
Anjali
Hi 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.
Similar Messages
-
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 -
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 a host script from concurrent program without exposing APPS password?
My understanding is as of now I need to link $FND_TOP/bin/fndcpesr in order to launch a unix script as concurrent program. This implies that there will be 4 standard input parameters when a certain unix script is called including oracle schema and password. As I see it now APPS password is provided to such scripts.
Is there a way to execute a unix script from under 11i without exposing APPS password?Many thanks.
Protecting Your Oracle User Password
In some cases, there are security concerns with passing your Oracle username and
password directly to your HOST program. If you do not want the concurrent manager
to pass your username/password to your program, you can have the manager pass it as
an environment variable instead. Or you can pass an Oracle Applications
username/password for a user with the System Administrator responsibility.
Alternatively, you can not pass it at all.
First, define your concurrent program executable as a HOST program in the Concurrent
Program Executable form.
To have the username/password passed as an environment variable, enter the term
'ENCRYPT' in the Execution Options field of the Concurrent Programs window when
defining a concurrent program using this executable. 'ENCRYPT' signals the concurrent
manager to pass the username/password in the environment variable fcp_login. The
argument $1 is left blank.
If you do not want the username/password passed to the program at all, enter
+'SECURE' in the Execution Options field. The concurrent manager will not pass the+
username/password to the program. -
Call a unix script from pl/sql package
Hi,
Using 11.2.0.3 on AIX.
Is it possible to call unix script from pl/sql package?
I am cretaing a file in a directory but would like this to automatically be written to an archive directory as well.
Could either use 2 utl_file.put_lines to 2 separate directories or 1 utl_file and cal script to archive file in another directory.?
Thoughts?
Thanksuser5716448 wrote:
What am I doing wrong?think how file name will look like:
SQL> select 'file_name' || to_char(sysdate,'DD/MM/YYYY HH24:MI:SS') from dual;
'FILE_NAME'||TO_CHAR(SYSDATE
file_name15/08/2012 11:47:51Will AIX swallow such name? Obviously not. And, unfortunately, UTL_FILE.FCOPY doesn't raise an error in such case. So use someting like:
UTL_FILE.FCOPY ('SOURCE_DIR',v_FILE_NAME,'DEST_DIR',v_file_name||to_char(sysdate,'DD_MM_YYYY_HH24_MI_SS'));SY. -
Calling external web service from ABAP Program
Hi All,
Can somebody point me to the documentation where how to call an external (3rd party) web service from ABAP program is explained?
Thanks & Regards,
-Smitawhich version of R/3 you are using. if you are on was 6.40 its very simple, there are delivered tools to generate client proxy for consuming webservice. if you are on wa 6.20 you can use cl_http_client to achieve the same. check out the following weblogs.
/people/durairaj.athavanraja/blog/2005/07/12/send-sms-to-india-from-abap
/people/thomas.jung3/blog/2005/05/13/calling-webservices-from-abap-via-https
/people/thomas.jung3/blog/2004/11/17/bsp-a-developers-journal-part-xiv--consuming-webservices-with-abap
Regards
Raja -
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
Danielledata: 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 -
Execute unix script from abap.
Hi friends,
I have a abap report which generate a text file in<b> /usr/tmp/</b> directory . Now i have a unix script which encript the text file. I want to this from abap report. How I can do this . and in which path I should keep this unix script Please help.
RegardsHi,
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.
Reward points if found helpful
Cheers,
Chandra Sekhar. -
Hi
Friends i am runing a abap report which genrate a ( eft.txt ) text file in /usr/tmp/
Now i want to run a unix script which encript this file.
I have created this command in SM69
type = customer
command name = ZENC
Operation system = unix
externl program = sh
parameter for external program = /usr/tmp/ enc.sh eft.txt eftdc eftdo
enc is unix script and eft.txt is imput text file eftdo eftdc are encripted files.
I am us the function module SXPG_CALL_SYSTEM'
it is ending with following messege
1 5 hello
2 19 eft.txt eftdo eftdc
3 40 The jar file is not found: Encryptor.jar
4 44 External program terminated with exit code 1
and do not give any output.
please help.
Thanks & regards
SSreport zsrchsap.
*-This is a demo report for Search Sap
*-Author : Sandeep Kulkarni
*-Date : 09/20/2001
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. -
Calling separate LSMW steps from ABAP program
Hai all,
anybody know if I can call sepearte LSWM step from a ABAP programm,
I only need to:
Specify Files
Import Data
Convert Data
Create Batch Input Session
Run Batch Input Session
Need this steps so i can provide backoffice user a tool which imports data using predefined LWSM.
Grtz
Richard
Edited by: Richard van Veen on Jun 7, 2010 1:15 PMI made a lsmw and after completing all steps i tested step 080/100/300 and 310 from se37, it seems to work fine, i will update when completed
010 Maintain Object Attributes OBJ /SAPDMC/LSM_OBJ_ATTRIBUTES
020 Maintain Source Structures OBJ /SAPDMC/LSM_OBJ_SOURCE_STRUCS
030 Maintain Source Fields OBJ /SAPDMC/LSM_OBJ_SOURCE_FIELDS
040 Maintain Structure Relations OBJ /SAPDMC/LSM_OBJ_STRUCT_RELATNS
050 Maintain Field Mapping and Conversion Rules OBJ /SAPDMC/LSM_OBJ_FIELDMAPPING
070 Maintain Fixed Values, Translations, User-Defined Routines RUL /SAPDMC/LSM_RUL_ADMINISTRATION
080 Specify Files OBJ /SAPDMC/LSM_OBJ_FILES_SPECIFY
090 Assign Files OBJ /SAPDMC/LSM_OBJ_FILES_ASSIGN
110 Import Data EXE /SAPDMC/LSM_EXE_READPROG_RUN
120 Display Imported Data DSP /SAPDMC/LSM_DSP_READ_DATA_SHOW
130 Convert Data EXE /SAPDMC/LSM_EXE_CONVPROG_RUN
140 Display Converted Data DSP /SAPDMC/LSM_DSP_CONV_DATA_SHOW
300 Create Batch Input Session EXE /SAPDMC/LSM_EXE_BI_PROGRAM_RUN
310 Run Batch Input Session EXE /SAPDMC/LSM_EXE_BI_SESSION_RUN
600 Frame Program for Periodic Data Transfer EXE /SAPDMC/LSM_EXE_INTERFACE -
Calling Business objects Methods from ABAP program
Hi All,
Can anyone please tell me the procedure to call methods of business object(Ex: BKPF) from an ABAP program. My requirement is to check the existence of a object key by using the method EXISTENCE CHECK from BKPF. Please helpHere is an example from the SAP documentation.
[http://help.sap.com/saphelp_nw70ehp2/helpdata/en/c5/e4ad71453d11d189430000e829fbbd/content.htm]
Cheers
Graham Robbo -
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 -
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 UNix Script from portal Form
Has anyone conquered this issue through jav or plsql. I need to call a unix script from the portal form when I select the insert button.
I have several very convoluted ways which all work, but I have always thought there should be more straightfwd ways. Fundamentally the easiest way to call something from the Insert button is to add some PL/SQL code before (or after) the "doInsert();" call in the Insert Button event handler.
What seems to be lacking is the ability to get from pl/sql to the o/s. So until we know how to do that you have to call a method in Java to execute o/s commands - specifically you can use Runtime.getRuntime().exec(cmd); where Runtime is a class in java.lang, and cmd is the actual o/s command (script or whatever).
How to call this Java is then where you have several options:
1. Compile this piece of Java into the Oracle DB as a SP.
2. Deploy this piece of Java within a Java servlet on a 9iAS instance. Then have another SP call this servlet using the utl_http package (begin_request and other sp's within package).
Which options would depend on several factors including your preference but most importantly whether you have a DB or a 9iAS instance on the machine where you want to execute the script. If you have neither you have a problem. In such cases I have used a standalone OC4J container which has a very small footprint.
As I said these methods are all quite convoluted and if anyone else has anything better I would like to know (but they work quite reliably).
Cheers.
Anton.
Maybe you are looking for
-
No acknowledgement of header frame
I have two almost identical systems with remote monitoring using lookout 6.02 but one site I can connect to with not problem. The second I have to use a external modem and only achieved connection to the site once but now I am receiving and alarm st
-
I have a business rule which is in production(System 9.2) and is running. We are currently in the process of building the same application in our EPM 11 envirionment and when we test the rule it fails. The rule just keeps running on, eventually we ki
-
Third party sales how customer address copied to Purchase Requisition
Dear All, Third party sales customer address copied to Purchase Requisition, How this is happening and Where is the confirugation setting, Is it MM or SD related. Regards Sudarshan
-
I am expecting an openreach engineer to visit my home in a few weeks to upgrade my current broadband from ADSL to Fibre. I understand that the process involves changing the faceplate on the BT Master Socket and connecting a new modem to the new facep
-
Hiya. So, I've found myself in a weird situation that I have never encountered before. If I put a CD or DVD in to my computer, I can play it with VLC, rip it with Sound Juicer/dvd::rip etc. but when it comes to actually mounting it I get issues. Thun