función SO_DOCUMENT_SEND_API1 (envío mails)
Hola Foro,
tengo que hacer una sustitución (user-exit) para este perform.
PERFORM U999(ZRGGBS000) IF FOUND .
Como este código es estandard, deduzco que no puedo tocarlo.
Mi desarollo está en el FORM y lo que no se muy bien es como pasarle los parámetros.
Os dejo el código , a ver si veis lo que me falta:
FORM u999.
*FORM u999 TABLES tab_contents_txt
* it_attach
* USING p_email
* p_mtitle
* p_format
* p_filename
* p_attdescription
* p_sender_address
* p_sender_addres_type
* CHANGING p_error
* p_reciever.
DATA: int_error TYPE sy-subrc,
int_receiver LIKE sy-subrc.
DATA: w_doc_data LIKE sodocchgi1,
chr_email LIKE somlreci1-receiver.
DATA:
tab_contents_txt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
tab_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
tab_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
* Missatge: S'ha donat d' alta l' actuació' PROJ-PSPID PROJ-ZZDESCRIPCIO
DATA: chr_mtitle LIKE sodocchgi1-obj_descr.
* Omplenem el document de dades
w_doc_data-doc_size = 1.
* paràmetres del missatge
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = chr_mtitle .
w_doc_data-sensitivty = 'F'.
* Fill the document data and get size of attachment
* CLEAR w_doc_data.
* READ TABLE it_attach INDEX w_cnt.
* w_doc_data-doc_size =
* ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
* w_doc_data-obj_langu = sy-langu.
* w_doc_data-obj_name = 'SAPRPT'.
* w_doc_data-obj_descr = ld_mtitle.
* w_doc_data-sensitivty = 'F'.
* CLEAR t_attachment.
* REFRESH t_attachment.
* t_attachment[] = it_attach[].
* cos del missatge
CLEAR tab_packing_list.
REFRESH tab_packing_list.
tab_packing_list-transf_bin = space.
tab_packing_list-head_start = 1.
tab_packing_list-head_num = 0.
tab_packing_list-body_start = 1.
DESCRIBE TABLE tab_contents_txt LINES tab_packing_list-body_num.
tab_packing_list-doc_type = 'RAW'.
APPEND tab_packing_list.
* Create attachment notification
* t_packing_list-transf_bin = 'X'.
* t_packing_list-head_start = 1.
* t_packing_list-head_num = 1.
* t_packing_list-body_start = 1.
*
* DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
* t_packing_list-doc_type = ld_format.
* t_packing_list-obj_descr = ld_attdescription.
* t_packing_list-obj_name = ld_attfilename.
* t_packing_list-doc_size = t_packing_list-body_num * 255.
* APPEND t_packing_list.
* destinatatis del mail
CLEAR tab_receivers.
REFRESH tab_receivers.
tab_receivers-receiver = chr_email.
tab_receivers-rec_type = 'U'.
tab_receivers-com_type = 'INT'.
* t_receivers-notif_del = 'X'.
* t_receivers-notif_ndel = 'X'.
APPEND tab_receivers.
* break-point.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
* SENDER_ADDRESS = SY-UNAME
* SENDER_ADDRESS_TYPE = 'B'
commit_work = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
* SENDER_ID =
TABLES
packing_list = tab_packing_list
* OBJECT_HEADER =
* CONTENTS_BIN =
contents_txt = tab_contents_txt
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
receivers = tab_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
.
* omplenem codi d' error
int_error = sy-subrc.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* control codi dels receptors del mail
LOOP AT tab_receivers.
int_receiver = tab_receivers-retrn_code.
ENDLOOP.
ENDFORM. "U999
|