09-15-2006 9:17 AM
Hi,
I am doing a SAP Script.I am supposed to customize MEDRUCK and use the standard print program.There is another requirement,if the vendor has an email address the output has to be send via email else via printer.How are where do I incorporate this condition?
Thanks in advance.
Regards,
Preethi
09-15-2006 3:41 PM
There are 2 ways of doing :-
1) Take the spool generated and convert to PDF(use FM CONVERT_ABAPSPOOLJOB_2_PDF /CONVERT_OTFSPOOLJOB_2_PDF ) and send as email attachment using function module SO_NEW_DOCUMENT_ATT_SEND_API1. Check at ITCPO structure of Open_FORM for SPOOL details.
2)When call Open_form by default device is 'Printer' default to MAIL and send output to various RECIPIENT.
I have implemented same in SMART FORM and it works. So am sure this work for SAP Script as well.
09-15-2006 11:26 AM
09-15-2006 11:31 AM
Please check this code it may help u.
FORM send_mail USING p_y16m_rcp_par STRUCTURE y16m_rcp_par.
Have a subject for the mail
g_s_document_data-obj_name = text-t02.
g_s_document_data-obj_descr = text-t03.
Fill receiver information
g_s_receivers-rec_type = p_y16m_rcp_par-rec_type.
g_s_receivers-rec_id = p_y16m_rcp_par-rec_id.
g_s_receivers-express = 'X'.
APPEND g_s_receivers TO g_t_receivers.
Call function to send mail
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = g_s_document_data
document_type = 'RAW'
PUT_IN_OUTBOX = ' '
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
OBJECT_HEADER =
object_content = g_t_object_content
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
receivers = g_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
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " SEND_MAIL
Regards
09-15-2006 12:58 PM
Hi,
Thanks a lot for your reply but my requirement is to send the form only via email so can you please tell me the configuration to be done for this .
09-15-2006 3:41 PM
There are 2 ways of doing :-
1) Take the spool generated and convert to PDF(use FM CONVERT_ABAPSPOOLJOB_2_PDF /CONVERT_OTFSPOOLJOB_2_PDF ) and send as email attachment using function module SO_NEW_DOCUMENT_ATT_SEND_API1. Check at ITCPO structure of Open_FORM for SPOOL details.
2)When call Open_form by default device is 'Printer' default to MAIL and send output to various RECIPIENT.
I have implemented same in SMART FORM and it works. So am sure this work for SAP Script as well.