How to script output to email
hi,
Can anyone give me information or documentation on
"SENDING SCRIPT OUTPUT TO EMAIL"??
if possible plz send the code also.
waiting for your replies
bye
ARJUN
Hi,
Could you please expalain , is it ABAP Scripts?, or any other if other ,what is the format??
If ABAP script
http://help.sap.com/saphelp_nw2004s/helpdata/en/0e/56373f7853494fe10000000a114084/content.htm
Sending SAP SCRIPT to mail
sending sap script to mail id
Problem Sending SAP Script as a PDF attachment to external mail
Sending SAP Script Output to Mail & Fax
sending a script in mail (outside SAP)
How To send SAP SCRIPT AS an email.
Regards
Chilla
Similar Messages
-
Reg : Sending Script output to email
Hi,
I need to send script output to email.I have written the code for this functionality.
Functional guy has created output type ,but that output type is red in clor and when I click process log " it says Parameter DEVICE= is invalid "
Is there anything to be done from abap point for this error.
Actually I used these 2 fun.modules
DATA: LVF_DEVICE LIKE ITCPP-TDDEVICE.
DATA: LVS_ITCPO TYPE ITCPO,
LVF_DIALOG(1) TYPE C VALUE ' ',
LVS_RECIPIENT LIKE SWOTOBJID,
LVS_SENDER LIKE SWOTOBJID,
LVS_SNAST TYPE SNAST,
LVF_PROGRAM LIKE SY-REPID,
LVS_COMM_TYPE TYPE AD_COMM,
LVS_COMM_VALUES TYPE SZADR_COMM_VALUES.
DATA:
W_DEPT LIKE KNVK-ABTNR, "Department
W_PRSNR LIKE KNVK-PRSNR. "Person number
reset return code
RETCODE = 0.
IF NOT NAST-TCODE IS INITIAL AND NAST-NACHA EQ '5'.
SELECT SINGLE * FROM USR21 WHERE BNAME = SY-UNAME.
CALL FUNCTION 'ADDR_GET_NEXT_COMM_TYPE'
EXPORTING
strategy = nast-tcode
address_number = Kna1-adrnr
IMPORTING
comm_type = lvs_comm_type
comm_values = lvs_comm_values
TABLES
STRATEGY_TABLE =
EXCEPTIONS
address_not_exist = 1
person_not_exist = 2
no_comm_type_found = 3
internal_error = 4
parameter_error = 5
OTHERS = 6.
convert communication data
Always INT
LVS_COMM_TYPE = 'INT'.
clear LVS_COMM_VALUES-ADSMTP-SMTP_ADDR.
Get Contact persons number from KNVK
SELECT SINGLE * FROM KNVK WHERE KUNNR EQ NAST-PARNR
AND ABTNR EQ W_DEPT.
Get it from ADR6 table always
Select single * from adr6 where addrnumber = kna1-adrnr
AND PERSNUMBER = KNVK-PRSNR.
IF SY-SUBRC EQ 0 AND adr6-Smtp_addr NE ' '.
LVS_COMM_VALUES-ADSMTP-SMTP_ADDR = adr6-Smtp_addr.
ENDIF.
ENDIF.
MOVE-CORRESPONDING nast TO LVS_SNAST .
MOVE sy-repid TO LVF_PROGRAM.
CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'
EXPORTING
pi_comm_type = lvs_comm_type
pi_comm_values = lvs_comm_values
pi_country = kna1-land1
pi_repid = LVF_PROGRAM
pi_snast = LVS_SNAST
IMPORTING
pe_itcpo = lvs_itcpo
pe_device = lvf_device
pe_mail_recipient = lvs_recipient
pe_mail_sender = lvs_sender
EXCEPTIONS
comm_type_not_supported = 1
recipient_creation_failed = 2
sender_creation_failed = 3
OTHERS = 4.
fill structure itcpo
ITCPO = LVS_ITCPO.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX = TOA_DARA
ARCHIVE_PARAMS = ARC_PARAMS
DEVICE = LVF_DEVICE
DIALOG = ' '
FORM = TNAPR-FONAM
LANGUAGE = NAST-SPRAS
OPTIONS = LVS_ITCPO
MAIL_SENDER = LVS_SENDER
MAIL_RECIPIENT = LVS_RECIPIENT
MAIL_APPL_OBJECT = ' '
RAW_DATA_INTERFACE = '*'
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
OTHERS = 8.
IF SY-SUBRC NE 0.
CASE SY-SUBRC.
WHEN 7.
RETCODE = SY-SUBRC.
SYST-MSGID = 'VN'.
SYST-MSGNO = '096'.
SYST-MSGTY = 'E'.
SYST-MSGV1 = NAST-KSCHL.
SYST-MSGV2 = NAST-KAPPL.
PERFORM PROTOCOL_UPDATE.
WHEN OTHERS.
RETCODE = SY-SUBRC.
PERFORM PROTOCOL_UPDATE.
ENDCASE.
ENDIF.
and one more query is :
I want to know weather
"Are there any settings need to be done by BASIS people."
If Anyone has any idea plz reply.Hi
Use the below peace of code,I was used to send sales order confirmation script output as email.
Change History
Programmer Date Change Request Description
FKHURRAM 9/16/02 DU1K920151 Upgrade changes.
Use ADRC for Address Data
Print of an order confirmation by SAPscript
REPORT rvador01 LINE-COUNT 100 MESSAGE-ID vn.
TABLES: komk, "Communicationarea for conditions
komp, "Communicationarea for conditions
komvd, "Communicationarea for conditions
vbco3, "Communicationarea for view
vbdka, "Headerview
vbdpa, "Itemview
vbdpau, "Subitemnumbers
conf_out, "Configuration data
sadr, "Addresses
tvag, "Reason for rejection
vedka, "Servicecontract head data
vedpa, "Servicecontract position data
vedkn, "Servicecontract head notice data
vedpn, "Servicecontract pos. notice data
vbpa, "Sales Document: Partner
kna1, "General Data in Customer Master
riserls, "Serialnumbers
komser, "Serialnumbers for print
tvbur, "Sales office
tvko, "Sales organisation
adrs, "Communicationarea for Address
fpltdr. "billing schedules
INCLUDE yzrvadtabl.
*INCLUDE RVADTABL.
INCLUDE yzrvdirekt.
*INCLUDE RVDIREKT.
INCLUDE yzvedadata.
*INCLUDE VEDADATA.
DATA: retcode LIKE sy-subrc. "Returncode
DATA: repeat(1) TYPE c.
DATA: xscreen(1) TYPE c. "Output on printer or screen
DATA: BEGIN OF steu, "Controldata for output
vdkex(1) TYPE c,
vdpex(1) TYPE c,
kbkex(1) TYPE c,
kbpex(1) TYPE c,
END OF steu.
DATA: BEGIN OF tvbdpa OCCURS 0. "Internal table for items
INCLUDE STRUCTURE vbdpa.
DATA: END OF tvbdpa.
DATA: BEGIN OF tkomv OCCURS 50.
INCLUDE STRUCTURE komv.
DATA: END OF tkomv.
DATA: BEGIN OF tkomvd OCCURS 50.
INCLUDE STRUCTURE komvd.
DATA: END OF tkomvd.
DATA: BEGIN OF tvbdpau OCCURS 5.
INCLUDE STRUCTURE vbdpau.
DATA: END OF tvbdpau.
DATA: BEGIN OF tkomcon OCCURS 50.
INCLUDE STRUCTURE conf_out.
DATA: END OF tkomcon.
DATA: BEGIN OF tkomservh OCCURS 1.
INCLUDE STRUCTURE vedka.
DATA: END OF tkomservh.
DATA: BEGIN OF tkomservp OCCURS 5.
INCLUDE STRUCTURE vedpa.
DATA: END OF tkomservp.
DATA: BEGIN OF tkomservhn OCCURS 5.
INCLUDE STRUCTURE vedkn.
DATA: END OF tkomservhn.
DATA: BEGIN OF tkomservpn OCCURS 5.
INCLUDE STRUCTURE vedpn.
DATA: END OF tkomservpn.
DATA: BEGIN OF tkomser OCCURS 5.
INCLUDE STRUCTURE riserls.
DATA: END OF tkomser.
DATA: BEGIN OF tkomser_print OCCURS 5.
INCLUDE STRUCTURE komser.
DATA: END OF tkomser_print.
DATA: BEGIN OF tfpltdr OCCURS 5.
INCLUDE STRUCTURE fpltdr.
DATA: END OF tfpltdr.
DATA: pr_kappl(01) TYPE c VALUE 'V'. "Application for pricing
DATA: BEGIN OF char_val OCCURS 0,
atnam LIKE cabn-atnam,
atwrt LIKE ausp-atwrt,
END OF char_val.
FORM entry USING return_code us_screen.
CLEAR retcode.
xscreen = us_screen.
PERFORM processing.
IF retcode NE 0.
return_code = 1.
ELSE.
return_code = 0.
ENDIF.
ENDFORM. "ENTRY
FORM PROCESSING *
FORM processing.
PERFORM get_data.
CHECK retcode = 0.
PERFORM form_open USING xscreen vbdka-land1.
CHECK retcode = 0.
PERFORM logo_selection.
PERFORM form_title_print.
CHECK retcode = 0.
PERFORM write_header_info.
PERFORM validity_print.
CHECK retcode = 0.
PERFORM header_data_print.
CHECK retcode = 0.
PERFORM header_serv_print.
CHECK retcode = 0.
PERFORM header_notice_print.
CHECK retcode = 0.
PERFORM header_inter_print.
CHECK retcode = 0.
PERFORM header_text_print.
CHECK retcode = 0.
PERFORM item_print.
CHECK retcode = 0.
PERFORM end_print.
CHECK retcode = 0.
PERFORM form_close.
CHECK retcode = 0.
*********************changes on 12/04/2007****************
TABLES: tsp01.
TYPES: BEGIN OF t_spool,
rqident TYPE tsp01-rqident,
END OF t_spool.
DATA: i_spool TYPE STANDARD TABLE OF t_spool,
wa_spool TYPE t_spool.
SELECT rqident FROM tsp01
INTO TABLE i_spool
WHERE rqowner = sy-uname.
SORT i_spool DESCENDING BY rqident.
LOOP AT i_spool INTO wa_spool.
ENDLOOP.
data: l_rqident type tsp01-rqident.
SELECT SINGLE rqident FROM tsp01 INTO l_rqident
WHERE rqowner = sy-uname.
DATA: l_spoolno LIKE tsp01-rqident VALUE '0000024884'.
TYPES: l_ty_tab_pdf TYPE tline OCCURS 0.
DATA: l_pdf TYPE l_ty_tab_pdf,
l_spool TYPE tsp01-rqident.
Type for binary attachment table.
TYPES: l_ty_tab_objbin TYPE solisti1 OCCURS 0.
DATA: l_objbin TYPE l_ty_tab_objbin.
l_spool = l_spoolno.
l_spool = l_rqident.
l_spool = wa_spool-rqident.
**/ Call the standard function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF' "#EC ARGCHECKED
EXPORTING
src_spoolid = l_spool
no_dialog = ' '
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
LIST_PAGECOUNT =
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = l_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.
WRITE: / 'error', sy-subrc.
ENDIF.
**/ Convert the PDF format to the table type required for the
*attachment.
CALL FUNCTION 'QCE1_CONVERT'
TABLES
t_source_tab = l_pdf
t_target_tab = l_objbin
EXCEPTIONS
convert_not_possible = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE: / 'error', sy-subrc.
ENDIF.
TABLES : soli.
TABLES : zpsdsalrep.
DATA: v_email TYPE soli-line.
DATA: v_email1 TYPE soli-line.
DATA: l_adrnr LIKE kna1-adrnr.
DATA: l_objky TYPE nast-objky.
DATA: l_zzterrmg TYPE zpsdsalrep-zzterrmg.
DATA: l_zsupervisor TYPE zpsdsalrep-zsupervisor.
DATA: l_kunnr TYPE kna1-kunnr.
DATA: l_kunnr1 TYPE vbak-kunnr.
SELECT SINGLE kunnr FROM vbak INTO l_kunnr1
WHERE vbeln = nast-objky.
SELECT SINGLE adrnr FROM kna1 INTO l_adrnr
WHERE kunnr = l_kunnr1.
CHECK sy-subrc IS INITIAL.
SELECT SINGLE smtp_addr FROM adr6 INTO v_email
WHERE addrnumber = l_adrnr.
SELECT SINGLE zzterrmg FROM zpsdsalrep INTO l_zzterrmg
WHERE zzsalesrep = l_kunnr1.
SELECT SINGLE zsupervisor FROM zpsdsalrep INTO l_zsupervisor
WHERE zzterrmg = l_zzterrmg.
SELECT SINGLE kunnr FROM kna1 INTO l_kunnr
WHERE sortl = l_zsupervisor.
SELECT SINGLE adrnr FROM kna1 INTO l_adrnr
WHERE kunnr = l_kunnr.
CHECK sy-subrc IS INITIAL.
SELECT SINGLE smtp_addr FROM adr6 INTO v_email1
WHERE addrnumber = l_adrnr.
DATA: l_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
DATA: l_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: l_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
DATA: l_doc_chng LIKE sodocchgi1.
DATA: l_objhead LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: l_tab_lines LIKE sy-tabix.
CONSTANTS: k_true TYPE boolean_flg VALUE 'X'.
DATA: l_mail TYPE somlreci1-receiver.
DATA: l_mail1 TYPE somlreci1-receiver.
DATA: k_mail2 TYPE somlreci1-receiver.
DATA: k_mail TYPE somlreci1-receiver.
l_mail = v_email.
l_mail1 = v_email1.
k_mail2 = text-006.
k_mail = text-007.
Creation of the document to be sent
File Name
l_doc_chng-obj_name = 'SENDFILE'.
Mail Subject
l_doc_chng-obj_descr = text-001.
Completing the recipient list
l_reclist-receiver = l_mail.
l_reclist-rec_type = 'U'.
APPEND l_reclist.
l_reclist-receiver = l_mail1.
l_reclist-rec_type = 'U'.
APPEND l_reclist.
l_reclist-receiver = k_mail.
l_reclist-rec_type = 'U'.
APPEND l_reclist.
l_reclist-receiver = k_mail2.
l_reclist-rec_type = 'U'.
APPEND l_reclist.
Mail Contents
l_objtxt = text-002.
APPEND l_objtxt.
CLEAR l_objtxt. " put in a blank line
APPEND l_objtxt.
l_objtxt = text-003.
APPEND l_objtxt.
l_objtxt = text-004 .
APPEND l_objtxt.
Calculate email size in bytes
DESCRIBE TABLE l_objtxt LINES l_tab_lines.
READ TABLE l_objtxt INDEX l_tab_lines.
l_doc_chng-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( l_objtxt ).
Creation of the entry for the compressed document
for the email text
CLEAR l_objpack-transf_bin.
l_objpack-head_start = 1.
l_objpack-head_num = 0.
l_objpack-body_start = 1.
l_objpack-body_num = l_tab_lines.
l_objpack-doc_type = 'RAW'.
APPEND l_objpack.
Creation of the document attachment
(Assume that the data in OBJBIN is in BMP format)
DESCRIBE TABLE l_objbin LINES l_tab_lines.
l_objhead = text-001 .
APPEND l_objhead.
CLEAR l_objpack.
**/ Creation of the entry for the compressed/attached document
l_objpack-transf_bin = k_true.
l_objpack-head_start = 1.
l_objpack-head_num = 1.
l_objpack-body_start = 1.
l_objpack-body_num = l_tab_lines.
l_objpack-doc_type = 'PDF'.
l_objpack-obj_name = text-005.
l_objpack-obj_descr = text-001.
l_objpack-doc_size = l_tab_lines * 255.
APPEND l_objpack. "/ .
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1' "/ .
EXPORTING
document_data = l_doc_chng
put_in_outbox = 'X'
TABLES
packing_list = l_objpack
object_header = l_objhead
contents_bin = l_objbin
contents_txt = l_objtxt
receivers = l_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
IF sy-subrc <> 0.
WRITE: / 'unsuccessful', sy-subrc.
ELSE.
WRITE: / 'successful'.
ENDIF.
**/Take_note it is a requirement to do a commit work for the
email to go into transaction SOST.
COMMIT WORK. "/Take_note .
ENDFORM. "PROCESSING
S U B R O U T I N E S *
FORM ALTERNATIVE_ITEM *
A text is printed, if the item is an alternative item. *
FORM alternative_item.
CHECK vbdpa-grpos CN '0'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ALTERNATIVE_ITEM'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDFORM. "ALTERNATIVE_ITEM
FORM CHECK_REPEAT *
A text is printed, if it is a repeat print for the document. *
FORM check_repeat.
CLEAR repeat.
SELECT * INTO *nast FROM nast WHERE kappl = nast-kappl
AND objky = nast-objky
AND kschl = nast-kschl
AND spras = nast-spras
AND parnr = nast-parnr
AND parvw = nast-parvw
AND nacha BETWEEN '1' AND '4'.
CHECK *nast-vstat = '1'.
repeat = 'X'.
EXIT.
ENDSELECT.
ENDFORM. "CHECK_REPEAT
FORM DELIVERY_DATE *
If the delivery date in the item is different to the header *
date and there are no scheduled quantities, the delivery date *
is printed in the item block. *
FORM delivery_date.
IF vbdka-lfdat = space AND
vbdpa-lfdat NE space AND
vbdpa-etenr_da = space.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_DELIVERY_DATE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ENDFORM. "DELIVERY_DATE
FORM DIFFERENT_CONSIGNEE *
If the consignee in the item is different to the header con- *
signee, it is printed by this routine. *
FORM different_consignee.
CHECK vbdka-name1_we NE vbdpa-name1_we
OR vbdka-name2_we NE vbdpa-name2_we
OR vbdka-name3_we NE vbdpa-name3_we
OR vbdka-name4_we NE vbdpa-name4_we.
CHECK vbdpa-name1_we NE space
OR vbdpa-name2_we NE space
OR vbdpa-name3_we NE space
OR vbdpa-name4_we NE space.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_CONSIGNEE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDFORM. "DIFFERENT_CONSIGNEE
FORM DIFFERENT_REFERENCE_NO *
If the reference number in the item is different to the header*
reference number, it is printed by this routine. *
FORM different_reference_no.
CHECK vbdpa-vbeln_vang NE vbdka-vbeln_vang
OR vbdpa-vbtyp_vang NE vbdka-vbtyp_vang.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_REFERENCE_NO'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDFORM. "DIFFERENT_REFERENCE_NO
FORM DIFFERENT_TERMS *
If the terms in the item are different to the header terms, *
they are printed by this routine. *
FORM different_terms.
DATA: us_vposn LIKE vedpa-vposn.
DATA: us_text(1) TYPE c. "Flag for Noticetext was printed
IF vbdpa-zterm NE vbdka-zterm AND
vbdpa-zterm NE space.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_TERMS_OF_PAYMENT'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
IF vbdpa-inco1 NE space.
IF vbdpa-inco1 NE vbdka-inco1 OR
vbdpa-inco2 NE vbdka-inco2.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_TERMS_OF_DELIVERY'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ENDIF.
Print different validity-data for the position
READ TABLE tkomservp WITH KEY vbdpa-posnr.
IF sy-subrc EQ 0.
vedpa = tkomservp.
IF vedpa-vbegdat NE space AND
vedpa-venddat NE space AND
NOT vedpa-vbegdat IS INITIAL AND
NOT vedpa-venddat IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_TERMS_OF_SERV1'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ELSEIF vedpa-vbegdat NE space AND
NOT vedpa-vbegdat IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_TERMS_OF_SERV2'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_TERMS_OF_SERV3'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ENDIF.
Notice-rules for the positions.
MOVE vbdpa-posnr TO us_vposn.
CLEAR us_text.
LOOP AT tkomservpn WHERE vposn = us_vposn.
vedpn = tkomservpn.
IF us_text IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_TERMS_OF_NOTTXT'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
us_text = charx.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_TERMS_OF_NOTICE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDLOOP.
IF NOT us_text IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'EMPTY_LINE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ENDFORM. "DIFFERENT_TERMS
FORM END_PRINT *
FORM end_print.
PERFORM get_header_prices.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
command = 'PROTECT'.
PERFORM header_price_print.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'END_VALUES'.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
command = 'ENDPROTECT'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'SUPPLEMENT_TEXT'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDFORM. "END_PRINT
FORM FORM_CLOSE *
End of printing the form *
FORM form_close.
CALL FUNCTION 'CLOSE_FORM'
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
PERFORM protocol_update.
retcode = 1.
ENDIF.
SET COUNTRY space.
ENDFORM. "FORM_CLOSE
FORM FORM_OPEN *
Start of printing the form *
--> US_SCREEN Output on screen *
' ' = printer *
'X' = screen *
--> US_COUNTRY County for telecommunication and SET COUNTRY *
FORM form_open USING us_screen us_country.
INCLUDE yzrvadopfo.
INCLUDE RVADOPFO.
ENDFORM. "FORM_OPEN
FORM FORM_TITLE_PRINT *
Printing of the form title depending of the field VBTYP *
FORM form_title_print.
CASE vbdka-vbtyp.
WHEN 'A'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_A'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN 'B'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_B'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN 'C'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_C'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN 'E'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_E'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN 'F'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_F'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN 'G'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_F'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN 'H'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_H'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN 'K'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_K'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN 'L'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_L'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN OTHERS.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_OTHERS'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDCASE.
IF repeat NE space.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'REPEAT'
window = 'REPEAT'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ENDFORM. "FORM_TITLE_PRINT
FORM GET_DATA *
General provision of data for the form *
FORM get_data.
DATA: us_veda_vbeln LIKE veda-vbeln.
DATA: us_veda_posnr_low LIKE veda-vposn.
CALL FUNCTION 'RV_PRICE_PRINT_REFRESH'
TABLES
tkomv = tkomv.
CLEAR komk.
CLEAR komp.
vbco3-mandt = sy-mandt.
vbco3-spras = nast-spras.
vbco3-vbeln = nast-objky.
vbco3-kunde = nast-parnr.
vbco3-parvw = nast-parvw.
CALL FUNCTION 'RV_DOCUMENT_PRINT_VIEW'
EXPORTING
comwa = vbco3
IMPORTING
kopf = vbdka
TABLES
pos = tvbdpa.
Fetch servicecontract-data and notice-data for head and position.
us_veda_vbeln = vbdka-vbeln.
us_veda_posnr_low = posnr_low.
CALL FUNCTION 'SD_VEDA_GET_PRINT_DATA'
EXPORTING
i_document_number = us_veda_vbeln
i_language = sy-langu
i_posnr_low = us_veda_posnr_low
TABLES
print_data_pos = tkomservp
print_data_head = tkomservh
print_notice_pos = tkomservpn
print_notice_head = tkomservhn.
PERFORM get_controll_data.
PERFORM sender.
PERFORM check_repeat.
PERFORM tvbdpau_create.
ENDFORM. "GET_DATA
FORM GET_ITEM_BILLING_SCHEDULES *
In this routine the billing schedules are fetched from the *
database. *
FORM get_item_billing_schedules.
REFRESH tfpltdr.
CHECK NOT vbdpa-fplnr IS INITIAL.
CALL FUNCTION 'BILLING_SCHED_PRINTVIEW_READ'
EXPORTING
i_fplnr = vbdpa-fplnr
i_language = nast-spras
TABLES
zfpltdr = tfpltdr.
ENDFORM. "GET_ITEM_BILLING_SCHEDULES
*& Form ITEM_BILLING_SCHEDULES_PRINT
This routine prints the billing shedules of a salesdocument *
position. *
FORM item_billing_schedules_print.
DATA: first_line(1) TYPE c.
first_line = charx.
LOOP AT tfpltdr.
fpltdr = tfpltdr.
Output of the following printlines
IF NOT fpltdr-perio IS INITIAL.
periodische Fakturen
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_BILLING_SCHEDULE_PERIODIC'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
bei periodischen nur eine Zeile
EXIT.
ELSEIF fpltdr-fareg CA '14'.
prozentuale Teilfakturierung
IF NOT first_line IS INITIAL.
CLEAR first_line.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_BILLING_SCHEDULE_PERCENT_HEADER'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_BILLING_SCHEDULE_PERCENT'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ELSEIF fpltdr-fareg CA '235'.
wertmäßige Teilfakturierung
IF NOT first_line IS INITIAL.
CLEAR first_line.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_BILLING_SCHEDULE_VALUE_HEADER'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_BILLING_SCHEDULE_VALUE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ELSEIF fpltdr-fareg CA '3'.
Schlußrechnung
ENDIF.
ENDLOOP.
ENDFORM. "ITEM_BILLING_SCHEDULES_PRINT
*eject
FORM GET_ITEM_CHARACTERISTICS *
In this routine the configuration data item is fetched from *
the database. *
FORM get_item_characteristics.
REFRESH tkomcon.
CHECK NOT vbdpa-cuobj IS INITIAL.
CALL FUNCTION 'CUD0_GET_CONFIGURATION' "#EC EXISTS
EXPORTING
instance = vbdpa-cuobj
language = nast-spras
TABLES
configuration = tkomcon
EXCEPTIONS
OTHERS = 4.
ENDFORM. "GET_ITEM_CHARACTERISTICS
FORM GET_ITEM_PRICES *
In this routine the price data for the item is fetched from *
the database. *
FORM get_item_prices.
CLEAR: komp,
tkomv.
IF komk-knumv NE vbdka-knumv.
CLEAR komk.
komk-mandt = sy-mandt.
komk-kalsm = vbdka-kalsm.
komk-kappl = pr_kappl.
komk-waerk = vbdka-waerk.
komk-knumv = vbdka-knumv.
komk-vbtyp = vbdka-vbtyp.
ENDIF.
komp-kposn = vbdpa-posnr.
CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
EXPORTING
comm_head_i = komk
comm_item_i = komp
language = nast-spras
IMPORTING
comm_head_e = komk
comm_item_e = komp
TABLES
tkomv = tkomv
tkomvd = tkomvd.
ENDFORM. "GET_ITEM_PRICES
FORM GET_HEADER_PRICES *
In this routine the price data for the header is fetched from *
the database. *
FORM get_header_prices.
CALL FUNCTION 'RV_PRICE_PRINT_HEAD'
EXPORTING
comm_head_i = komk
language = nast-spras
IMPORTING
comm_head_e = komk
TABLES
tkomv = tkomv
tkomvd = tkomvd.
ENDFORM. "GET_HEADER_PRICES
*& Form HEADER_DATA_PRINT
Printing of header data like terms, weights .... *
FORM header_data_print.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'HEADER_DATA'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDFORM. " HEADER_DATA_PRINT
FORM HEADER_PRICE_PRINT *
Printout of the header prices *
FORM header_price_print.
LOOP AT tkomvd.
AT FIRST.
IF komk-supos NE 0.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_SUM'.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'UNDER_LINE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ENDAT.
komvd = tkomvd.
IF komvd-koaid = 'D'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TAX_LINE'.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'SUM_LINE'.
ENDIF.
ENDLOOP.
DESCRIBE TABLE tkomvd LINES sy-tfill.
IF sy-tfill = 0.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'UNDER_LINE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ENDFORM. "HEADER_PRICE_PRINT
FORM HEADER_TEXT_PRINT *
Printout of the headertexts *
FORM header_text_print.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'HEADER_TEXT'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDFORM. "HEADER_TEXT_PRINT
FORM ITEM_CHARACERISTICS_PRINT *
Printout of the item characteristics -> configuration *
FORM item_characteristics_print.
LOOP AT tkomcon.
conf_out = tkomcon.
IF sy-tabix = 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_LINE_CONFIGURATION_HEADER'
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPOR -
How to define output types email or external send in the report program
Hi all,
now we are using a zprogram for output type printer and standard program RVADOR01 for output type external send. Now i want to modify my zprogram itself to support external send email as well as printer also. What modifications should I have to make in my zprogram. My form is a script.
Thank you,
Mallikhi all,
i made the following changes in my code and it worked well.
thank you for all who tried to share my pain.
thanks one and all.
hope this code will help anybode.
thanks & regards
FORM OPEN_FORM_EMAIL.
TABLES: TNAPR, "Programs & Forms
ITCPO, "Communicationarea for Spool
ARC_PARAMS, "Archive parameters
TOA_DARA, "Archive parameters
ADDR_KEY. "Adressnumber for ADDRESS
TYPE-POOLS SZADR.
DATA: LVF_DEVICE LIKE ITCPP-TDDEVICE,
LVF_DIALOG(1) TYPE C VALUE ' ',
LVS_RECIPIENT LIKE SWOTOBJID,
LVS_SENDER LIKE SWOTOBJID,
LVS_SNAST TYPE SNAST,
LVF_PROGRAM LIKE SY-REPID,
LVS_COMM_TYPE TYPE AD_COMM,
LVS_COMM_VALUES TYPE SZADR_COMM_VALUES,
LVS_TITLE LIKE SNAST-TDCOVTITLE.
reset return code
RETCODE = 0.
if there is a communication strategy used ...
IF NOT NAST-TCODE IS INITIAL AND NAST-NACHA EQ '5'.
... use stratagy to get communication type
CALL FUNCTION 'ADDR_GET_NEXT_COMM_TYPE'
EXPORTING
STRATEGY = NAST-TCODE
ADDRESS_TYPE =
ADDRESS_NUMBER = KNA1-ADRNR
PERSON_NUMBER = VBDKA-ADRNP
PERSON_NUMBER = ADDR_KEY-PERSNUMBER
IMPORTING
COMM_TYPE = LVS_COMM_TYPE
COMM_VALUES = LVS_COMM_VALUES
TABLES
STRATEGY_TABLE =
EXCEPTIONS
ADDRESS_NOT_EXIST = 1
PERSON_NOT_EXIST = 2
NO_COMM_TYPE_FOUND = 3
INTERNAL_ERROR = 4
PARAMETER_ERROR = 5
OTHERS = 6.
IF SY-SUBRC <> 0.
RETCODE = SY-SUBRC.
SYST-MSGTY = 'E'.
PERFORM PROTOCOL_UPDATE.
ENDIF.
ENDIF.
LVS_COMM_TYPE = 'INT'.
CLEAR LVS_COMM_VALUES-ADSMTP-SMTP_ADDR.
CLEAR LVS_SNAST.
LVS_COMM_VALUES-ADSMTP-SMTP_ADDR = V_CUST_EMAIL.
convert communication data
MOVE-CORRESPONDING NAST TO LVS_SNAST.
LVS_SNAST-ANZAL = 1.
LVS_TITLE = 'Mail Header Title'.
MOVE LVS_TITLE TO LVS_SNAST-TDCOVTITLE.
MOVE SY-REPID TO LVF_PROGRAM.
CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'
EXPORTING
PI_COMM_TYPE = 'INT'
PI_COMM_VALUES = LVS_COMM_VALUES
PI_SCREEN = XSCREEN
PI_NEWID =
PI_COUNTRY = ADRC-COUNTRY
PI_REPID = SY-REPID
PI_SNAST = LVS_SNAST
PI_MAIL_SENDER = SY-UNAME
IMPORTING
PE_ITCPO = ITCPO_LS
PE_DEVICE = LVF_DEVICE
PE_MAIL_RECIPIENT = LVS_RECIPIENT
PE_MAIL_SENDER = LVS_SENDER
EXCEPTIONS
COMM_TYPE_NOT_SUPPORTED = 1
RECIPIENT_CREATION_FAILED = 2
SENDER_CREATION_FAILED = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
RETCODE = SY-SUBRC.
SYST-MSGTY = 'E'.
PERFORM PROTOCOL_UPDATE.
ENDIF.
CHECK RETCODE EQ 0.
fill structure itcpo
ITCPO = ITCPO_LS.
open form
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX = TOA_DARA
ARCHIVE_PARAMS = ARC_PARAMS
DEVICE = 'MAIL'
DIALOG = 'X'
FORM = 'ZSDLS003'
LANGUAGE = SY-LANGU
OPTIONS = ITCPO_LS
MAIL_SENDER = LVS_SENDER
MAIL_RECIPIENT = LVS_RECIPIENT
MAIL_APPL_OBJECT = ' '
RAW_DATA_INTERFACE = '*'
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
OTHERS = 8.
IF SY-SUBRC NE 0.
CASE SY-SUBRC.
WHEN 7.
RETCODE = SY-SUBRC.
SYST-MSGID = 'VN'.
SYST-MSGNO = '096'.
SYST-MSGTY = 'E'.
SYST-MSGV1 = NAST-KSCHL.
SYST-MSGV2 = NAST-KAPPL.
PERFORM PROTOCOL_UPDATE.
WHEN OTHERS.
RETCODE = SY-SUBRC.
PERFORM PROTOCOL_UPDATE.
ENDCASE.
ENDIF.
SET COUNTRY ADRC-COUNTRY.
ENDFORM. -
How Test the output with Email
HI all,
Could you please help me how to test the email output type.
Now all out put was confiured with email.
Where I have to maintain my mail id to check weather that out put is working or not, Please provide the steps to to test then email scnerio.
Regards,
MuralikrishnaDear Murali k
Check this setting
If your SD output configuration is set up correctly, an e-mail from SAP using medium 5 should go through just fine via SAPconnect (transaction SCOT). When it works, the external recipient should receive an e-mail with a PDF attachment containing the form image, regardless of whether it has been created via SAPscript or Smart Forms.
Depending on your output determination settings, this even can happen in the background, without any interaction with the SAP front end (e.g. for invoices created automatically by a batch job).
Typically, a failed send will be flagged in the message control table (NAST), and this table should be monitored closely. However, there are many reasons why a document hasn't gone through, and this can be the case with both outgoing faxes and e-mails from SAP.
The solution to both is the same: After identifying the failed document, re-send it manually by going inside it in change mode and repeating the appropriate output. If an obsolete customer e-mail address was the culprit, a customer master change would also be required, along with an audit of any docs recently created for this customer.
If any underlying data has changed since initial issuance, a re-sent document may not appear identical to the (failed) original.
Sometimes, as when address info has been corrected, this can be a good thing. After all, the new document is more accurate than the old one.
In other cases, such as when pricing info has changed, it might be a cause for serious concern.
There are several ways to deal with this concern:
1) Limit the types of changes allowed on certain docs after creation
2) Set up a doc image archive via ArchiveLink and re-issue output from there instead of from the current doc; or
3) For highly sensitive docs, consider a more secure delivery method
Hope this will helps you
Prem -
Script output getting suppressed when trying to send email
Hi,
I am having an existing report,part of code is given below.
*data processing.....
itcpo-tdcovtitle = z_text.
itcpo-tdgetotf = 'X'.
call function 'OPEN_FORM'
exporting
device = 'PRINTER'
form = 'LAYOUTSET'
importing
result = x_itcpp_sulph
exceptions
canceled = 1
device = 2
form = 3
options = 4
unclosed = 5
others = 6.
Data processing ....and writing to script output
perform entry(zvadin11) using returncode xscreen if found.
call function 'CLOSE_FORM'
importing
result = x_itcpp_sulph
tables
otfdata = otf1
exceptions
unopened = 1
others = 2.
So the control will switch from existing report to another program namely zvadin11 and gives script output.
Now,in my current program i am trying to send script output through Email,for which i am converting script output to OTF data.Then sending the data through mail,using function modules 'SX_OBJECT_CONVERT_OTF_PDF' and 'SO_NEW_DOCUMENT_ATT_SEND_API1'.
I am able to send the data through PDF attachment as required.But i am unable to see Script output.If i comment the OTF related code from open_form and close_form,i am able to see the script output,but i am not getting data into OTF internal table.
Can i get both the functionalities of seing the script output and also get OTF data for Email.
Can any one help me?
Thanks & Regards,
Seshagiri.M.
Intelligroup.Hi Seshagiri,
Is yur code that sneds email before 'CLOSE_FORM'?
Regards,
Suresh Datti -
How To send SAP SCRIPT AS an email.
Hi,
Any one knows how to send sap script output to users in the form of an email.
Is there any other way to send it apart from sending the script output to spool and converting the spool to PDF and send that PDF to user?
It would it helpful for me if u can let me know any peace of code as an example for the same.
Message was edited by: NarasimhaHi,
This may be too late but here is a really easy way
Here is a snippet of code that will help you out.
You can use the OPEN_FORM of the SAPscript to have a device type of MAIL instead of PRINTER
Form OPEN_FORM
Open SAPscript form to send to user
FORM OPEN_FORM .
*--- Set recipient
GW_COMM_VALUES-ADSMTP-SMTP_ADDR = '[email protected]'.
*--- Set NAST details as these will not currently be set....
CLEAR GW_SNAST.
GW_SNAST-ANZAL = 1.
GW_TITLE = 'Mail Header Title'.
MOVE GW_TITLE TO GW_SNAST-TDCOVTITLE.
*--- Set sender and recipient details
CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'
EXPORTING
PI_COMM_TYPE = 'INT'
PI_COMM_VALUES = GW_COMM_VALUES
PI_REPID = SY-REPID
PI_SNAST = GW_SNAST
PI_MAIL_SENDER = SY-UNAME
IMPORTING
PE_ITCPO = GW_ITCPO
PE_MAIL_RECIPIENT = GW_RECIPIENT
PE_MAIL_SENDER = GW_SENDER
EXCEPTIONS
COMM_TYPE_NOT_SUPPORTED = 1
RECIPIENT_CREATION_FAILED = 2
SENDER_CREATION_FAILED = 3
OTHERS = 4.
*--- Open SAPscript in MAIL mode for e-mailing
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = 'MAIL'
DIALOG = 'X'
FORM = SapScript Form Name
LANGUAGE = SY-LANGU
OPTIONS = GW_ITCPO
MAIL_SENDER = GW_SENDER
MAIL_RECIPIENT = GW_RECIPIENT
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12.
When you have finished your SAPscript and call function CLOSE_FORM make sure you do a COMMI WORK after the call of this function.
You should then see the mail created in SOST.
Kind regards
Colin -
To convert Sap Script output to PDF format and send it via email.
Hi Friends,
Could any one please tell me, how to convert the Sap Script output to PDF format and send it via email. If any one have the code, kindly mail me to [email protected]
Thanks & Regards,
JohnPlese check this sample code from other thread.
REPORT zzz_jaytest .
Types Declaration
TYPES : BEGIN OF ty_pa0001,
pernr TYPE pa0001-pernr,
bukrs TYPE pa0001-bukrs,
werks TYPE pa0001-werks,
END OF ty_pa0001.
Internal Table Declaration
DATA : i_pa0001 TYPE STANDARD TABLE OF ty_pa0001, "For pa0001 Details
i_otf TYPE STANDARD TABLE OF itcoo, "For OTF data
i_content_txt TYPE soli_tab, "Content
i_content_bin TYPE solix_tab, "Content
i_objhead TYPE soli_tab,
Work Area Declaration
w_pa0001 TYPE ty_pa0001, "For pa0001 Details
w_res TYPE itcpp, "SAPscript output
"parameters
w_otf TYPE itcoo, "For OTF
w_pdf TYPE solisti1, "For PDF
w_transfer_bin TYPE sx_boolean, "Content
w_options TYPE itcpo, "SAPscript output
"interface
Variable Declaration
v_len_in TYPE so_obj_len,
v_size TYPE i.
Constants Declaration
CONSTANTS : c_x TYPE c VALUE 'X', "X
c_locl(4) TYPE c VALUE 'LOCL', "Local Printer
c_otf TYPE sx_format VALUE 'OTF', "OTF
c_pdf TYPE sx_format VALUE 'PDF', "PDF
c_printer TYPE sx_devtype VALUE 'PRINTER', "PRINTER
c_bin TYPE char10 VALUE 'BIN', "BIN
c_name TYPE string VALUE 'C:\ZZZ_JAYTEST.PDF',"Downloading
"File Name
c_form(11) TYPE c VALUE 'ZZZ_JAYTEST'. "Form Name
START-OF-SELECTION.
Selecting the records from pa0001
SELECT pernr bukrs werks FROM pa0001
INTO TABLE i_pa0001 UP TO 10 ROWS.
Setting the options
w_options-tdcopies = 1 ."Number of copies
w_options-tdnoprev = c_x."No print preview
w_options-tdgetotf = c_x."Return of OTF table
w_options-tddest = c_locl."Spool: Output device
Opening the form
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = c_form
device = c_printer
language = sy-langu
OPTIONS = w_options
IMPORTING
RESULT = w_res.
LOOP AT i_pa0001 INTO w_pa0001.
Writting into the form
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'MAIN'
window = 'MAIN'.
ENDLOOP.
Closing the form
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = w_res
TABLES
otfdata = i_otf
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
codepage = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Converting OTF data to single line
LOOP AT i_otf INTO w_otf.
CONCATENATE w_otf-tdprintcom w_otf-tdprintpar
INTO w_pdf.
APPEND w_pdf TO i_content_txt.
ENDLOOP.
Converting to PDF Format
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
format_src = c_otf
format_dst = c_pdf
devtype = c_printer
CHANGING
transfer_bin = w_transfer_bin
content_txt = i_content_txt
content_bin = i_content_bin
objhead = i_objhead
len = v_len_in
EXCEPTIONS
err_conv_failed = 1
OTHERS = 2.
v_size = v_len_in.
Downloading the PDF File
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = v_size
filename = c_name
filetype = c_bin
TABLES
data_tab = i_content_bin.
The extension is put the it_mailpack-obj_name parameter of 'SO_NEW_DOCUMENT_ATT_SEND_API1'. -
Sending email for selected pages of a script output
Hi all,
i want to know how to send email only the selected pages of an script output.Example if the script produce 10 pages i want to send 4th and 5th page to one customer and 6th ,7th page to another customer like that. because this is an customer statement of account which is confidetial. i refer so many sites but useless. i hope here my problem can solve.
rgds,
AshokHi ashok,
While enter the print parameters enter the page number what ever u want.
Reply for queries,
Regards,
Kumar. -
How to send output of smartform in pdf format as an attachment to email
how to send output of smartform in pdf format as an attachment to email
search before posting further and follow Forum rules
Edited by: Vijay Babu Dudla on Jan 15, 2009 4:50 AMDid u check on sdn?
i dont think so or else there are many posts on this topic and good wikis too.
look at one of these code tutorial wiki
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/mail%2bsend%2bthrough%2boutput%2bcontrols
So next time do use the search functionality.
кu03B1ятu03B9к
Edited by: kartik tarla on Jan 15, 2009 12:33 PM -
How to print a standard text of 3 pages in the script output?
Hi all,
I want to print a standard text as an include in the script output.
But the standrad text is of 3 pages conataining continuous (some terms and condtitions) text.
But while executing driver program, I am getting a STOP messgae pop-up saying 'Output is continuous or contains too many pages (>4)'.
How to get the standard text of 3 pages in the output. The standard text is to be printed at the bottom of the output.
Thanks,
SachinHi ,
To display standard texts you have to create a include in your script below is the syntax for that:
INCLUDE name OBJECT name ID name PARAGRAPH name LANGUAGE name
Include command is used to include standard text in a form.the text
should be already defined by using transaction SO10.
Here name is the name of text
ID is used to classify text e.g. SDVD (SD related text) , ST (Standard text)
OBJECT is used to specify type of object it an be TEXT , DOKU
LANGUAGE is used to specify language like EN ,if ommited than logon
language is used
PARAGRAPH is used to specify the paragraph like C
e.g. /:INCLUDE mytext OBJECT TEXT ID ST LANGUAGE EN
Here the standard text created in SO10 with name mytext is
included in the form in language EN (English)
Please let me know if you have still any confusion.
Thanks
Narendra Vikram Vishwakarma -
How to restrict Order types KA and AB in script output form
How to restrict KA AND AB order types in script output data is coming from bkpf-blart .
program is rfkord10.
and form is f140_acc_stat_1
in script output i dont want to display KA AND AB order types ..
data is coming from standard report.
i copied form into zform.
in output it is displaing all order types ..
is there any solution to restrict above order types.Hi
Check the data structures used in the script
Since it is account statement of customer it uses the Tables BSID and BSAD in which the field BLART field is there whose values are KA and AB
check for the structures which are used in the script and in them search for the field BLART in Se11 and accordingly keep the condition
It will work
Regards
Anji -
How to send a SmartForm output as Email to external id?
I want the Smartform output to email to extrenal email-id.
I don't want the Smartform output as any kind of attachment, but the Smartform output needs to be shown on the main email body. Can anyone pls. help me out?First, thanks for your responses.
I haven't found the demo program 'BCS_EXAMPLE_6' in SAP 4.7. But then I got it in SAP 5.0 version. But this program only describes how to send Form output as PDF attachment with email. But this is well-known and I haven't asked for this. I want the Smartform output within the mail-body without attachment.
The weblog at "/people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp seems a more logical one, though I have already tried it out. Here the html page creation and graphics load -- everything is going right. But this HTML page is being delivered as an Attachment within the email. The normal HTML Email is not coming. I think this technique wouldn't work with all mailing tools. Here in the weblog, Pavan has shown the example with Microsoft Outlook. But I have tested with Lotus Notes and Yahoo. And In both cases, the mail is coming with attached HTML file (in .mht format), but not as a notmal html mail without attachments. -
SQL Developer Script Output too limited for student - how to increase?
I'm just a student trying to migrate from notepad and SQL Plus to using the SQL Developer for the comprehensive course project. Unfortunately, the script output is way too limited... it only reports a fourth of my last assignment's results - not enough to use in the project. How specifically can this be increased. I have version 1.1.0.21 running on Windows XP on a laptop with 512k memory.
Thanks much for any/all assist. I don't want to go back to notepad!!Thank you for the advice, but I had tried that. My script is 305 lines counting blank lines and the SQL developer displays only about 35 lines of results corresponding to 58 lines of input. When I run the same script in SQL Plus in a console window using the @filename command, I get the entire output.
My input and output follow:
Input:
spool project-test-out.txt
prompt 'name'
prompt 'Assignment X, parts 2b - 2h and 3a - 3b '
create table Customer (
CustID Integer,
Name Char(10),
State Char(2),
primary key (CustID) );
create view CustID_List (ID_Cust) as (select custID from Customer);
create table Inventory (
PartID Integer,
Item Char(10),
Cost Float,
OnHand Integer,
primary key (PartID) );
create table Invoice (
InvNum Integer,
InvDate DATE,
CustID Integer,
primary key (InvNum),
foreign key (CustID) references Customer);
create table Invoice_Item (
InvNum Integer,
PartID Integer,
Quantity Integer,
foreign key (InvNum) references Invoice,
foreign key (PartID) references Inventory);
insert into customer values ( 101, 'Kerry', 'MA' );
insert into customer values ( 102, 'Edwards', 'NC' );
insert into customer values ( 103, 'Cheney', 'TX' );
insert into customer values ( 104, 'Bush', 'TX' );
insert into Inventory values ( 1, 'Boots ', 149.95, 6 );
insert into Inventory values ( 2, 'Spurs ', 12.95, 24 );
insert into Inventory values ( 3, 'Buckle ', 19.95, 4 );
insert into Inventory values ( 4, 'Hat ', 60.00, 12 );
insert into Inventory values ( 5, 'Holster', 75.00, 8 );
insert into Inventory values ( 6, 'Saddle ', 350.00, 2 );
prompt 'Part grad 3b - unsatisfying solution, limitations of Oracle 10g Express'
prompt 'After many trials, found oracle discussion on web stating that'
prompt 'Oracle 9 does not allow subqueries in the trigger WHEN clause.'
prompt 'What a pain. Thus the solution here has become rather inelegant.'
prompt 'The trigger and following select statement are byproducts of various'
prompt 'simplification attempts, none of which worked.'
select ID_Cust from custID_List;
create trigger Invoice_CustID_CK before insert on Invoice
REFERENCING NEW AS newCustID
FOR EACH ROW
BEGIN
if (:newCustID.CustID = 205 )
-- {{want line below but it generates error of: subquery not allowed in }}
-- {{this context }}
-- if (:newCustID.CustID NOT IN
-- (Select ID_Cust from CustID_List))
then :newCustID.CustID := NULL;
end if;
END;
run;
show errors trigger Invoice_CustID_CK;
insert into invoice values ( 201, '01-Aug-2006', 101 );
insert into invoice values ( 202, '02-Sep-2006', 101 );
insert into invoice values ( 203, '05-Oct-2006', 103 );
insert into invoice values ( 204, '07-Oct-2006', 102 );
insert into invoice values ( 205, '09-Oct-2006', 205 );
insert into Invoice_Item values ( 201, 1, 1 );
insert into Invoice_Item values ( 201, 2, 1 );
insert into Invoice_Item values ( 202, 5, 2 );
insert into Invoice_Item values ( 203, 1, 2 );
insert into Invoice_Item values ( 203, 2, 2 );
insert into Invoice_Item values ( 203, 3, 2 );
insert into Invoice_Item values ( 203, 4, 2 );
insert into Invoice_Item values ( 204, 4, 2 );
insert into Invoice_Item values ( 204, 1, 1 );
select * from invoice;
select * from customer;
select * from invoice_item;
select * from inventory;
prompt 'Preparation for part 2b - create view showing onhand and starting inventory'
alter table inventory add (start_inventory integer);
update inventory
set start_inventory = onhand;
create view inv_changes as
select partid, sum(quantity) as sales_by_id
from invoice_item
group by partid;
create table inventory_invoiced as
select inventory.partid, item, cost, onhand, start_inventory, COALESCE (sales_by_id, 0) as sales_by_id_NZ
from inventory left outer join inv_changes
on inventory.partid = inv_changes.partid;
select * from inventory_invoiced;
update inventory_invoiced
Set
onhand = onhand - sales_by_id_NZ;
select * from inventory_invoiced;
prompt 'Part 2b - What item has the least on hand inventory after processing the invoices?'
select item
from inventory_invoiced
where onhand = (select min(onhand) from inventory_invoiced);
prompt 'Part 2c - How much does customer 101 owe?'
create view cust101_orders as
select distinct partID, quantity
from invoice_item, invoice
where invoice_item.invnum IN
(select I.invnum from invoice I where I.custid = 101);
select * from cust101_orders;
select sum(quantity * cost) as cust101_bill
from cust101_orders, inventory
where cust101_orders.partID = inventory.partID;
prompt 'Part 2d - Which customer has the biggest bill?'
prompt ' desirable solution is to do part 2c as a general case '
prompt ' using a stored function such that the custID is passed '
prompt ' to the function. Unfortunately, neither function below '
prompt ' compiles. First case trips on creating the view. Second'
prompt ' case being arewrite without a view - ifit even works - '
prompt ' trips on the complicated select'
create or replace function ind_customer_bill
(ind_customer_ID in integer)
return Float
IS ind_total_bill Float;
begin
create view cust_orders as
select distinct partID, quantity
from invoice_item.invnum IN
(select I.invnum from invoice I where I.custid = ind_customer_ID);
select sum(quantity * cost) into ind_total_bill
from cust_orders, inventory
where cust_orders.partid = inventory.partid;
drop view cust_orders;
return (ind_total_bill);
end;
show errors function ind_customer_bill;
create or replace function ind_customer_bill
(ind_customer_ID in integer)
return Float
IS ind_total_bill Float;
begin
select sum(quantity * cost) into ind_total_bill
from inventory, (select distinct partID as interim_partID, quantity
from invoice_item.invnum IN
(select I.invnum from invoice I where I.custid = ind_customer_ID))
where interim_partID = inventory.partid;
return (ind_total_bill);
end;
show errors function ind_customer_bill;
Prompt 'part 2d continued using shameful brute force technique'
select * from cust101_orders;
create view cust101_due as
select sum(quantity * cost) as cust101_bill
from cust101_orders, inventory
where cust101_orders.partID = inventory.partID;
create view cust102_orders as
select distinct partID, quantity
from invoice_item, invoice
where invoice_item.invnum IN
(select I.invnum from invoice I where I.custid = 102);
select * from cust102_orders;
create view cust102_due as
select sum(quantity * cost) as cust102_bill
from cust102_orders, inventory
where cust102_orders.partID = inventory.partID;
create view cust103_orders as
select distinct partID, quantity
from invoice_item, invoice
where invoice_item.invnum IN
(select I.invnum from invoice I where I.custid = 103);
select * from cust103_orders;
create view cust103_due as
select sum(quantity * cost) as cust103_bill
from cust103_orders, inventory
where cust103_orders.partID = inventory.partID;
create view cust104_orders as
select distinct partID, quantity
from invoice_item, invoice
where invoice_item.invnum IN
(select I.invnum from invoice I where I.custid = 104);
select * from cust104_orders;
create view cust104_due as
select sum(quantity * cost) as cust104_bill
from cust104_orders, inventory
where cust104_orders.partID = inventory.partID;
prompt 'and the answer to part 2d - biggest bill is'
select *
from cust101_due, cust102_due, cust103_due, cust104_due;
prompt 'Part 2e - What items were the most popular (most sold)'
select item
from inventory_invoiced
where sales_by_id_NZ >= ANY (
select max(sales_by_id_NZ) from inventory_invoiced);
prompt 'Part 2f - What was the value of the original inventory'
select sum (start_inventory * cost) as total_start_inventory
from inventory_invoiced;
prompt 'Part 2g - What was the value of the ending inventory'
select sum (onhand * cost) as total_ending_inventory
from inventory_invoiced;
prompt 'Part 2h - What customers did not place an order'
-- after some testing of the inner nest parts wherein the left outer join
-- results in a CustID_List entry 104 having a null entry in
-- invoice's CustID list.
select Name
from customer
where custID IN (select ID_Cust
from (select ID_Cust, CustID
from CustID_List left outer join invoice on
ID_Cust = CustID)
where CUSTID IS NULL);
prompt 'Part 3a - What items were not purchased by anyone'
select item as unpurchased
from inventory_invoiced
where sales_by_id_nz = 0;
prompt 'Part 3b - table modifications for invoices to have valid CustID'
prompt ' -- see 3b section at top of file, notes and trigger '
drop view cust101_due;
drop view cust102_due;
drop view cust103_due;
drop view cust104_due;
drop function ind_customer_bill;
drop view cust101_orders;
drop view cust102_orders;
drop view cust103_orders;
drop view cust104_orders;
drop table inventory_invoiced;
drop view inv_changes;
drop view custID_List;
drop table invoice_item;
drop table invoice;
drop table inventory;
drop table customer;
Output:
'name'
'Assignment X, parts 2b - 2h and 3a - 3b '
create table succeeded.
create view succeeded.
create table succeeded.
create table succeeded.
create table succeeded.
1 rows inserted
1 rows inserted
1 rows inserted
1 rows inserted
1 rows inserted
1 rows inserted
1 rows inserted
1 rows inserted
1 rows inserted
1 rows inserted
'Part grad 3b - unsatisfying solution, limitations of Oracle 10g Express'
'After many trials, found oracle discussion on web stating that'
'Oracle 9 does not allow subqueries in the trigger WHEN clause.'
'What a pain. Thus the solution here has become rather inelegant.'
'The trigger and following select statement are byproducts of various'
'simplification attempts, none of which worked.'
ID_CUST
101
102
103
104
4 rows selected
trigger Invoice_CustID_CK Compiled. -
How to flush script output in sql developer
Greetings from a newbie,
how can I flush script output in sql developer?
regards,
ValerieFlush? You can wipe the Output pane by pressing the "Clear" icon (crayon gum): the first icon on the tab's mini-toolbar.
Does that answer your question?
K. -
How can change the font in the script output and the data grid ?
How can change the font in the script output and the data grid in Sql Developer?
You can't easily unless you have the latest version (2.1.1).
If you do have this version then changing the font in the Tools/Preferences menu under the code editor/fonts section will also change the font of the data grid.
For details of changing the fonts in an earlier version then see Sue's post below.
http://sueharper.blogspot.com/2010/03/back-to-basics-changing-font-setting-in.html
Maybe you are looking for
-
Problem when sending report to mail ID's in BIP
Dear All, We are using BIP 10.1.3.3.1. I generated some reports . I configured SMTP server and i can aable to send my reports to users ID's also. But i have to send my reports to 10 users(one ID is having 30 characters length). while i am giving the
-
Help...Vendor Evaluation Websurvey not showing
Dear All, Im facing a problem in Vendor evaluation. I've done the following steps: 1. Create Questionnaire and assign it to Survey 2. Define Event for survey 3. Activate SRM_VE_SERVICE and UWS_FORM_SERVICE in SICF When I create confirmation for PO, t
-
Hi, When I want to use my CS6 products and Adobe Acrobat Pro I all of a sudden have to fill in my serial number. When I do this it says it's invalid. It is certainly the correct number. What can I do about this? Thanks a lot!
-
I have no idea how to solve this problem. Are there any suggestions?
-
HELP on SubMenu & Forms from XML
I have loaded the Sub-Menu using XML <?xml version="1.0" encoding="UTF-16" ?> - <Application> - <Menus> - <action type="add"> <Menu Checked="0" Enabled="1" FatherUID="4352" Position="0" String="Form1" Type="1" UniqueID="4355" /> <Menu Checked="