Append spool file
Hi friends,
i am using oracle 9.2.0.4.0. Totallly i have 9 instances (5 in windows 2000 and remaining in linux)... I need to take some reports from my all databases weekly basis... i dont have idea to append the results into spool file. Can you please give me the idea to create single output file instead of nine files? (Can i append the all the result into single file is any option?) please guide me...
Regards,;
Karthik
Can this help for you ?
Re: spool/save append?
Similar Messages
-
Append new records for a spool file
Hello,
I am running a query and sending the output to a spool file.
The query never returns the same data because it is run every 2
hours
How can I make the spool to append the new records and not
overwrite the old records?
Thanks
CarlosSPOOL.SPO[OL] [filename[.ext]|OFF|OUT]
Oracle documentation provides no indication that any append
functionality exists for the sql*plus command SPOOL.
I can recommend two solutions:
1. Spool to a temporary file in sql*plus, then perform a
concatenation using the OS. Automate the process with a shell
script (or batch file, as the case may be).
2. Write the file using DBMS_OUTPUT.
-Kevin -
Creating a spool file with date/time appended to file name
In Oracle Sql*Plus, I want to spool out a file, with the date-time stamp as part of the file name. Any idea how to do this?
Here's what I have right now:
SQL>
set serveroutput on size 200000;
rem
rem $OFSA is a UNIX alias so sql plus is talking to UNIX
rem
spool $OFSA/logs/OFSAP/common_coa_id.log;
prompt 'Enter date in mmddyyyy format, without quotes';
exec upd_common_coa_id_driver ('&date_mmddyyyy');
spool off;
As an example, I'd like to have a file with this name: common_coa_id083002.log
Thanks.In SQL*Plus this is what you can do to get the current date/time as part of the spool file:
============================================================================================
SQL> column tm new_value file_time noprint
SQL> select to_char(sysdate, 'YYYYMMDD') tm from dual ;
1 row selected.
SQL> prompt &file_time
20020816
SQL> spool C:\Temp\logfile_id&file_time..log
. /* put your code here */
. /* it will go to a file called C:\Temp\logfile_id20020816.log */
SQL> spool off
SQL> -
Smartforms: Appending Spool o/p(report) to PDF generated by SSF
Dear Murugesh
I have attached the code for Appending Spool o/p(report) to PDF generated by SSF below
Please suggest as i will have 2 finish by this SAT.
(Hint : Under 1 SOrdr there may be several line items==>
The material with ref 2 every line-item either may be configurable(ZPL3) or nonconfigurable(ZA3C)) .
*ENCLOSER TO PACKING LIST
SELECT VBELN POSNR INTO CORRESPONDING FIELDS OF TABLE T_VBAP
FROM VBAP
WHERE VBELN = SSORD.
*For capturing the o/p pages from ZPL3 and consolidating into table
*T_OTF to get single PDF
LOOP AT T_VBAP INTO T_VBAP.
ITNO = T_VBAP-POSNR.
SELECT SINGLE * FROM ZPP_PLCMH WHERE VBELN = SSORD
AND POSNR = ITNO.
IF SY-SUBRC EQ 0.
SET PARAMETER ID: 'AUN' FIELD SSORD ,
'APO' FIELD ITNO.
CALL TRANSACTION 'ZPCE' AND SKIP FIRST SCREEN.
IMPORT A = T_OTF2 FROM MEMORY ID 'MEMID'.
LOOP AT T_OTF2 INTO T_OTF2.
APPEND T_OTF2 TO T_OTF.
ENDLOOP.
REFRESH T_OTF2.
ELSE.
*For capturing the o/p pages from ZA3C and Appending
*at the end of the PDF file just created by the above code
SELECT SINGLE * FROM ZPLH WHERE VBELN = SSORD
AND POSNR = ITNO.
IF SY-SUBRC EQ 0.
SET PARAMETER ID: 'AUN' FIELD SSORD,
: 'APO' FIELD ITNO.
CALL TRANSACTION 'ZPNE' AND SKIP FIRST SCREEN.
IMPORT B = SPOOL_ID FROM MEMORY ID 'MEMID2'.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = SPOOL_ID
NO_DIALOG = ''
DST_DEVICE = E_DEVTYPE
PDF_DESTINATION = 'LOHP'
IMPORTING
PDF_BYTECOUNT = BTC
PDF_SPOOLID =
LIST_PAGECOUNT =
BTC_JOBNAME =
BTC_JOBCOUNT =
TABLES
PDF = T_SPOOL_2_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
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
TEXT02 = ITNO.
MESSAGE I014(ZQOTBANK) WITH TEXT02.
ENDIF.
ENDIF.
ENDLOOP.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
EXPORTING
USE_OTF_MC_CMD = 'X'
ARCHIVE_INDEX =
IMPORTING
BIN_FILESIZE = BIN_FILESIZE
TABLES
OTF = T_OTF
DOCTAB_ARCHIVE = T_DOC
LINES = T_LINES
EXCEPTIONS
ERR_CONV_NOT_POSSIBLE = 1
ERR_OTF_MC_NOENDMARKER = 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.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = BIN_FILESIZE
FILENAME = 'C:\SD6.pdf'
FILETYPE = 'BIN'
APPEND = 'X'
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 = BIN_FILESIZE
TABLES
DATA_TAB = T_LINES
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanx
Moni
Message was edited by: md monirujjamanHello,
Can you explain the problem in detail plz.
I do see that the logic which was proposed is implemented in code.
please check at various places, in run time the following points:
1. Spool ID exported into ABAP Memory.
2. Contents of the Main OTF IntTab.
3. Conversion of the Spool to PFD.Check whether SUBRC = 0. <b>Un-comment all the Exceptions in your FMs where-ever you make a call in your program.</b>
If this conversion of Spool to PDF is successful, you can choose "Append" option from the popup.
Hope this helps you. Or if you have any specific query let me know.
Regards, Murugesh AS -
Can a spool file be sent as an attachment in the decision step?
Hi,
I have z program that runs in background and produces a spool file. Normally, I can use tcode SP01 to display this file. At the end of this z program, I call SWW_WI_START_SIMPLE to send a workflow into SAP inbox. I want to know if I somhow can send the spool file along also? I read about attachment and SOFM object but still can't figure out what I need to do yet. Please help.
Thank you,
THHi Th,
Check this code if helpful.
FORM pdf_conversion.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = spoolno
no_dialog = ' '
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = 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.
ENDFORM. " PDF_CONVERSION
FORM SPOOL *
FORM spool.
PERFORM display.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = 'LOCL'
immediately = ' '
new_list_id = 'X'
expiration = '9'
in_parameters = p_pripar
layout = 'X_65_132'
line_count = 65
line_size = 132
mode = 'DEFVALS'
no_dialog = 'X'
IMPORTING
out_parameters = p_pripar
valid = val
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
NEW-PAGE PRINT ON NEW-SECTION PARAMETERS p_pripar NO DIALOG.
PERFORM display.
NEW-PAGE PRINT OFF.
CLEAR t_filename_tx.
CONCATENATE 'c:\temp\' p_mat '.pdf' INTO t_filename_tx.
CONDENSE t_filename_tx.
SELECT * FROM tsp01 INTO TABLE t_tsp01
WHERE rqowner EQ sy-uname.
SORT t_tsp01 BY rqcretime DESCENDING.
LOOP AT t_tsp01.
spoolno = t_tsp01-rqident.
EXIT.
ENDLOOP.
IF sy-subrc EQ 0.
PERFORM pdf_conversion.
ENDIF.
sending that inernal to mail
FUNCTION z_p_traveler_workflow.
""Local interface:
*" IMPORTING
*" REFERENCE(V_FILE_PATH) LIKE RLGRAP-FILENAME
*" REFERENCE(DOKNR) LIKE CRVD_A-DOKNR
*" REFERENCE(DOKVR) LIKE CRVD_A-DOKVR
*" TABLES
*" PDF STRUCTURE TLINE
D A T A
DATA: w_gd_doc_data LIKE sodocchgi1.
internal table for body content of the email
DATA: t_message LIKE solisti1 OCCURS 0 WITH HEADER LINE.
internal table for receivers of email
DATA: t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
internal table for attachment data
DATA: t_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE.
*internal table for Information about structure of data tables
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
internal tables for attachment data
DATA: t_xi_pdf LIKE tline OCCURS 0 WITH HEADER LINE,
t_xi_temp LIKE bapiqcmime OCCURS 0 WITH HEADER LINE,
t_xi_mime(255) TYPE c OCCURS 0 WITH HEADER LINE,
t_html LIKE solisti1 OCCURS 0 WITH HEADER LINE.
for splitting of the filepath
DATA : BEGIN OF t_split OCCURS 0,
row(50),
END OF t_split.
DATA: w_tab_lines LIKE sy-tabix,
w_subject TYPE so_obj_des, " for email header
w_file_path1 TYPE string. "file path
DATA : w_lines TYPE i,
w_temp(500) TYPE c,
w_offset TYPE p,
w_lineslen(2) TYPE p,
w_mimelen(2) TYPE p,
w_tabix LIKE sy-tabix.
DATA : w_len TYPE i,
w_index LIKE sy-index,
w_doc_type TYPE so_obj_tp,
w_filename TYPE so_obj_des .
internal table for gettting personal numbers of quality engineers
DATA: BEGIN OF t_ztptwf2 OCCURS 0,
pernr LIKE ztptwf2-pernr, "personal number
END OF t_ztptwf2.
internal table for gettting userids of quality engineers
DATA: BEGIN OF t_pa0105 OCCURS 0,
usrid LIKE pa0105-usrid, " user id of the quality engineer
END OF t_pa0105.
move file path to w_file_path
w_file_path1 = v_file_path.
*assign subject of the email
w_subject = text-006. "Travaler Document to Approve
refreshing the internal tables
REFRESH : t_objbin, t_packing_list, t_split.
CLEAR : t_objbin, t_packing_list, t_split.
CLEAR : t_xi_pdf, t_xi_temp.
REFRESH : t_xi_pdf, t_xi_temp.
CLEAR: w_temp, w_offset, t_xi_temp.
move attachment data to t_xi_pdf[].
t_xi_pdf[] = pdf[].
Reformat the line to 255 characters wide
DESCRIBE TABLE t_xi_pdf LINES w_lines.
DESCRIBE FIELD t_xi_pdf LENGTH w_lineslen.
DESCRIBE FIELD t_xi_temp LENGTH w_mimelen.
LOOP AT t_xi_pdf.
w_tabix = sy-tabix.
MOVE t_xi_pdf TO w_temp+w_offset.
IF w_tabix = w_lines.
w_lineslen = strlen( t_xi_pdf ).
ENDIF.
w_offset = w_offset + w_lineslen.
IF w_offset GE w_mimelen.
CLEAR t_xi_temp.
t_xi_temp = w_temp(w_mimelen).
APPEND t_xi_temp.
SHIFT w_temp BY w_mimelen PLACES.
w_offset = w_offset - w_mimelen.
ENDIF.
IF w_tabix = w_lines.
IF w_offset GT 0.
CLEAR t_xi_temp.
t_xi_temp = w_temp(w_offset).
APPEND t_xi_temp.
ENDIF.
ENDIF.
ENDLOOP.
*move data from t_xi_temp to t_xi_mime
LOOP AT t_xi_temp.
t_xi_mime(255) = t_xi_temp-line.
APPEND t_xi_mime.
CLEAR t_xi_mime.
ENDLOOP.
*move data from t_xi_mime[] to t_html[]
t_html[] = t_xi_mime[].
*move data from t_html[] to t_objbin.
LOOP AT t_html.
t_objbin-line = t_html-line.
APPEND t_objbin.
CLEAR t_objbin.
ENDLOOP.
*fill the body of email
t_message = text-005. "Mail with PDF attachment
APPEND t_message.
CLEAR t_message.
t_message = text-004. "Please double click the attachment to verify
APPEND t_message.
CLEAR t_message.
concatenate 'COPY FOR VIEWING ONLY-NOT TO BE'
'USED/PRINTED FOR PRODUCTION' into t_message separated by
space.
APPEND t_message.
CLEAR t_message.
IF NOT doknr IS INITIAL.
CONCATENATE text-001 "The Document
doknr
text-002 "and Version
dokvr
text-003 INTO "is changed
t_message SEPARATED BY space.
APPEND t_message.
CLEAR t_message.
ENDIF.
DESCRIBE TABLE t_message LINES w_tab_lines.
READ TABLE t_message INDEX w_tab_lines.
w_gd_doc_data-doc_size = ( w_tab_lines - 1 ) *
255 + STRLEN( t_message ).
w_gd_doc_data-obj_langu = sy-langu.
w_gd_doc_data-obj_name = 'SENDFILE'.
w_gd_doc_data-obj_descr = w_subject.
w_gd_doc_data-sensitivty = 'O'.
CLEAR t_packing_list.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
t_packing_list-doc_type = 'RAW'.
t_packing_list-body_num = w_tab_lines.
APPEND t_packing_list.
IF NOT w_file_path1 IS INITIAL.
w_len = strlen( w_file_path1 ) - 3.
w_doc_type = w_file_path1+w_len(3) .
TRANSLATE w_doc_type TO UPPER CASE .
SPLIT w_file_path1 AT '\' INTO TABLE t_split .
DESCRIBE TABLE t_split LINES w_index .
READ TABLE t_split INDEX w_index .
w_filename = t_split-row .
w_len = strlen( w_filename ) - 4.
w_filename = w_filename(w_len) .
DESCRIBE TABLE t_objbin LINES w_tab_lines.
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
t_packing_list-doc_type = w_doc_type.
t_packing_list-body_num = w_tab_lines.
t_packing_list-doc_size = w_tab_lines * 255.
t_packing_list-obj_descr = w_filename.
APPEND t_packing_list.
ENDIF.
fill the Receivers
SELECT * FROM ztptwf2 INTO TABLE t_ztptwf2.
IF NOT t_ztptwf2[] IS INITIAL.
SELECT usrid FROM pa0105 INTO TABLE t_pa0105 FOR ALL ENTRIES IN
t_ztptwf2 WHERE pernr = t_ztptwf2-pernr AND subty = '0001' .
LOOP AT t_pa0105.
t_receivers-receiver = t_pa0105-usrid.
t_receivers-rec_type = 'B'.
APPEND t_receivers .
CLEAR t_receivers.
ENDLOOP.
ENDIF.
IF NOT t_receivers[] IS INITIAL.
Call the FM to post the message to SAPMAIL
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_gd_doc_data
commit_work = 'X'
TABLES
packing_list = t_packing_list
contents_txt = t_message
contents_bin = t_objbin
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
ENDIF.
FREE: t_objbin,t_message,t_packing_list,t_receivers.
i hope this code will solve your problem.
Sankar -
How to send generated Spool file through e-mail
Hi,
We have a ABAP report which generates a spool file. Now there is a requirement to send this spool file to our clients external mail boxes.
Also we would like to automate this so that whenever a spool file is generated, the system should automatically send it as an attachment to user mail inboxes.
Any idea how I can achieve this. Thanks is advance!
Regards,
Vikrant.Hi Vikrant,
Have a look at this code...
z_send_email_fax_global
FUNCTION-POOL z_gfaian_mail_fax. "MESSAGE-ID ..
WORK TABLE AREAS
TABLES: tsp01.
INTERNAL TABLES
DATA: lt_rec_tab LIKE STANDARD TABLE OF soos1 WITH HEADER LINE,
lt_note_text LIKE STANDARD TABLE OF soli WITH HEADER LINE,
lt_attachments LIKE STANDARD TABLE OF sood5 WITH HEADER LINE.
DATA: lt_objcont LIKE STANDARD TABLE OF soli WITH HEADER LINE,
lt_objhead LIKE STANDARD TABLE OF soli WITH HEADER LINE.
DATA: pdf_format LIKE STANDARD TABLE OF tline WITH HEADER LINE.
TYPES: BEGIN OF y_files,
file(60) TYPE c,
END OF y_files.
DATA: lt_files TYPE STANDARD TABLE OF y_files WITH HEADER LINE.
DATA: l_objcont LIKE soli OCCURS 0 WITH HEADER LINE.
DATA: l_objhead LIKE soli OCCURS 0 WITH HEADER LINE.
STRUCTURES
DATA: folder_id LIKE soodk,
object_id LIKE soodk,
link_folder_id LIKE soodk,
g_document LIKE sood4,
g_header_data LIKE sood2,
g_folmem_data LIKE sofm2,
g_header_data LIKE sood2,
g_receive_data LIKE soos6,
g_ref_document LIKE sood4,
g_new_parent LIKE soodk,
l_folder_id LIKE sofdk,
v_email(50).
DATA: hd_dat like sood1.
VARIABLES
DATA: client LIKE tst01-dclient,
name LIKE tst01-dname,
objtype LIKE rststype-type,
type LIKE rststype-type.
DATA: numbytes TYPE i,
arc_idx LIKE toa_dara,
pdfspoolid LIKE tsp01-rqident,
jobname LIKE tbtcjob-jobname,
jobcount LIKE tbtcjob-jobcount,
is_otf.
DATA: outbox_flag LIKE sonv-flag VALUE 'X',
store_flag LIKE sonv-flag,
delete_flag LIKE sonv-flag,
owner LIKE soud-usrnam,
on LIKE sonv-flag VALUE 'X',
sent_to_all LIKE sonv-flag,
g_authority LIKE sofa-usracc,
w_objdes LIKE sood4-objdes.
DATA: c_file LIKE rlgrap-filename,
n_spool(6) TYPE n.
DATA: cancel.
DATA: desired_type LIKE sood-objtp,
real_type LIKE sood-objtp,
attach_type LIKE sood-objtp,
otf LIKE sood-objtp VALUE 'OTF', " SAPscript Ausgabeformat
ali LIKE sood-objtp VALUE 'ALI'. " ABAP lists
CONSTANTS
CONSTANTS: ou_fol LIKE sofh-folrg VALUE 'O',
c_objtp LIKE g_document-objtp VALUE 'RAW',
c_file_ext LIKE g_document-file_ext VALUE 'TXT'.
=================================================================================
z_send_email_fax2
FUNCTION z_faian_mail_fax2.
""Interface local:
*" IMPORTING
*" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
*" REFERENCE(FAX_MAIL_NUMBER) TYPE SO_NAME
*" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
*" REFERENCE(OBJECT_TYPE) TYPE SO_ESCAPE
*" TABLES
*" LT_BODY_EMAIL STRUCTURE SOLI
*" EXCEPTIONS
*" ERR_NO_ABAP_SPOOLJOB
Fist part: Verify if the spool really exists
SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
IF sy-subrc NE 0.
RAISE err_no_abap_spooljob. "doesn't exist
ELSE.
client = tsp01-rqclient.
name = tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
IF objtype(3) = 'OTF'.
desired_type = otf.
ELSE.
desired_type = ali.
ENDIF.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = src_spoolid
desired_type = desired_type
IMPORTING
real_type = real_type
TABLES
buffer = l_objcont
EXCEPTIONS
no_such_job = 14
type_no_match = 94
job_contains_no_data = 54
no_permission = 21
can_not_access = 21
read_error = 54.
IF sy-subrc EQ 0.
attach_type = real_type.
ENDIF.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
owner = sy-uname
region = ou_fol
IMPORTING
folder_id = l_folder_id
EXCEPTIONS
OTHERS = 5.
fill out informations about the header of the email
CLEAR: g_document.
g_document-foltp = l_folder_id-foltp.
g_document-folyr = l_folder_id-folyr.
g_document-folno = l_folder_id-folno.
g_document-objtp = c_objtp.
g_document-objdes = header_mail.
g_document-file_ext = c_file_ext.
g_header_data-objdes = header_mail.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = 'SAVE'
office_user = sy-uname
IMPORTING
authority = g_authority
TABLES
objcont = lt_body_email
attachments = lt_attachments
CHANGING
document = g_document
header_data = g_header_data
EXCEPTIONS
OTHERS = 1.
folder_id-objtp = l_folder_id-foltp.
folder_id-objyr = l_folder_id-folyr.
folder_id-objno = l_folder_id-folno.
object_id-objtp = c_objtp.
object_id-objyr = g_document-objyr.
object_id-objno = g_document-objno.
link_folder_id-objtp = l_folder_id-foltp.
link_folder_id-objyr = l_folder_id-folyr.
link_folder_id-objno = l_folder_id-folno.
REFRESH lt_rec_tab.
CLEAR lt_rec_tab.
lt_rec_tab-sel = 'X'.
lt_rec_tab-recesc = object_type. "This field for FAX/MAIL
lt_rec_tab-recnam = 'U-'.
lt_rec_tab-deliver = 'X'.
lt_rec_tab-not_deli = 'X'.
lt_rec_tab-read = 'X'.
lt_rec_tab-mailstatus = 'E'.
lt_rec_tab-adr_name = fax_mail_number.
lt_rec_tab-sortfield = fax_mail_number.
lt_rec_tab-recextnam = fax_mail_number.
lt_rec_tab-sortclass = '5'.
APPEND lt_rec_tab.
lt_rec_tab-recextnam = fax_mail_number.
lt_rec_tab-recesc = object_type.
lt_rec_tab-sndart = 'INT'.
lt_rec_tab-sndpri = 1.
APPEND lt_rec_tab.
lt_files-file = c_file.
APPEND lt_files.
begin of insertion by faianf01
hd_dat-objdes = header_mail.
CALL FUNCTION 'SO_ATTACHMENT_INSERT'
EXPORTING
object_id = object_id
attach_type = attach_type
object_hd_change = hd_dat
owner = sy-uname
TABLES
objcont = l_objcont
objhead = l_objhead
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
object_type_not_exist = 17
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
x_error = 1000.
IF sy-subrc > 0.
ENDIF.
end of insertion by faianf01
send email from SAPOFFICE
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
folder_id = folder_id
object_id = object_id
outbox_flag = outbox_flag
link_folder_id = link_folder_id
owner = sy-uname
check_send_authority = 'X'
TABLES
receivers = lt_rec_tab
note_text = lt_note_text
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
component_not_available = 1
folder_no_authorization = 5
folder_not_exist = 6
forwarder_not_exist = 8
object_no_authorization = 13
object_not_exist = 14
object_not_sent = 15
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
too_much_receivers = 73
user_not_exist = 35.
ENDIF.
ENDFUNCTION.
=================================================================================
z_send_email_fax
FUNCTION ZCBFS_SEND_MAIL.
""Interface local:
*" IMPORTING
*" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
*" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
*" TABLES
*" LIST_FAX_MAIL_NUMBER STRUCTURE SOLI
*" EXCEPTIONS
*" ERR_NO_ABAP_SPOOLJOB
DATA: vg_achou(1) TYPE n.
Fist part: Verify if the spool really exists
vg_achou = 1.
DO 60 TIMES.
SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
IF sy-subrc IS INITIAL.
CLEAR vg_achou.
EXIT.
ELSE.
WAIT UP TO 1 SECONDS.
ENDIF.
ENDDO.
IF vg_achou = 1.
RAISE err_no_abap_spooljob. "doesn't exist
ENDIF.
client = tsp01-rqclient.
name = tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
IF objtype(3) = 'OTF'.
desired_type = otf.
ELSE.
desired_type = ali.
ENDIF.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = src_spoolid
desired_type = desired_type
IMPORTING
real_type = real_type
TABLES
buffer = l_objcont
EXCEPTIONS
no_such_job = 14
type_no_match = 94
job_contains_no_data = 54
no_permission = 21
can_not_access = 21
read_error = 54.
IF sy-subrc EQ 0.
attach_type = real_type.
ENDIF.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
owner = sy-uname
region = ou_fol
IMPORTING
folder_id = l_folder_id
EXCEPTIONS
OTHERS = 5.
fill out informations about the header of the email
CLEAR: g_document.
g_document-foltp = l_folder_id-foltp.
g_document-folyr = l_folder_id-folyr.
g_document-folno = l_folder_id-folno.
g_document-objtp = c_objtp.
g_document-objdes = header_mail.
g_document-file_ext = c_file_ext.
g_header_data-objdes = header_mail.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = 'SAVE'
office_user = sy-uname
IMPORTING
authority = g_authority
TABLES
attachments = lt_attachments
CHANGING
document = g_document
header_data = g_header_data
EXCEPTIONS
OTHERS = 1.
folder_id-objtp = l_folder_id-foltp.
folder_id-objyr = l_folder_id-folyr.
folder_id-objno = l_folder_id-folno.
object_id-objtp = c_objtp.
object_id-objyr = g_document-objyr.
object_id-objno = g_document-objno.
link_folder_id-objtp = l_folder_id-foltp.
link_folder_id-objyr = l_folder_id-folyr.
link_folder_id-objno = l_folder_id-folno.
REFRESH lt_rec_tab.
LOOP AT LIST_FAX_MAIL_NUMBER.
lt_rec_tab-recextnam = LIST_FAX_MAIL_NUMBER-LINE.
lt_rec_tab-recesc = 'U'.
lt_rec_tab-sndart = 'INT'.
lt_rec_tab-sndpri = 1.
APPEND lt_rec_tab.
ENDLOOP.
lt_files-file = c_file.
APPEND lt_files.
hd_dat-objdes = header_mail.
CALL FUNCTION 'SO_ATTACHMENT_INSERT'
EXPORTING
object_id = object_id
attach_type = attach_type
object_hd_change = hd_dat
owner = sy-uname
TABLES
objcont = l_objcont
objhead = l_objhead
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
object_type_not_exist = 17
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
x_error = 1000.
IF sy-subrc > 0.
ENDIF.
send email from SAPOFFICE
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
folder_id = folder_id
object_id = object_id
outbox_flag = outbox_flag
link_folder_id = link_folder_id
owner = sy-uname
TABLES
receivers = lt_rec_tab
note_text = lt_note_text
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
component_not_available = 1
folder_no_authorization = 5
folder_not_exist = 6
forwarder_not_exist = 8
object_no_authorization = 13
object_not_exist = 14
object_not_sent = 15
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
too_much_receivers = 73
user_not_exist = 35.
ENDFUNCTION.
Regards,
Santosh -
Seek help to format spool file from SQL*PLUS
I am running a Unix shell script to call a Oracle 11g SQL script from a Oracle database. In this SQL script, I need to connect to many different remote databases to select data, then sool these records as one big text file to a directory. Then email the file to related Group users. In the spool file, there is a line on the top of each page like this:
DUMMY
DB_NAME
I know this is caused by connect to remote database in SQL*PLUS. My connection string is like this:
Conn system/password@Oracle_SID
How can I remove these lines or how to skip these lines into spool file? Please advise. Thanks in advnce. Wish all of you Happy New Year!!!Hi,
It sounds like you have some kind of formatting (such as SQL*Plus TTITLE) producing the output you don't want. If that's the case, temporarily stopping the spooling might not help you. Find out what is causing the output that you don't want. You say that you know it is caused by the CONNECT statements, but it must be more than that. I've written scripts with CONNECT statements that don't have anything like what you reported at the top of each page; in fact, they don't even have pages: the output is one continuous stream. Find out what's putting the unwanted output there, and that will be a big clue as to how you can stop it.
You say that you know the unwanted titles are there because of the CONNECT statements. If so, use database links instead of CONNECT. You don't have to use dbms_scheduler or utl_file; just eliminate the CONNECT statements. (I'm not saying that there's anything wrong with dbms_scheduler or utl_file; you should definitely investigate those tools. I'm just saying that using database links is independent of them.)
What would happen if you did all your connecting to different databases at the OS level? Can you write a shell script that connects to each database in turn, and runs a SQL*Plus script in each one. Each SQL*Plus script would have a SPOOL or SPOOL ... APPEND command, or maybe you could build the SPOOL into a LOGIN.SQL script. -
How create spool file with current date and time?
I want to create spool file like xyz_28062010.
Please, suggest.like:
In SQL*Plus this is what you can do to get the current date/time as part of the spool file:
============================================================================================
SQL> column tm new_value file_time noprint
SQL> select to_char(sysdate, 'YYYYMMDD') tm from dual ;
1 row selected.
SQL> prompt &file_time
20020816
SQL> spool C:\Temp\logfile_id&file_time..log Reference: Creating a spool file with date/time appended to file name
Edited by: Gj on Jun 28, 2010 11:45 AM -
Spool file problem,Can't see the query in output file.
Hello ,
I am facing a very old school kind of problem .....about spool file ....
The scenario -
I have made a script by name DB_Status_checkup.sql which i want to fire on the database to check the database status. In this script their are many queries regarding the data dictionary views to know about the database. It consist of nearly 25-30 different select queries..
The problem is i want to make a spool file of the output of that query....i want to see the SQL query & the output below in the spool file, so it will be easy for me to judge the result. But i can't see the SQL query , i can only see the output , & in so many queries it all gets jumbled up....even i can't understand where the next output starts ...
Sample of my SQL Script ....
clear buffer
spool D:\DB_status.txt
/*To check the database startup time*/
Select to_char(startup_time, 'HH24:MI DD-MON-YY') "Startup time"
from v$instance
.........next query n so on....
spool off;
In the output pf the spool file at D:\db_status.txt..
Startup time
08:25 16-JUL-10It shows only the output of the query in the spool file not the query,
What should i do to get the SQL query as well as the output of that query just below it in the spool file ???
Please suggest if you have anymore ideas , regarding this .....
ORACLE 10g R2
Windows Server 2008
Thanks in advance ...Why don't you just use database control, instead of re-inventing the wheel?
Apart from that, SQL*Plus has it's own reference manual, which you apparently refuse to read.
The answer to your quiz/doc question is
set echo on
Sybrand Bakker
Senior Oracle DBA -
Dunning letters as individual/separate spool file
Hi All,
I've found that dunning run by F150 in my company sometimes gives an output results as separate spool file for every customer what is unexpected. Usually we get one common spool with multiple pages. I would appreciate it somebody can give me the clue what is the reason. I couldn't find any system and transaction settings... Thanks in advance.
GregHi,
see the link below :
http://web.mit.edu/CAO/www/SB2002/AR/F150.htm
SKS -
Spool file error - Buffer Overflow
I've a sql script that is running from a.sql file. The script fetches almost 9 million data as a result of the query. Main problem is related to spool file generation. It is saying buffer overflow. But, when i write that query from sql prompts it is running within 2 mins and completes the task within 15 mins.
I've written -
set serveroutput on size ######
But, still it is not working. Total application is freeze whenever i want to run it. Tell me any suggestion if u have.
Satyaki.i guess what you are more concerned with is the output produced by your query (the spool file).
you need not to see what is displayed on the screen all you need is open up the spool file to
check for those data in there.
to suppress the output from the screen and still generates spool file. use the SET TERMOUT option.
e.g.
-- code for a producing a sample spool file
spool r:\sample_spool.txt;
select * from emp;
spool off;
at the SQL*Plus command line:
SQL> @r:\sample_spool.sql;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7566 JONES MANAGER 7839 02-APR-81 2975 1000 20
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7788 SCOTT ANALYST 7566 09-DEC-82 3000 20
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 12-JAN-83 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected.
SQL> -- the above example displays the output on the screen
SQL> -- now we want to turn it off by using the SET TERMOUT option
SQL> SQL> set termout off;
SQL> @r:\sample_spool.sql;
SQL>
after executing the script sample_spool.sql it does not display output from the screen which
we want to avoid the buffer overflow error. and still produce the spool file:
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7566 JONES MANAGER 7839 02-APR-81 2975 1000 20
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7788 SCOTT ANALYST 7566 09-DEC-82 3000 20
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 12-JAN-83 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected. -
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 -
How to get the number of rows written to the header of the spool file.
Hi
I need to create a header line for the spool file .
the header line should include fixed length values .
The header should include the number of records found in the table with a maximum begin date (begin_date is the column of the table)
To get the header in the spool file , i wrote a select query has :-
--SPOOL 'C:\Documents and Settings\abc\Desktop\output.TXT'
select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000') ||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) ||
rpad(' ',76,' ')
from dad.school
group by sysdate;
SPOOL OFF
which gets me all the rows in the table , but i only want the rows with the latest school_begin_date .
how can i achieve that ...
I know that a subquery should be written in the from clause to get the number of rows found with a maximum school_begin_date.
select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000') ||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) ||
rpad(' ',76,' ')
from dad.school where
select rownum from dad.school
where school_begin_date = max(school_begin_date) ;
the error i get is
ORA-00934: group function is not allowed here
I NEED HELP ..IN GETTING THE ROWNUM JUST FOR THE LATEST BEGIN_DATE ?
PLS HELP ME IN WRITING THE QUERY .
THANKS IN ADVANCE .Try this:
select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000')||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) || rpad(' ',76,' ')
from dad.school
where school_begin_date = (select max(school_begin_date)
from dad.school); -
Decrease print spool file size generated by PS CS5 Mac OS 10.6.8?
Hi,
Certain big/hi-res Photoshop (CS5) documents - sent from a 2010 era Intel Mac to an older HP 1200dpi Laserjet (LJ 2100M/HPs PostScript, standard HP/Apple drivers) - were taking forever to print.
In one case, for example, a 6MB on disk, Grayscale 8 bit, 109MB/40MB "doc size" .psd, when printed from Photoshop, generated a 135833k spool file.
The same .psd opened with and printed from Preview, only a 3229k spool file - which printed out in a short time.
Am I missing something?
Thanks for any comments or suggestions.The plug-in is there but no twain interface for the scanner appears as an option under file import in PS
you answered your own question -- Adobe will point the finger at Epson, and Epson will call Adobe out for breaking their driver -- but the 1250 is how old
this question gets answered here a couple times a month, and there are many web articles explaining the problem in more detail...
the short answer is scan in the stand alone scanning software (ViewScan may solve your issue)
most notably, that approach keeps Ps running in 64 bit and keeps it freed up to continue working while that ancient scanner chugs away
PS: I am not trying to beat you up for using good hardware that is still working for you, I am just trying to add a second opinion what others have said -
Can I download a spool file from ALV payroll recon report in Fixed Ascii?
We have a process that imports the spool files from our various nightly payroll recon reports but have recently upgraded to ECC 6.0 and the ALV formatted report does not appear to create a fixed format spool file - the width of the columns changes from spool to spool based on the contents.
Does anyone know how to accomplish our need?
Thanks,
DeWayneDoes the printer show up in the Windows Printers folder? We've used PDF995 or Cute pdfwriter for years. All of these create virtual windows printers. When you print to them, a dialog box pops up asking for the filename for the pdf. If you have Activex calls to Excel in order to open a file, you should be able to make ActiveX calls to print it to a print driver such as this. I don't know if any of these drives have a way to bypass the filename dialog box. That may take some research and experimentation. I don't know where the postscript file comes into play in the scenario you are describing.
Maybe you are looking for
-
Question about controlling both handles or one at a time
I am using a trial version of Illustrator CS5 on Windows 7. I know how to select an anchor or its handle(s). But I do not know why I sometimes am controlling both of an anchors handles when I move one of them, or when I am moving only one at a time.
-
Photoshop Elements 9: cannot install, files are damaged [Windows 8.1]
I tried it with both downloading the two files from Download Photoshop Elements products | 9, 8, 7 and Photoshop Elements 9 / Premiere Elements 9 Direct Download Links | ProDesignTools, neither installation worked. When trying to install with the sep
-
Can't be able to connect mobile and the servlet ?(Urgent)
hi to all java Gurus.. I need ur help .. My problem is that I am not be able to connect my mobile Nokia N70 to the servlet and when I am trying with Emulator its working fine but having problem only with physical device. On that I have to connect to
-
Hi, Now I'm in trouble. I was working last year with a MacBookPro and FCPX. Everything nice and well. I dediced to upgrade to MacPro, so I did a "backup" of all my Events and Projects folders of the MacBook Pro, and waited for the MacPro arrival... N
-
I'm using a formula node on Labview PDA and i have problem regarding multiplying double variable. If I multiply integer number (as double) everithing is OK. example 45*2 the results is 90.0 If I multiply 2 fractional number the solution is wrong: exa