How to execute application server file from abap program
Hi Friends,
i have a requirement to execute application server file using abap program.
i got a file directory like '/home/im3/hrintf/xxx.sh' , it's of unix file, so they want me to execute through abap program.
pls suggest me with relevant logic.
Thank you.
Regards
Ramesh M
Define the external command in SM49/SM69
Try with SXPG_CALL_SYSTEM or SXPG_COMMAND_EXECUTE
Also check this link
link:[Execute Unix Script|http://searchsap.techtarget.com/tip/0,289483,sid21_gci774071,00.html]
Similar Messages
-
How to execute a .sql file from a batch file
Hi all
I've to take backup of a database weekly twice on every wednesday & Friday @ 5pm IST. I've written a hot backup script, which works every well.
now i want to automate the script. ie i want this script to run on wednesday & friday @ 5pm without any human interfearance ie with out actually any1 executing this script.
i created a batch file prod.bak with the following lines
@echo off
set oracle_sid=testdb
set oracle_home=d:\oracle\ora92
sqlplus /nolog
connect sys as sysdba/oracletest@testdb
this batch file when eexecuted connects me to sql prompt.
Now i want to execute my backup script bkp.sql automatically when it is connected to sql prompt.
(i tried with these lines in the above batch file...
call bkp.sql---it just opens the bkp.sql file in notepad & displays the script
start bkp.sql---same as call
connect / as sysdba/pwd@[email protected] --- does not work simply remains a the sql prompt.
At 17:00 /Every:w,f "d:\bkp.sql"---does not work simply remains at the sql promt.)
Can any1 let me know what should i write in the batch file that will execute the bkp.sql file automatically after it gets connected to sql prompt. M using oracle 9i.
I'll manage he time through windows utility of scheduling task.. Let me know how to execute the .sql file from a batch file.
Thanks
TriptiTry
sqlplus "sys/oracletest as sysdba" @bpk.sql
Working locally, and having set the ORACLE_SID, you don't need to specify the SqlNet alias (@testdb).
Remember to put an exit at the end of the bpk.sql script. -
How to execute SQOOP.cmd file from SSIS execute process task?
How to execute SQOOP.cmd file from SSIS execute process task?
What is argument need to be prefixed in the arguments property
Executable: C:\Hadoop\sqoop-1.4.2\bin\sqoop.cmd
Arguments: /C "sqoop import -connect "jdbc:sqlserver://mysystem:1433;database=test;username=myuser;password=mypwd;" -table emp -target-dir /user/emptable -m 1"
Thanks
DurgaHi Durga,
SQOOP.cmd must be no different than any other .cmd/.bat I assume, your question is more about setting the parameters up I guessed.
So unless the arguments change dynamically you can call SQOOP.cmd from yet another .cmd that has its parameters passed to it and the former you simply set to run without the arguments in Execute Process Task.
Otherwise, in general to set a bat/cmd file to run in SSIS one needs to do this:
PS: It is a good idea to populate the working directory with the path to the .cmd
Arthur My Blog -
I am using the program Z_SAP_HIERARCHY_DOWNLOAD to output a hierarchy in BW to a specified drive. It works fine when I go to SE38 and run it. However, when I run it from a process chain, it doesn't output the file. How can I generate the output file by running the program from a Process Chain? Thanks.
Hello Uday,
i suppose if you run the program within a process chain it will be started
in a background process. All downloads via the SAPGUI onto your local
PC (or network drive) are not possible in the background because there is no
connection to your PC during the excecution of the report in the background.
Try to save the download on an accessible file system on the application server
and download it from there afterwards.
Which function module is used to download the data (GUI_DOWNLOAD or the older version WS_DOWNLOAD) in your report?
To save data on the application server use the ABAP statements
OPEN DATASET filename FOR OUTPUT -> for creation of file
TRANSFER record TO filename -> for transfer of one record
CLOSE DATASET filename -> for closing the file
Regards,
Ralf Matthies -
Hi everyone!
Is there a way in ABAP to output XML files? Pls. send code/ function module if any.
From ABAP programs, we are sure that we can output TEXT files, but how about XML files?
The significance of this question is related
Currently we are using XI to interface SAP and AMS, this question for ABAP to produce XML file arose, if for example, the XI server is down and we have to still send data from one system to another. IDocs can also produce XML files, pls confirm. Earlier however, we have preferred XI rather than IDocs to do this. Anyway, any idea regarding this scenario will be greatly appreciated.
Thanks and God bless!
CelesteHi,
Please check this sample codes from other thread.
1. itab --- > xml
xml ---> itab.
2. This program will do both.
(just copy paste in new program)
3.
REPORT abc.
*-------------- DATA
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
DATA : BEGIN OF itab OCCURS 0,
a(100) TYPE c,
END OF itab.
DATA: xml_out TYPE string .
DATA : BEGIN OF upl OCCURS 0,
f(255) TYPE c,
END OF upl.
DATA: xmlupl TYPE string .
******************************* FIRST PHASE
******************************* FIRST PHASE
******************************* FIRST PHASE
*------------------ Fetch Data
SELECT * FROM t001 INTO TABLE t001.
*------------------- XML
CALL TRANSFORMATION ('ID')
SOURCE tab = t001[]
RESULT XML xml_out.
CALL FUNCTION 'SCMS_STRING_TO_FTEXT'
EXPORTING
TEXT = xml_out
* IMPORTING
* LENGTH =
TABLES
FTEXT_TAB = itab.
*-------------- Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filetype = 'BIN'
filename = 'd:xx.xml'
TABLES
data_tab = itab.
******************************* SECOND PHASE
******************************* SECOND PHASE
******************************* SECOND PHASE
BREAK-POINT.
REFRESH t001.
CLEAR t001.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'D:XX.XML'
filetype = 'BIN'
TABLES
data_tab = upl.
LOOP AT upl.
CONCATENATE xmlupl upl-f INTO xmlupl.
ENDLOOP.
*------------------- XML
CALL TRANSFORMATION ('ID')
SOURCE XML xmlupl
RESULT tab = t001[]
BREAK-POINT.
Regards,
Ferry Lianto -
Execute a .cmd file from Java program on tomcat which is running as service
I have a .cmd/,.bat file which has to be executed depending on the parameters I pass through JSP page hosted on a tomcat instance.
Tomcat is running as a windows service.
I need my .cmd file to be opened in a cmd or DOS box so that user can interact with the dos window, which is mandatory.
When I run the program from eclipse it works well but on the tomcat , the server side the output of the command is written to my log file and it gives no chance for users to monitor and interact with the command.
Should I do something with log4j settings or is due to tomcat running as service?
Please help.
thanksthanks for the responses.
But the design is like that.Then it needs to be fixed.
I think this is why there's a shortage of people to write computer applications, they are all wasting their time struggling to implement bad designs.
its a scheduler to be run on tomcat where we interact
with the running batch files and can't be changed.A scheduler in Tomcat? Why run a scheduler in an application server?
any help is appreciated.
I tried to execute the batch file from servlet it
runs , but i see the cmd.exe in windows task manager
and need a dos box open.
Any ideas?If you need a DOS box open then you need a signed-on user. So here's my patch:
1. Write an application that listens for messages from this Tomcat scheduler, and when it receives those messages it does something in a DOS box.
2. Have somebody sign on to the server and run that application.
3. Change the Tomcat scheduler to send messages to that application instead of trying to actually run it.
It's up to you what kind of messages you should send. There are plenty of choices. -
How to execute Pro*C file from form
Hi All !
I have one pro*c file(.pc & .exe) . How I can execute this file from form.
Regards,
NeerajI think you could use Ora_Ffi package too. Make sure that you use correct version of Pro/C.
I think you should use Pro/C version 8.0.x with Forms 6.0. I don't use Forms 6i, but I think it is the same for it too. -
How to execute this SQL Query in ABAP Program.
Hi,
I have a string which is the SQL Query.
How to execute this sql Query (SQL_STR) in ABAP Program.
Code:-
DATA: SQL_STR type string.
SQL_STR = 'select * from spfli.'.
Thanks in Advance,
VinayHi Vinay
Here is a sample to dynamically generate a subroutine-pool having your SQL and calling it.
REPORT dynamic_sql_example .
DATA: BEGIN OF gt_itab OCCURS 1 ,
line(80) TYPE c ,
END OF gt_itab .
DATA gt_restab TYPE .... .
DATA gv_name(30) TYPE c .
DATA gv_err(120) TYPE c .
START-OF-SELECTION .
gt_itab-line = 'REPORT generated_sql .' .
APPEND gt_itab .
gt_itab-line = 'FORM exec_sql CHANGING et_table . ' .
APPEND gt_itab .
gt_itab-line = SQL_STR .
APPEND gt_itab .
gt_itab-line = 'ENDFORM.' .
APPEND gt_itab .
GENERATE SUBROUTINE POOL gt_itab NAME gv_name MESSAGE gv_err .
PERFORM exec_sql IN PROGRAM (gv_name) CHANGING gt_restab
IF FOUND .
WRITE:/ gv_err .
LOOP AT gt_result .
WRITE:/ .... .
ENDLOOP .
*--Serdar -
Referring Applications server file in concurrent program
Hi Gurus,
In Oracel Applications, we have a requirement, where we will place a unix script (SFTP Script) in the application server. We need to register this script as concurrent program and run from the DB Server. Can this be possible? If so please suggest.
Awaiting for your valuable replies.
Thanks in Advance,
Chandra Babu LankipalliHi Muthu,
Thanks for your reply.
When we register the shell script as a concurrent program then by default it will search for the .prog file under DB Server Bin directory.
But our requirement is .prog file will be under application server and it should run from application server only though we run the c/p
from DB server.
Thanks,
Chandra Babu Lankipallli -
How to execute oracle reports file from jsp using WL as an app server
I plan to use jsp to accept IN parameters and later want to execute oracle
report execute stored in some directory and provide results back to the
client browser window. Is this possible in JSP + WL? If yes, can you
provide some tips on the code?
Thanks.
Try
sqlplus "sys/oracletest as sysdba" @bpk.sql
Working locally, and having set the ORACLE_SID, you don't need to specify the SqlNet alias (@testdb).
Remember to put an exit at the end of the bpk.sql script. -
Anyone know how to output an XML file from ABAP to a non sapgui location?
I have a program that creates XML and then outputs a file via CALL METHOD cl_gui_frontend_services=>gui_download. But now I want to execute the program in background mode and therefore I need to be able to output that XML to a NON sapgui file location. Current code creates the XML to an internal table which is binary then the gui_download method converts that to output XML. . Does anyone know how I can change the code to either a) output the XML to an internal table which can be output via, say, a TRANSFER command..or, b) output the created binary table of XML to a NON sapgui file location?
Excerpts from current code are as follows:
first the XML is created (to the binary file)
Creating a ixml factory
l_ixml = cl_ixml=>create( ).
Creating the dom object model
l_document = l_ixml->create_document( ).
Fill root node with value XML
l_element_xml = l_document->create_simple_element(
name = 'XML'
parent = l_document ).
Create tag 'HEADER' as child of 'XML'
l_element_header = l_document->create_simple_element(
name = 'HEADER'
parent = l_element_xml ).
header information about the file and general data about the fleet follows
l_value = c_fleet_import.
l_element_dummy = l_document->create_simple_element(
name = 'TYPE'
value = l_value
parent = l_element_header ).
etc.......
then the xml is connected to the stream factory and rendered
Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
Connect internal XML table to stream factory
l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
Rendering the document
l_renderer = l_ixml->create_renderer( ostream = l_ostream
document = l_document ).
l_rc = l_renderer->render( ).
Saving the XML document
l_xml_size = l_ostream->get_num_written_raw( ).
and then output to the file
IF sy-subrc = 0.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = l_xml_size
filename = 'g:\sapdms\BSCC-DEV\EFPAC XML Files\ALL.xml'
filename = '/TRICK/727/OUT/ZEFP/EFPAC.XML' "doesnt work with sap gui
filetype = 'BIN'
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 24.
as implied by the comments the method above will successfully output the XML file to the g:drive but will not output to /TRICK/ location, which is where I need it to go in a background mode run.
This is a problem which has defeated all our local expertise and I would appreciate any help given... Barry JonesTry this code below:
data l_xml_table2 type table of xml_line with header line.
W_filename - This is a Path.
if w_filename(02) = '
open dataset w_filename for output in binary mode.
if sy-subrc = 0.
l_xml_table2[] = l_xml_table[].
loop at l_xml_table2.
transfer l_xml_table2 to w_filename.
endloop.
endif.
close dataset w_filename.
else.
call method cl_gui_frontend_services=>gui_download
exporting
bin_filesize = l_xml_size
filename = w_filename
filetype = 'BIN'
changing
data_tab = l_xml_table
exceptions
others = 24.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif. -
please tell the metalink exact link from where i can download patch to upgrade my app server.
Here is the direct download link:
http://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=5983622
Thanks
Shail -
How to generate a PDF document from ABAP program
Hi experts,
I have arequirement where in i need to create a PDF document using program. I have all the data collected into tables and i have used the calss CL_FP_PDF_OBJECT.
A pdf document is successfully created, but unable to open it because of some error. I guess some encryption is missing.
As an alternative I have created a smartform and generated its OTF data in my program and created a PDF. This is working fine.
But as per my requirement, i cannot go for a smart form.
Any help to resolve this issue will be highly appreciated.
Thanks & regards,
Asrar Ahamed MA
Infosys Tech. Ltd. INDIAHi Asrar ,
create a report with this Copy and give your program name in the selection screen whose output need to be in PDF.
*report zanusha_spool_to_pdf.
---TABLES----
tables:
tsp01.
---STRUCTURES---
data:
mstr_print_parms like pri_params,
mc_valid(1) type c,
mi_bytecount type i,
mi_length type i,
mi_rqident like tsp01-rqident.
---INTERNAL TABLES---
data:
mtab_pdf like tline occurs 0 with header line,
mc_filename like rlgrap-filename.
---SELECTION SCREEN---
parameters:
p_repid like sy-repid, " Report to execute
p_linsz like sy-linsz default 132, " Line size
p_paart like sy-paart default 'X_65_132'. " Paper Format
start-of-selection.
concatenate 'c:\'
p_repid
'.pdf'
into mc_filename.
*-- Explicitly set line width, and output format so that
*-- the PDF conversion comes out OK
mstr_print_parms-linsz = p_linsz.
mstr_print_parms-paart = p_paart.
*-- Make sure that a printer destination has been set up.
*-- If this is not done the PDF function module ABENDS
if mstr_print_parms-pdest = space.
mstr_print_parms-pdest = 'LOCL'.
endif.
*-- Setup the Print Parmaters
call function 'GET_PRINT_PARAMETERS'
exporting
authority = space
copies = '1'
cover_page = space
data_set = space
department = space
destination = space
expiration = '1'
immediately = space
in_archive_parameters = space
in_parameters = space
layout = space
mode = space
new_list_id = 'X'
no_dialog = 'X'
user = sy-uname
importing
out_parameters = mstr_print_parms
valid = mc_valid
exceptions
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
others = 4.
submit (p_repid) to sap-spool without spool dynpro
spool parameters mstr_print_parms
via selection-screen
and return.
*-- Find out the spool number
perform get_spool_number using sy-repid
sy-uname
changing mi_rqident.
*-- Convert Spool to PDF
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = mi_rqident
no_dialog = space
dst_device = mstr_print_parms-pdest
importing
pdf_bytecount = mi_bytecount
tables
pdf = mtab_pdf
exceptions
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
others = 12.
*-- Download the file
call function 'DOWNLOAD'
exporting
bin_filesize = mi_bytecount
filename = mc_filename
filetype = 'BIN'
importing
act_filename = mc_filename
tables
data_tab = mtab_pdf.
FORM get_spool_number *
Get the most recent spool created by user/report *
--> F_REPID *
--> F_UNAME *
--> F_RQIDENT *
form get_spool_number using f_repid
f_uname
changing f_rqident.
data:
lc_rq2name like tsp01-rq2name.
concatenate f_repid+0(9)
f_uname+0(3)
into lc_rq2name.
select * from tsp01 where rq2name = lc_rq2name
order by rqcretime descending.
f_rqident = tsp01-rqident.
exit.
endselect.
if sy-subrc ne 0.
clear f_rqident.
endif.
endform." get_spool_number
Thanx
Anusha. -
How do I access iPhoto files from other programs (i.e. PhotoShop Elements)
From within many programs, specifically PhotoShop Elements or Adobe Bridge tonight, I navigate to "iPhoto Library" and can not access the files within the library to use in these programs. I can get there from within Finder, just not other programs. This is extremely frustrating...can someone please help?
Of course - it is a database and you must use the correct access methods
and for a photo editor like PSE you also need to explain what you are trying to do
IF -- you want to edit photos within the iPhoto library then simply set PSE as the external editor in the iPhoto preferences - then you edit and save (not save as) and the database is automatically updated -- if you want to choose iPhoto or PSE as the editor then after setting PSE as the external editor set the external editor back to in main window and now normal editing will be in iPhoto but by right clicking on a photo in iPhoto you get a menu allowing you to use PSE for it
IF - you are generally asking and want the general answer - all open (or attach) dialogue windows have the media browser in the lower left - look under media ==>pictures ==> iPhoto but if you use this method you can not just return photos to iPhoto - you must save as and then import into iPhoto
click here for a general discussion on accessing your photos safely and correctly.
LN
Message was edited by: LarryHN -
Hi,
Could any one please answer my question.
How to archive application server file?.. What is the function module used for that?.
And my second question..
How to scan application directory.. after scanning I must be able to know how many files the source directory contians, and the file properties
Thank you..1 . use CG3Z transaction or use OPEN dATASET statement
2 . use FM EPS_GET_dIRECTORy_LISTING
Maybe you are looking for
-
HELP! Iphone 4s no video recording option?
Well hopefully someone can explain this one... just updated to IOS 7 and grreeeaaatttt... No recording option. WHY? There's only Photo / Pano / Square options when sliding left and right..
-
I am using DAQmx and I am using the read function with the 1D waveform polymorphic instance. I am simply reading 10 channels of analog voltage data, but the reason I'm using waveform is becuase I need timestamp data for each sample collected. I also
-
Photoshop elements 11 error 1935 on install
I am trying to install Photoshop 11 from the disk I just bought and keep getting an error 1935. I am well aware of the .Net potential issue here but honestly think that if this is an issue for a lot of people (as forums seem to suggest), that Adobe
-
I got my first Vision in MARCH it worked well then after 2 weeks the radio stopped working all I got was static; then a couple weks later I had a accident with the Vision and it broke and in early MAY I went to Circuit City and got another one. It wo
-
Just purchased adope premiere elements 11 and redemption code does not exist
just purchased premiere elements 11 and when trying to get serial number, i am told the redemption code does not exist, its brand new right out of the package. WHY.