How to spool only results? (minus system output)
Hi all, i have 2 problems
my script below in italics
set linesize 140
set pagesize 1000
set feedback off
set echo off
spool anotherresults.txt
select
'Country Code:"'||a.country_id||'"',
'Country Name:"'||a.COUNTRY_NAME||'"',
'Residing in :"'||a.REGION_ID||'"'
from COUNTRIES a;
my results as below:
SQL> select *
2 'Country Code:"'||a.country_id||'"',*
3 'Country Name:"'||a.COUNTRY_NAME||'"',*
4 'Residing in :"'||a.REGION_ID||'"'*
5 from COUNTRIES a;*
'COUNTRYCODE:"'|| 'COUNTRYNAME:"'||A.COUNTRY_NAME||'"' * 'RESIDINGIN:"'||A.REGION_ID||'"' *
Country Code:"AR" Country Name:"Argentina" Residing in :"2"
Country Code:"AU" Country Name:"Australia" Residing in :"3"
Problem 1: I want to get rid of lines (marked with an *). i thought setting feedback off and echo off would do the job, but i am wrong. Can anyone help? I am using oracle 10g express edition
My desired output is
Country Code:"AR" Country Name:"Argentina" Residing in :"2"
Country Code:"AU" Country Name:"Australia" Residing in :"3"
Problem 2:
How should i include a spool off command in my script? ( so that i do not need to type spool after the script completes)
i tried
Residing in :"'||a.REGION_ID||'"'
from COUNTRIES a;
spool off
i got a syntax error.
Hi Schneider,
thank you for the suggestion. i managed to hide the headers, but the SQL commands still appear in the spooled file
SQL> select
2 'Country Name:"'||a.COUNTRY_NAME||'"',
3 'Residing in:"'||a.REGION_ID||'"',
4 'Country Code:"'||a.COUNTRY_ID||'"'
5 from COUNTRIES a;
Country Name:"Argentina" Residing in:"1" Country Code:"AR"
Country Name:"Australia" Residing in:"0" Country Code:"AA"
And for 2), i am unable to identify my syntax error.
SQL> select
2 'Country Name:"'||a.COUNTRY_NAME||'"',
3 'Residing in:"'||a.REGION_ID||'"',
4 'Country Code:"'||a.COUNTRY_ID||'"'
5 from COUNTRIES a;
/results run/
I have to type 'spool off' at the end of the results in order to close the spooling. And the words 'spool off' appears in the spool file. How can i include the spool off command after line 5 so that i get a clean spooled file (only the returned rows) ?
Would appreciate if anyone can assist.
Similar Messages
-
How to spool the result of an query into a file in sql 2000
Hi All,
I have an SQL query which iterates through number of times for checking on some conditions and will return results each time. I wants to save the results into an different xml file each time. I tried using below query:
exec xp_cmdshell 'bcp "use Mimsadaptorlogs; select top 10 * from log order by logdate" queryout "D:\cdr_cg.xml" -T -c -t,' ---> Its not working as expected.
I got the Below output:
NULL
Starting copy...
SQLState = 01000, NativeError = 5701
Warning = [Microsoft][ODBC SQL Server Driver][SQL Server]Changed database context to 'MIMSAdaptorlogs'.
NULL
10 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.): total 62
NULL
Could you anuone please suggest me on this.......
Thanks and Regards, BalaYou will need to write a client program to do this. SQL Server is not intended for writing files. People still do it by calling BCP through xp_cmdshell, but this is a dubious practice. Better is to write a CLR stored procedure for the task. However, you
are on SQL 2000, and the CLR support was added in SQL 2005. Furthermore, there is no XML type in SQL 2000, and the only way to generate XML is with the FOR XML clause. But this output is not well understood by BCP. Then I try: [code} bcp "SELECT * FROM Northwind..Customers
FOR XML RAW" queryout slask.bcp -c -T [/code] on SQL 2000, I get [code] 11 rows copied. [/code] which is complete hogwash, because there are 91 rows in that table, and the output should be a single XML document, and the output looks like this: [code] <row
CustomerID="ALFKI"... Bouchers" City="Marseil... tomerID="DUMON" Company... 0.32.21.21" Fax="40.32.... los Hern ndez" ContactT... n Steel" ContactTitle="... e" ContactTitle="Market... ="Salzburg" PostalCode=... " Phone="(21) 555-3412"... ty="Charleroi" PostalCo...
<row CustomerID="WARTH"... [/code] I have truncated the output on the right side, but the left side is authentic. It really is that bad.
Erland Sommarskog, SQL Server MVP, [email protected] -
How to Convert spool which is for smartform output to PDF?
how to Convert spool which is for smartform output to PDF?
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF' is not working for smartform output,
if i use this there will be error spool not contain list output?
than whats the function module or way to convert spool contain smartform output to pdg?
regards,<b>Procedure</b>
When we activate the Smartform the system generates a Function Module. The function module name we can get from Smartfrom screen from menubar
Environment => Function Module_Name . In a report we can get this Function module name by calling a Function Module standard SSF_FUNCTION_MODULE_NAME. This function module at runtime calls the FM generated by smartform, which in turn is then used to pass data from the report to Smartform. In the report given below the FM generated is /1BCDWB/SF00000152 . In this FM we can see CONTROL_PARAMETERS in import tab. This is of type SSFCTRLOP. We need to set the GETOTF of this to be X. Setting this field will activate the OTF field in smartform.
In export tab of the FM generated by smartform we can see a parameter JOB_OUTPUT_INFO which is of type SSFCRESCL. The SSFCRESCL is a structure of having one of fields as OTFDATA. OTFDATA in turn is a table of type ITCOO. ITCOO has two fields TDPRINTCOM and TDPRINTPAR. TDPRINTCOM represents command line of OTF format data and TDPRINTPAR contains command parameters of OTF format data.
In every Smartform output in OTF format, TDPRINTCOM begins and ends with //. EP represents the end-of-page value for TDPRINTCOM field.
In addition we need to set few fields at the place where we call this FM(generated by smartform) in our program. While calling this FM we should set control_parameters, output_options, user_settings and job_putput_info fields as shown in program.
Once these settings are done we can call Function Module CONVERT_OTF to convert the OTF data of smartfrom output to PDF data format. Once these are done we can call method cl_gui_fronted_services=>file_save_dialog to specify the directory path where we want to save the output PDF file. After this we can call Function Module GUI_DOWNLOAD to download the PDF file on our local system.
<b>Here is a sample code of program to perform the function.</b>
SAMPLE CODE
[code]*&---------------------------------------------------------------------*
*& Report ZAMIT_SMART_FORM_PDF *
REPORT ZAMIT_SMART_FORM_PDF .
data: carr_id type sbook-carrid,
cparam type ssfctrlop,
outop type ssfcompop,
fm_name type rs38l_fnam.
DATA: tab_otf_data TYPE ssfcrescl,
pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,
tab_otf_final TYPE itcoo OCCURS 0 WITH HEADER LINE,
file_size TYPE i,
bin_filesize TYPE i,
FILE_NAME type string,
File_path type string,
FULL_PATH type string.
parameter: p_custid type scustom-id default 1.
select-options: s_carrid for carr_id default 'LH' to 'LH'.
parameter: p_form type tdsfname default 'ZAMIT_SMART_FORM'.
data: customer type scustom,
bookings type ty_bookings,
connections type ty_connections.
start-of-selection.
***************** suppressing the dialog box for print preview****************************
outop-tddest = 'LP01'.
cparam-no_dialog = 'X'.
cparam-preview = SPACE.
cparam-getotf = 'X'.
select single * from scustom into customer where id = p_custid.
check sy-subrc = 0.
select * from sbook into table bookings
where customid = p_custid
and carrid in s_carrid
order by primary key.
select * from spfli into table connections
for all entries in bookings
where carrid = bookings-carrid
and connid = bookings-connid
order by primary key.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting formname = p_form
* variant = ' '
* direct_call = ' '
importing fm_name = fm_name
exceptions no_form = 1
no_function_module = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
exit.
endif.
* calling the generated function module
call function fm_name
exporting
* archive_index =
* archive_parameters =
control_parameters = cparam
* mail_appl_obj =
* mail_recipient =
* mail_sender =
output_options = outop
user_settings = SPACE
bookings = bookings
customer = customer
connections = connections
importing
* document_output_info =
job_output_info = tab_otf_data
* job_output_options =
exceptions formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
if sy-subrc <> 0.
* error handling
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
tab_otf_final[] = tab_otf_data-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
* ARCHIVE_INDEX = ' '
* COPYNUMBER = 0
* ASCII_BIDI_VIS2LOG = ' '
IMPORTING
bin_filesize = bin_filesize
* BIN_FILE =
TABLES
otf = tab_otf_final
lines = pdf_tab
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
* EXPORTING
* WINDOW_TITLE =
* DEFAULT_EXTENSION =
* DEFAULT_FILE_NAME =
* FILE_FILTER =
* INITIAL_DIRECTORY =
* WITH_ENCODING =
* PROMPT_ON_OVERWRITE = 'X'
CHANGING
filename = FILE_NAME
path = FILE_PATH
fullpath = FULL_PATH
* USER_ACTION =
* FILE_ENCODING =
* EXCEPTIONS
* CNTL_ERROR = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 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.
ENDIF.
*************downloading the converted PDF data to your local PC********
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = bin_filesize
filename = FULL_PATH
filetype = 'BIN'
* APPEND = ' '
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
IMPORTING
filelength = file_size
TABLES
data_tab = pdf_tab
* FIELDNAMES =
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22
IF sy-subrc <> 0.
ENDIF.
[/code]
Thanks and Regards,
Pavankumar -
How do I only get certain questions appear in the quiz results?
I have created a course through Captivate 6, throughout the course there are questions to guage the learners attention. There is also a quiz at the end. However, captivate includes on the questions throughout the course on the quiz results which I do not want to happen.
Can anyone advise how I can only get certain questions appear on the quiz results please?Branch aware turns off the playbar in 6 (not in 7 any more, at least not for me).
Could you explain more in detail what you want, because I don't understand it. You want the user to answer all questions, but the score should only show what? If you don't want some questions to have a score added to the Quiz total, you can indicate that in the Properties of that Question slide.
And please, tell the exact number (3 versions of 6), and also if you have to report to a LMS?
Lilybiri -
How to spool out put of multiple scripts and get a single spool file output
Hi,
I have one master script that calls three other scripts. The three scripts each produce their own spool files. But I would like to have the master script also produce one single output (in addition to the three indiviual output I mean). How to do that? Can you please help.
Following are the scripts:
--m.sql (master script)
spool c:\m.log
@1.sql
@2.sql
@3.sql
spool off
--1.sql
spool c:\1.log
insert into test values(1);
commit;
spool off
--2.sql
spool c:\2.log
insert into test values(2);
commit;
spool off
spool c:\3.log
insert into test values(3);
commit;
spool off
--table used
SQL> desc test
Name Null? Type
A NUMBERWhen I run the above script m.sql it does produce the other 3 log files (1.log,2.log etc) but m.log (which is master log file which should have output of each of the three calling script) is empty file with 0 byte!
Thanks
Edited by: orausern on May 1, 2011 3:17 AMI have one master script that calls three other scripts. The three scripts each produce their own spool files. But I would like to have the master script also produce one single output (in addition to the three indiviual output I mean). How to do that? Can you please help. Not sure if that's possible directly with sqlplus spool option
When you spool to a different file in a single session, sqlplus stops writing to earlier spool file and redirects the output to the file specified in last spool command.
at the end of the script, however, below may help
host type c:\1.log >> c:\m.log
host type c:\2.log >> c:\m.log
host type c:\3.log >> c:\m.log -
ALV: how to display only subtotals and total rows in the output
ALV: how to display only subtotals and total rows in the output
i am getting output
i am getting subtotals for respective fields
but i want to display only subtotals and totals rows in the output
i have tried the
totals_only parameter in slis_layout_alv
but it is not working.hi,
For TOTAL
For the amount field / quantity field in the field catalog give DO_SUM = 'X' for WHOLE total
For SUBTOTAL
For subtotal you will have to create an internal table sort..Let's say you want to do subtotal for each customer..
DATA: lt_sort type SLIS_T_SORTINFO_ALV,
ls_sort type slis_sortinfo_alv.
CLEAR ls_sort.
ls_sort-spos = 1.
ls_sort-fieldname = 'Give the field name that you do the sum'.
ls_sort-up = 'X'.
ls_sort-subtot = 'X'.
APPEND ls_sort TO lt_sort.
fieldcatalog-do_dum = 'X'.
for subtotals
WA_SORT-FIELDNAME = 'ERSDA'.
WA_SORT-SPOS = '2'.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOTAL = 'X'.
APPEND WA_SORT TO IT_SORT.
Refer
http://help.sap.com/saphelp_erp2004/helpdata/en/ee/c8e056d52611d2b468006094192fe3/content.htm
http://sap.ittoolbox.com/groups/technical-functional/sap-dev/doesnt-function-event-subtotal_text-in-alv-713787
regards,
Prabhu
reward if it is helpful -
I have an old version of itunes on my computer. My current iPhone will only support OS 10.6.8, how can I upgrade to that system instead of the latest version?
In teh middle of this page...
-> http://support.apple.com/kb/DL1576
Download iTunes 10.7 for Windows here: iTunes 10.7 for Windows -
How could be calculate only result for cummulative value in Webi level?
Hi Expert,
I have to requirement on webi level only result calculation
scenario below like that
Company code % X
100 10
200 13
300 15
Result = only cummulative (not sum eg 38)
So how could be achieve only this result value ??
Pls advice
Regards
WaseemHi,
Gaurav and Arijit,
Thnks for reply
I have to need only Result values . I am giving one more scenario like that
Company code M J L D %
100 70 30 10 = 10/(70+30)*100 = 10
200 80 20 13 = 13/(80+20)*100 = 13
300 150 50 30 = 30/(150+50)*100 = 15
Result = L/(M+J)*M = 53/400*300 = 39.75
I hided the values M , J and L , need only result value above scenario so how could be achieve
pls reply
Regards
Waseem -
How could be calculate only result for cummulative value in bex level?
Hi Expert,
I have to requirement on bex level only result calculation
scenario below like that
Company code % X
100 10
200 13
300 15
Result = only cummulative (not sum eg 38)
So how could be achieve only this result value ??
Pls advice
Regards
WaseemHi Suman,
Thanks for reply
I had already applied its came only sum values
But i have to need only Result values . I am giving one more scenario like that
Comapny code M J L D %
100 70 30 10 = 10/(70+30)*100 = 10
200 80 20 13 = 10/(80+20)*100 = 10
300 150 50 30 = 30/(150+50)*100 = 25
Result = L/(M+J)*M = 53/400*300 = 39.75
I hided the values M , J and L , need only result value above scenario so could be achive
pls reply
Regards
Waseem -
How to import payroll result from 3rd party system to SAP
Hi Experts,
May i know how to import payroll result from legacy system / 3rd party payroll system into SAP.
i need to import the payroll result from Jan - April (from 3rd party payroll system) and system go live on May. I using payroll malaysia.
Thanks.check this link
http://help.sap.com/saphelp_40b/helpdata/en/91/80e9087834d111a4620060b03c3b0e/content.htm -
How Can One Run Only In The System Administrator ( ie root ) ?
Upon creating a System Administrator ( ie root ) in Command + R , of course after Clean Installing OS X ML with my own specific Apple Verified Account ,
i have the Log In screen from a startup , either Safe Boot or a Boot , and i have my own specifc Apple Verified Account , plus the Other... ,
which the Other... of course is the System Administrator ( ie root ) .
How Can One Run Only In The System Administrator ( ie root ) ?
Is there a way in Terminal with sudo su to make it work ?
Shall i just always log in with Other... System Administrator ( ie root ) , and just forget the my own specific Apple Verified Account ?As of EHP3, you could still install some EHP components. On an ERP 6.00, you could just push SAP_APP to 6.03 and move on. Now if you want another component in your system with an EHP4 version, you can't have some components at EHP3 and some at EHP4. You would install EHP4 for the new component you desire updated and part of the work will be to also update SAP_APP to 6.04.
EHP4 is an UPGRADE process, with shadow instance & all the joy of an upgrade process. You can either run ressource minimized or downtime minimized. In resource minimized, the shadow instance runs on the same server as the main instance. Downtime minimized allow to run the shadow instance on a separate / new server. Anyway you go, you will always have a "Downtime Phase" when you bring back the updated components from the shadow instance toward the real production one.
As with any UPGRADE project, the benefits of installing EHP4 for your business has to weighted against the downtime cost.
Our tests so far on small systems (few data, few users, 120GB database) show ~3 days process from EHP3 to EHP4 (all components) with a downtime phase of about 22 hours using the "resource minimized" path, i.e. shadow & main instance on the same server (4 CPUs, 16GB RAM). Until you give a try at your Sandbox or DEV systems, you won't have realistic figures for your environment.
Good luck! -
Just wondering, how can i use time machine to only backup my system once? Just this once and not on a weekly basis?
Upgrade. My three year old Mac Pro and year old MacBook Pro have no problem. Both seem faster.
And there's your problem reading entirely subjective views on forums, from people that might or might not have decently maintained systems, good operating practices, or whatever....
Strangely, when most companies issue new software, it is because they believe (and believe they have checked) that it is better than the previous version. -
How to backup only the system with time machine?
Hi,
I have an external disk, seagate, that I used to backup working files from an older Mac.... I got a new Mac mini and would like to backup the system.
I don't want to erase these old files. Is it possible to only backup the system OS and installed software, with Time Machine I don't know if you would call this a bootable disk or the hard drive needs to be blank?You should have a separate partition (or disk) for Time machine or it may at some point overwrite your other files because it makes hourly updated backups so it needs more and more room.
-
How to get only the first result in extract function
do you know how to get only the first element of the function extract.
v_result := p_response.doc.extract('//'||p_name||'/child::text()').getstringval();
if i have 5 responses like '100','100',100','200','200' e get '100100100200200' and i want only '100'.
thanks in advanceTwo ways .....
1. Use Javascript E4X instead ...there are nice functions for getting children of parents.
2. Cycle through all of the form1.nodes and look for objects that have a className of "subform". For loops are useful for this task.
Make sense?
Paul -
SAP Query: How to filter records from SAP Query output before display
Hi Friends,
Can I delete records from an SAP query basic list before it is displayed?
For example I want to delte all the orders whose system status is "RELEASED" before the basic list of that SAP query is displayed.
I have gone through SAP help and found out that we can write some code in <b>END code</b> section which will execute before the basic list of the query is displayed. But I could not figure out how the code this...following is an excerpt form SAP help.
<b>"The END-OF-SELECTION code consists of two parts (Before list output and After list output). The first part is processed before the list is output and the second part afterwards."</b>
Can anybody help me?
Regards,
Bharat.
Message was edited by:
Bharat Reddy VTry this simple procedure. <b>Hope</b> this should work for you.
You do the slection of the status in the List-Processing. say your final field of status flag is GF_STATUS.
Immediatly after that use this within the List-Processing.
CHECK GF_STATUS EQ '<RELEASED STATUS>'
How it works:
SELECT <> "<-------Query processing(system code).
*< Your code put in the List processing
CHECK GF_STATUS EQ '<RELEASED STATUS>' "< --only released records passed.
*>
ENDSELECT "<-----Query endselect(system code).
Please let me know the result.
Regards,
A.Singh
Message was edited by:
Amarjit Singh
Maybe you are looking for
-
Copernicus crashes when after adding certain fields to a Webservice
Hi Everybody, I am having a frustrating issue that is causing Copernicus to crash whenever I add certain fields to a Web service. For instance, if I create a web service for the ServiceRequest BO, and include the TextCollection field, once it is save
-
Calling varargs method without varargs parameter.
Hello I really appreciate your help on clarifying the following problem. 1) I have method signature as public User validateUser(User usr, boolean isLogin,Object...args) 2) When I call this method as obj.validateUser(usrObject,true); In windows enviro
-
Adobe Acrobat Pro 7 Accessibility Issue
I have an existing form that was designed in Adobe Pagemaker 7 that includes check boxes (wingding font). I've converted it to a pdf using Distiller 7. I open it using Acrobat Pro 7 and then run the Full Check tool for Accessibility I get the followi
-
Understanding targetNamespace attribute of the service ant tag
I am using the servicegen and clientgen ant tasks provided by bea to generate the webservices rpc code for a bean client. Nested in the servicegen task, in the service tag is a targetNamespace attribute that is required http://e-docs.bea.com/wls/docs
-
When I try to generate an IDOC via PU12 OTMU, I am receiving this error. I recognize 00000103 as a Personnel number at OTMU as the interface. However the rest of the message I don't understand. Can someone explain what I need to do to get this to