Spool output of a script
Dear
Could you please help me, how should i spool the output of an sql script to a file; please reply me back with the scripts.
Thanks n Regards,
SQl>set head off term off feedback off echo off
SQl> set colsep ','
SQl SET TRIM ON
SQl>set buffersize 1000000
SQl> spool c:\filenme.txt
SQl>select * from emp;
SQl>spool off
SQl>
you can turn on what ever is off and trim offHTH
Similar Messages
-
Hello, How do I tell sql+ to spool output file from windows to Unix server?
Hello, How do I tell sql+ to spool output file from windows to Unix server?
I am new to SQL+ and just learned how to spool the file. But file is saved in my local windows enviroment and since it's 2GB in size...I want to spool it directly to another remote unix server.
Pls answer in detail... I have been to most of the thread and didn't see relevant answer to above question.
Am I suppose to develope some script which FTP the spool file directly to the server I want to
or
i Have to use UTL_FILE Package ?
Thanks for replyYou may not be able to...
SQL*Plus can only spool to the local machine. If you have mapped a directory on the Unix server from your Windows machine, you can specify that directory in your SPOOL command.
You could telnet to the Unix server, run SQL*Plus there, and spool the file to a local (Unix) directory.
If the Unix server is also the Oracle database server, you could use the UTL_FILE package rather than using SQL*Plus to spool a file.
If the Unix server is also an FTP server, you could also FTP the file from your local machine to the server.
Of course, I would tend to re-examine a requirement to regularly generate a 2 GB text file. It seems likely that there is a better way...
Justin -
We are currently scheduling some standard reports in jobs. We would like to convert the spool output to PDF. Is there a way to parameterize the network location such that I can use the same PDF print driver to print to different locations specified in the print specifications in the job ? Is there such a PDF print driver for Windows which would allow me to pass the print location instead of a pop-up ?
Thanks
SridharHi,
Use the FM convert_otfspooljob_2_pdf
see this link for example Re: Download in PDF format
"Do not use CONVERT_ABAPSPOOLJOB_2_PDF for script or Smartforms
Prabhudas -
Convert SAP spool output to PDF
I have created program running in background to convert SAP spool output to PDF using function CONVERT_ABAPSPOOLJOB_2_PDF .
It has been working fine untill I have SAP spool contained > 99 pages. It has a dialog pop up asking to run it in background.
If I clicked YES, the function generated another background job and another spool.
Also the returned table PDF contained no data.
But it is ok when click NO. The program can generate PDF file.
My problem is I want to set this program as job, so it will not generate PDF file when SAP spool contained > 99 pages.
Has anyone experienced about this problem? or know how to convert to PDF from SAP spool (>99 pages)?
Thank you in Advance.Hi,
Use the FM convert_otfspooljob_2_pdf
see this link for example Re: Download in PDF format
"Do not use CONVERT_ABAPSPOOLJOB_2_PDF for script or Smartforms
Prabhudas -
SQLPlus output within bash script
Hey everyone, I wasn't sure if this should go here or in the SQL forum or the Linux forum, but here goes:
Using Oracle10g on Linux, I'm using a bash script to run an sql script, but when I try to echo the results, it shows the output in a single line.
Here's the script
USERLIST=`sqlplus -s / AS SYSDBA <<EOF
set head off
set verify off
set feedback off
SELECT username from dba_users;
exit;
EOF
`
echo $USERLIST;And here's the output:
oracle@apps scripts]$ ./userl.sh
PAYROLL HR2 CORE DEMO TIMEKEEPING SYS EXPENSE Is there anyway so that the output can be shown with line breaks, where all the output is not on one line? I understand I can spool to a file using the spool command, however I'd like to try and get it working this way first.
Any help would be much appreciated, thanks.
Edited by: oscrub on Sep 22, 2010 6:46 PMHandle: oscrub
Status Level: Newbie
Registered: Oct 5, 2008
Total Posts: 7
Total Questions: 4 (3 unresolved)
so many questions & so few answers.
sh t.sh
SYSTEM
SYS
MGMT_VIEW
DBSNMP
SYSMAN
USER1
DBADMIN
HR
OE
SH
BONGO
SCOTT
OUTLN
OLAPSYS
SI_INFORMTN_SCHEMA
OWBSYS
ORDPLUGINS
XDB
ANONYMOUS
CTXSYS
ORDDATA
OWBSYS_AUDIT
APEX_030200
APPQOSSYS
WMSYS
EXFSYS
ORDSYS
MDSYS
FLOWS_FILES
SPATIAL_WFS_ADMIN_USR
SPATIAL_CSW_ADMIN_USR
APEX_PUBLIC_USER
DIP
IX
MDDATA
PM
BI
XS$NULL
ORACLE_OCMHow do you spell S-Q-L? -
Not generating a spool output in the background job
Hi Team,
I have an alv report and If I schedule the program using SM36 transaction it is not generating the spool ouput.
If I run the same program in background mode when we use se38 and select execute in background in program menu and it works successfully and generates alv grid list in the spool output.
But, user wants to schedule the job in sm36 and check the same output in spool. Please advise why it is not generating.
Note:I am using the cl_salv_table=>factory method to generate the output.
Thanks in advance,
Sunil Kumar.This is not really an ABAP question and you might want to ask your Basis admin for assistance. But I believe that spool will not be generated if you don't specify print parameters for a step. When you define the step in SM36, make sure to specify the print parameters.
-
ALV list display in a Background job - Spool output
Hi,
We are currently working on a report scheduled to be run in the background job, and the ALV list is displayed in the spool output.
ALV list in the spool does not look the same as front run job, the column headers are all crowded together, and there is no grid in-between different columns or rows. It's hard to read.
Is there a way to add grid for this kind of output?
Thanks!Hi Deepak:
I expanded your report into two rows display, and the grid in the spool display simply gone!
report zzscratch line-size 120 no standard page heading.
type-pools slis.
tables pa0001.
data : li_field type standard table of slis_fieldcat_alv,
gi_events type standard table of slis_alv_event,
gr_layout_bck type slis_layout_alv,
gr_save like disvariant,
gr_events type slis_alv_event.
types : begin of gtt_emp,
pernr type persno,
ename like pa0001-ename,
uname like pa0001-UNAME,
end of gtt_emp.
data : lr_field type slis_fieldcat_alv.
data : lc_rep like syst-repid.
data : li_emp type standard table of gtt_emp,
lr_emp type gtt_emp.
data : gv_ref_table type lvc_rtname.
gv_ref_table = 'CATSDB'.
lr_field-fieldname = 'PERNR'.
lr_field-ref_tabname = gv_ref_table.
lr_field-inttype = 'N'.
lr_field-outputlen = 8.
lr_field-seltext_l = 'EMPLOYEE Number'.
append lr_field to li_field.
lr_field-fieldname = 'ENAME'.
lr_field-ref_tabname = 'PA0001'.
lr_field-inttype = 'C'.
lr_field-outputlen = 40.
lr_field-seltext_l = 'EMPLOYEE Name'.
append lr_field to li_field.
lr_field-fieldname = 'UNAME'.
lr_field-ref_tabname = 'PA0001'.
lr_field-inttype = 'C'.
lr_field-outputlen = 12.
lr_field-seltext_l = 'User Name'.
lr_field-row_pos = 2.
lr_field-col_pos = 1.
append lr_field to li_field.
lc_rep = sy-repid.
gr_layout_bck-edit_mode = 'D'.
gr_save-report = sy-repid.
lr_emp-pernr = '00000001'.
lr_emp-ename = 'abc'.
lr_emp-uname = 'testus'.
append lr_emp to li_emp.
lr_emp-pernr = '00000002'.
lr_emp-ename = 'def'.
append lr_emp to li_emp.
lr_emp-pernr = '00000003'.
append lr_emp to li_emp.
lr_emp-pernr = '00000004'.
append lr_emp to li_emp.
lr_emp-pernr = '00000005'.
append lr_emp to li_emp.
lr_emp-pernr = '00000006'.
append lr_emp to li_emp.
lr_emp-pernr = '00000007'.
append lr_emp to li_emp.
lr_emp-pernr = '00000008'.
append lr_emp to li_emp.
end-of-selection.
Function module for ALV grid display
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = lc_rep
is_layout = gr_layout_bck
it_fieldcat = li_field
i_save = 'A'
is_variant = gr_save
it_events = gi_events
TABLES
t_outtab = li_emp[]
EXCEPTIONS
program_error = 1
others = 2.
if sy-subrc <> 0.
clear gr_messages.
message e023 into gr_messages.
append gr_messages to gi_messages.
endif. -
Changing the file format of spool output when scheduling a background job.
Hello Experts,
I have an issue. It is related to Spool output format. I created a job for one report program for which the output is a list output. I have added one recipient in the 'Spool list recipient' while creating the job SM36. After the job is finished the spool output is sent to the recipient mail id as .htm format as an attachment. But the attachment should be excel sheet or text file. No coding in the program should be used to convert the file format. Only settings in the spool while creating job should be manipulated. Please help me in solving this issue.
Regards.Hi Sunil,
You can use the logic for converting spool to PDF using program : RSTXPDFT4 . Alternatively you can use FM: CONVERT_ABAPSPOOLJOB_2_PDF . In this FM you need to pass the Spool id .
u can make use of these FM's SO_DOCUMENT_SEND_API1
SO_NEW_DOCUMENT_SEND_API1
Check out the following wiki:
https://wiki.sdn.sap.com/wiki/display/Snippets/ConvertsspoolrequestintoPDFdocumentand+emails
hope this will use full to you.
Thanks!! -
How to send the spool output to the specific user during ALE distribution
Hi All
In ALE internal order Configuration done by BAPI Method SAVEREPLICA Business object BUS2075whenever user changed the internal order which is moved to the destination system because of change data setting in data element fields.
I want to know how to send the spool output of the changed internal order to the specific user during ALE distribution.
Please help me to reslove the above issue
Thanks & Regards
KRISHGUNASolved by myself
-
Background job - Spool output screwed up.
Hi Friends,
i am running a report in background and i have 40 to 50 columns as a result the output of the back ground job spool output does not show in one lone but as soon as it reaches to the certain point it splits the line and shows one line as as two...
what could be the problem?
thank you,
pasala.Check
In your report
- [REPORT - list_options|http://help.sap.com/abapdocu_70/de/ABAPREPORT_LIST_OPTIONS.htm] [LINE-SIZE width|http://help.sap.com/abapdocu_70/de/ABAPREPORT_LIST_OPTIONS.htm#&ABAP_ADDITION_2@2@]
- [NEW-PAGE|http://help.sap.com/abapdocu_70/en/ABAPNEW-PAGE.htm] [LINE-SIZE width |http://help.sap.com/abapdocu_70/en/ABAPNEW-PAGE_OPTIONS.htm#&ABAP_ADDITION_4@4@]
In print parameter of the step/job
- [SUBMIT - spool_options |http://help.sap.com/abapdocu_70/en/ABAPSUBMIT_PRINT_PARAMETERS.htm] [SPOOL PARAMETERS pri_params|http://help.sap.com/abapdocu_70/en/ABAPSUBMIT_PRINT_PARAMETERS.htm#&ABAP_ADDITION_1@1@] or [LINE-SIZE width |http://help.sap.com/abapdocu_70/en/ABAPSUBMIT_LIST_OPTIONS.htm#&ABAP_ADDITION_1@1@]
Also read [Printing Lists |http://help.sap.com/abapdocu_70/en/ABENPRINT.htm] and [SET_PRINT_PARAMETER|http://www.sdn.sap.com/irj/scn/advancedsearch?query=set_print_parameters] for LAYOUT and LINE_SIZE parameters.
Regards,
Raymond -
Page breaks appear in the spool output of report when run in the background
Hi All,
Report is using fm 'REUSE_ALV_GRID_DISPLAY' to display the report. parameters passed to this fm for display are :it_fieldcat,is_layout,it_events,t_outtab.
Page breaks appear in the spool output when report is run in the background.These page breaks needs to be removed. When executed in the background, the excel extract should be the same as if pulling directly from the report itself.
How to remove the page breaks in background?
Thanks & Regards,
Abhishek SinghHi
You can use the below code , which the reprt run in background. If you run the report in background thenyou need to use 'REUSE_ALV_LIST_DISPLAY'
if sy-batch = ' '.
call 'REUSE_ALV_GRID_DISPLAY'.
else.
call 'REUSE_ALV_LIST_DISPLAY'.
endif.
if you are using OO alv then write this code..
CALL METHOD cl_gui_alv_grid=>offline
RECEIVING e_offline = off.
IF off IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
ENDIF.
Regards -
Spool output not appearing on one page
Hello Experts,
When program runs in foreground, I am getting correct output i.e. ALV blocks are displayed on one page only.
But when running same program in background, I got output in spool and when looked at spool output that time I realized that the ALV blocks are getting printed on new page.
So instead of displaying 4 pages it is displaying 8 pages in spool.
I ran the same report on quality in FOreground as well as background and output appears to be correct.
But not sure why it is giving distorted (printed on new pages) in SPOOL output.
Appreciate your help.
Thank you.
SaurabhHI Saurabh,
Check the Layout which you are passing which scheduling the job. It seems to be a different layout as compared to other system & hence the issue.
Thanks,
Best regards,
Prashant -
How to save the output of sap script to pdf document in sap
hi abapers
how to save the output of sap script in sap so that can retrieve the saved document later.
i have to save the rcia output from sap script in pdf document in sap so that it can be retrieved later
how to use dmsHi deepika,
This thread will solve ur problem OTF -> PDF
Regards,
Pravin -
Spool output in Excel sheet format
Hi,
We have background job , which creates a spool output in Internet Explorer format. Customer needs this in Excel format.
Wondering, if any authorizations to be changed for file type? or this is a set in program level?
Thanks,
SamYes....Currently the customer email address is added to "Spool list Recipient" in SM37. This way, spool output is sent to customer through email. Currently it is in HTML format.
Thanks,
Sam -
Redirecting spool output to a file on app. server
I'm running a SAP report as a background job.
I hve a requirement to send the spool output to a file on app. server. This needs to happen automatically in background.
I'll appreciate any suggestion.Hi,
use report from Re: output to pdf format and substitute pc-download with file transfer
good luck
Andreas
Maybe you are looking for
-
Apple ID - Lack of Business Support
Dear Community, I am coming to you asking for advice. I tried everything else, but I simply ran out of options. Here's the story: I run a voip business - we develop a software to handle wholesale operations. It is natural that 99.9% of this market is
-
How can i get my money apple promissed
i have not received an e-mail nor any money or credit for my purchase of the 8gig I-phone. I was the first one in line when they came out in Thibodaux, la. I don't understand why or how i am supposed to collect the two hundred dollars or the one hund
-
I am having 3 problems - 1. my ipod does not show as a device in itunes 2. the synch ipod selection in file is greyed out 3. the computer will not recognize my USB cable. I have tried reloading 7.3, buying new USB cables, using different ports and al
-
In photos on my ipad when I tap edit there is no "-" or delete button or option?
Need help deleting albums and photos in "photos", edit option doesn't give me this option?
-
Please tell me your idea about my manner of using proxy user
Hello Please say to me your idea about my manner of using proxy user , I don't know that my method is right , doesn't it has security weakness ? Let me to say what I wanna do : I want my application users authenticated by database , therefore in my d