Send mail

*&---------------------------------------------------------------------*
*& Report  Z_TEST_MAIL_SEND
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  Z_TEST_MAIL_SEND.

data: document_data LIKE SODOCCHGI1,
      TAB_LINES LIKE SY-TABIX,
      w_mail_body_lines like SY-TABIX,
      packing_list LIKE SOPCKLSTI1 OCCURS  2 WITH HEADER LINE,
      OBJHEAD LIKE SOLISTI1   OCCURS  1 WITH HEADER LINE,
      OBJTXT  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE,
      CONTENTS_HEX like SOLIX OCCURS 10 WITH HEADER LINE,
      RECLIST LIKE SOMLRECI1  OCCURS  5 WITH HEADER LINE.

** Creating the document to be sent

document_data-OBJ_NAME = 'OFFER'.

document_data-OBJ_DESCR = 'Auction of a Picasso painting'.

**

OBJTXT = 'Reserve price : $250000'.

APPEND OBJTXT.

clear: OBJTXT.

OBJTXT = 'A reproduction of the painting to be auctioned'.

APPEND OBJTXT.

clear: OBJTXT.

OBJTXT = 'is enclosed as an attachment.'.

APPEND OBJTXT.

CLEAR: TAB_LINES.

DESCRIBE TABLE OBJTXT LINES TAB_LINES.

w_mail_body_lines = TAB_LINES.

READ TABLE OBJTXT INDEX TAB_LINES.

** Creating the entry for the compressed document

packing_list-HEAD_START = 1.

packing_list-HEAD_NUM   = 0.

packing_list-BODY_START = 1.

packing_list-BODY_NUM   = TAB_LINES.

packing_list-DOC_TYPE   = 'RAW'.

APPEND packing_list.

** Creating the document attachment

OBJTXT = 'The first line'.

append OBJTXT.

clear: OBJTXT.

OBJTXT = 'The seconde line'.

append OBJTXT.

clear: TAB_LINES.

DESCRIBE TABLE OBJTXT LINES TAB_LINES.

READ TABLE OBJTXT index TAB_LINES.

document_data-doc_size = ( TAB_LINES - w_mail_body_lines - 1 ) * 255 + strlen( OBJTXT ).

OBJHEAD = 'Attachment'.

APPEND OBJHEAD.

* Creating the entry for the compressed attachment

packing_list-HEAD_START = 1.

packing_list-HEAD_NUM   = 1.

packing_list-BODY_START = 4.

packing_list-BODY_NUM   = ( TAB_LINES - w_mail_body_lines ).

packing_list-DOC_TYPE   = 'TXT'.

packing_list-OBJ_NAME   = 'ATTACHMENT'.

packing_list-OBJ_DESCR = 'Reproduction object 138'.

packing_list-DOC_SIZE   = ( TAB_LINES - w_mail_body_lines ) * 255 .

APPEND packing_list.

* Entering names in the distribution list

RECLIST-RECEIVER = 'sunrise_zeng@infosys.com'.

RECLIST-REC_TYPE = 'U'.

APPEND RECLIST.

** Sending the document

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
  EXPORTING
   document_data                     = document_data
   PUT_IN_OUTBOX                     = 'X'
   COMMIT_WORK                       = 'X'
* IMPORTING
*   SENT_TO_ALL                      =
*   NEW_OBJECT_ID                    =
  tables
    packing_list                     = packing_list
    OBJECT_HEADER                    = OBJHEAD
*   CONTENTS_BIN                     =
   CONTENTS_TXT                      = OBJTXT
*   CONTENTS_HEX                     =
*   OBJECT_PARA                      =
*   OBJECT_PARB                      =
    receivers                        = RECLIST
 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.

 else.

   write: 'sent mail successfully'.

ENDIF.


=======================================================================================

*&---------------------------------------------------------------------*
*& Report  ZSSO_DOCUMENT_SEND_API1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zsso_document_send_api1.

DATA: lt_mailrecipients  TYPE STANDARD TABLE OF somlrec90 WITH HEADER LINE,
      lt_mailtxt         TYPE STANDARD TABLE OF soli      WITH HEADER LINE,
      lt_attachment      TYPE STANDARD TABLE OF solisti1  WITH HEADER LINE,
      lt_mailsubject     TYPE sodocchgi1,
      lt_packing_list    TYPE STANDARD TABLE OF sopcklsti1 WITH HEADER LINE,
      gv_cnt             TYPE i.

**Add Recipients
lt_mailrecipients-rec_type  = 'U'.
lt_mailrecipients-com_type  = 'INT'.
lt_mailrecipients-receiver  = 'sunrise_zeng@infosys.com'.
APPEND lt_mailrecipients .
CLEAR lt_mailrecipients .

**Put in the Mail Contents
lt_mailtxt = 'Hi How are you'.
APPEND lt_mailtxt.
CLEAR lt_mailtxt.
lt_mailtxt = 'Here is a test mail'.
APPEND lt_mailtxt.
CLEAR lt_mailtxt.
lt_mailtxt = 'Thanks'.
APPEND lt_mailtxt.
CLEAR lt_mailtxt.


**Create the attachment
DATA: BEGIN OF lt_po_data_cons OCCURS 0,
        ebeln LIKE ekpo-ebeln,
        ebelp LIKE ekpo-ebelp,
       END OF lt_po_data_cons.

SELECT ebeln ebelp INTO TABLE lt_po_data_cons
UP TO 10 ROWS
FROM ekpo.

CLASS cl_abap_char_utilities DEFINITION LOAD.
CONCATENATE 'PO' 'PO Line'
            INTO lt_attachment SEPARATED BY
            cl_abap_char_utilities=>horizontal_tab.
APPEND lt_attachment. CLEAR lt_attachment.

LOOP AT lt_po_data_cons.
  CONCATENATE lt_po_data_cons-ebeln lt_po_data_cons-ebelp
              INTO lt_attachment SEPARATED BY
              cl_abap_char_utilities=>horizontal_tab.

  CONCATENATE cl_abap_char_utilities=>newline lt_attachment
              INTO lt_attachment.

  APPEND lt_attachment. CLEAR lt_attachment.

ENDLOOP.


**Pack the mail contents and attachment
lt_packing_list-transf_bin  = space.
lt_packing_list-head_start  = 1.
lt_packing_list-head_num    = 0.
lt_packing_list-body_start  = 1.
lt_packing_list-body_num    = LINES( lt_mailtxt ).
lt_packing_list-doc_type    = 'RAW'.
APPEND lt_packing_list.
CLEAR lt_packing_list.

lt_packing_list-transf_bin  = 'X'.
lt_packing_list-head_start  = 1.
lt_packing_list-head_num    = 1.
lt_packing_list-body_start  = 1.
lt_packing_list-body_num    = LINES( lt_attachment ).
lt_packing_list-doc_type    = 'XLS'. " You can give RAW incase if you want just a txt file.
lt_packing_list-obj_name    = 'data.xls'.
lt_packing_list-obj_descr   = 'data.xls'.
lt_packing_list-doc_size    = lt_packing_list-body_num * 255.
APPEND lt_packing_list.
CLEAR lt_packing_list.

lt_mailsubject-obj_name     = 'MAILATTCH'.
lt_mailsubject-obj_langu    = sy-langu.
lt_mailsubject-obj_descr    = 'You have got mail'.
lt_mailsubject-sensitivty   = 'F'.
gv_cnt = LINES( lt_attachment ).
lt_mailsubject-doc_size     = ( gv_cnt - 1 ) * 255 + STRLEN(  lt_attachment ).

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
  EXPORTING
    document_data              = lt_mailsubject
  TABLES
    packing_list               = lt_packing_list
    contents_bin               = lt_attachment
    contents_txt               = lt_mailtxt
    receivers                  = lt_mailrecipients
  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 EQ 0.

  COMMIT WORK.

  SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.

ENDIF.

=====================================================================================

FU SO_NEW_DOCUMENT_ATT_SEND_API1
____________________________________________________
Short Text
SAPoffice: Send new document with attachments using RFC

Functionality
This function module enables you send a new document including any existing attachments. The document and the attachments are transferred in the same table. They are created when sent and can also be placed in the sender's outbox.

It is necessary to distinguish between the document and its folder entries. The document itself only exists in the database once. It is a template for the folder entries and can be addressed via its object ID. Any number of folder entries can belong to the document. The folder entries contain the attributes of the document as well as some additional attributes relating to the folder entry itself. (Send priority and expiry date of the entry, for example.) Folder entries are created when a document is resubmitted, referenced or sent as well as when a new document is created.

Import parameters
PUT_IN_OUTBOX

Default = ' '.

If this flag is activated ('X'), the newly created document is also placed in the outbox of the active user when it is sent.

COMMIT_WORK

Default = ' '.

If this flag is set ('X'), an explicit Commit Work is sent at the end of the function module SO_DOCUMENT_SEND_API1.

DOCUMENT_DATA

This structure must contain the attributes of the document to be sent.

OBJ_NAME
Name of document.

OBJ_DESCR
Title (short description) of document.

OBJ_LANGU
Language of document.

OBJ_SORT
Sort field of document. You can search for this term using attribute search.

OBJ_EXPDAT
Expiration date of document. The document itself cannot expire, but each time the document is entered in a folder, this date is used as the default for the expiration date of the entry (field EXPIRY_DAT).

SENSITIVTY
Document sensitivity.

A personal document can have the following levels of sensitivity:

'O' : Standard, normal sensitivity
'F' : Functional, can be forwarded functionally
'P' : Confidential, not visible to substitutes
For documents in shared folders, only sensitivity level 'O' is permitted.

OBJ_PRIO
Recipient priority. The document itself does not have a priority level, but each time the document is entered in a folder, this value is used as the default for recipient priority for the entry (field PRIORITY).

NO_CHANGE
If this flag is activated ('X'), documents in shared folders can only be changed by the author. The author can change documents in private folders after they have been sent.

PRIORITY
Recipient priority for the folder entry. This value gives the priority, which was assigned to the document by the owner, after receipt.

EXPIRY_DAT
Expiration date of the folder entry. When the expiration date has been reached or passed, the entry is placed in private trash and can be retrieved from there if needed, up until the next time the trash is emptied. A new folder entry is initially given the expiration date of the document from field OBJ_EXPDT.

PROC_TYPE
If this field does not contain the default value (default is ' '), the document can be processed.

The following entries are permitted:

'D' : Dialog module
'F' : Function module
'R' : Report
'S' : Report with transfer of values to global memory
'T' : Transaction
'U' : Transaction with transfer of values to global memory
PROC_NAME
Processing element. You must enter the name of the dialog module, function module, report or transaction in accordance with the entry in the field PROC_TYPE.

PROC_SYST
Name of sytem in which the document is to be processed. If no system is specified or '*' is entered, processing is possible in all systems.

PROC_CLINT
Client in which the document is to be processed. If no client is specified or '*' is entered, processing is possible in all clients.

SKIP_SCREN
If this flag is activated ('X'), the first screen is skipped during processing.

TO_DO_OUT
If this flag is activated ('X'), the document cannot be processed from the SAPoffice interface. You must use the API function module SO_DOCUMENT_SET_STATUS_API1.

FREE_DEL
Wenn dieses Flag gesetzt ('X') wird, kann das Dokument über die API auch in fremden Mappen gel?scht werden.

DOC_SIZE
Size of the document in bytes. For PC documents, the size of the relevant file should be entered, for RAW  and SCR documents the size is the "length of the last line" + "number of other lines multiplied by 255".

Export parameters
NEW_OBJECT_ID

Object ID of the document created during the send process.

SENT_TO_ALL

If this flag is activated ('X'), the document was sent to all specified recipients or, in the case of external forwarding, the corresponding send requests were delivered to the subsystem. If sending or delivery failed in one or more cases, the flag is not activated.

Table parameters
PACKING_LIST

This table requires information about how the data in the tables OBJECT_HEADER, CONTENTS_BIN and CONTENTS_TXT are to be distributed to the documents and its attachments. The first row is for the document, the following rows are each for one attachment.

TRANSF_BIN
If this flag is activated ('X'), the table entry describes an object stored in binary format. The content of the object is in the table CONTENTS_BIN. If the flag is not activated, the object content is in the table CONTENTS_TXT in ASCII format.

HEAD_START
Requires the start row of the table OBJECT_HEADER, as of which the specific header data of the object is stored.

HEAD_NUM
Requires the number of rows in the table OBJECT_HEADER that contain specific header data for the object. The relevant rows are arranged in a block and defined uniquely together with the entry in HEAD_START.

BODY_START
Requires the start row of the table dependent on the TRANSF_BIN flag as of which the object content is stored.

BODY_NUM
Requires the number of rows of the table dependent on the flag TRANSFER_BIN, which contain the object content. The relevant rows are arranged in a block and defined uniquely together with the entry in HEAD_START.

DOC_TYPE
Attachment type. In the first row of the table, this field is not used.

OBJ_NAME
Attachment name. In the first row of the table, this field is not used.

OBJ_DESCR
Attachment title (short description). In the first row of the table, this field is not used.

OBJ_LANGU
Attachment language. In the first row of the table, this fiels is not used.

DOC_SIZE
Attachment size in bytes. For PC objects, the size of the relevant file should be entered here. For RAW and SCR objects, the size is the "length of the last page" + "number of other rows multiplied by 255". In the first row of the table, this field is not used.

MESS_TYPE
This field is not used.

OBJECT_HEADER

This table must contain the summarized data dependent on each object type. SAPscript objects store information here about forms and styles, for example. Excel list viewer objects store the number of rows and columns amongst other things and PC objects store their original file name.

LINE
Requires the type-dependent data of the object line by line. The fields HEAD_START and HEAD_NUM in the table PACKING_LIST define which section belongs to which object.

CONTENTS_BIN

This table must contain the summarized content of the objects identified as binary objects.

LINE
Requires the object content line by line. The fields BODY_START and BODY_NUM in the table PACKING_LIST define which section belongs to which object.

CONTENTS_TXT

This table must contain the summarized content of the objects identified as ASCII objects.

LINE
Requires the object content line by line. The fiels BODY_START and BODY_NUM in the table PACKING_LIST define which section belongs to which object.

OBJECT_PARA

The table is only needed if the document to be sent is to be processed. The table must contain SET/GET parameters that are transferred to the processing element during processing.

It is not possible to transfer processing parameters to the document attachment.

NAME
Name of SET/GET parameter. Only the first three characters are used.

OPTION
This field is not used.

LOW
Contains the value of the parameter in NAME.

HIGH
This field is not used.

OBJECT_PARB

This table is only used by documents to which a particular processing type is assigned. The meaning of the table depends on the processing type. If the processing element is a report, or transaction with transfer of values to the global memory, the table content is interpreted as the quantity of parameters with the relevant values and exported to the memory ID taken from the first row. If the processing element is a function module or a dialog module, the table is transferred to this as table parameter MSGDIAL.

It is not possible to transfer processing parameters to the document attachments.

NAME
If the processing element is a report or a transaction with transfer of values to the global memory, the field of the first row of the table must contain the name of the memory ID used for the export. The fields of the other rows accommodate the parameter names. If the processing element is a function module or a dialog module, the fields must contain values corresponding to the use of the module.

VALUE
If the processing element is a report or a transaction with transfer of values to the global memory, the field for the first row of the table must remain empty. The fields for the other rows accommodate the values belonging to the parameters in NAME. If the processing element is a function or dialog module, the fields must contain values corresponding to the use of the modules.

RECEIVERS

This table must contain the document recipients.

RECEIVER
Name of recipient.

The following entry categories are possible:

SAP use name of the recipient
SAPoffice name of the recipient
Shared distribution list
Fax number in the form of structure SADRFD
Internet address in the form of structure SADRUD
Remote SAP name in the form of structure SADR7D
X.400 address in the form of structure SADR8D
ADR_TYPE
Type of RECEIVER entry.

The following values are permitted:

'B' : SAP user name
' ' : SAPoffice name
'C' : Shared distribution list
'F' : Fax number
'U' : Internet address
'R ' : Remote SAP name
'X' : X.400 address
REC_ID
If the recipient is a SAPoffice user, the user ID, instead of the recipient name in RECEIVER, can be entered in this field.

REPLY_DOC
If there is a value in this field, the document is a reply to the folder entry identified by the specified ID. A correspondance history is automatically created/continued.

REC_DATE
The date on which the document is to reach the recipient. This date cannot be guaranteed for external recipients, as it depends on connected products.

PROXY_ID
If automatic forwarding is active in the recipient's system, this field contains the SAP user ID or the address ID of the external address, to which the document was ultimately sent.

RETRN_CODE
When the recipient has received the document, the function module enters the value '0' in this field. If the document is not successfully recieved, a value unequal to '0' is entered in the field.

EXPRESS
If this flag is activated ('X'), the document is sent with the attribute 'express'. If the recipient is a logged-on SAPoffice user, he or she receives a message immediately, saying that he or she has received an express mail.

COPY
Wenn dieses Flag gesetzt ('X') wird, dann wird das Dokument mit dem Attribut 'Kopie' versendet.

BLIND_COPY
If this flag is activated ('X'), the document is sent with the attribute 'secret copy'. If the recipient is a SAPoffice user, he or she can neither print nor forward the document.

NO_FORWARD
If this flag is activated ('X') and the recipient is a SAPoffice user, he or she cannot forward the document.

NO_PRINT
If this flag is activated ('X') and the recipient is a SAPoffice user, he or she cannot print the document.

TO_ANSWER
If this flag is activated ('X') and the recipient is a SAPoffice user, the user must reply to the document before he or she can delete it from his or her inbox.

TO_DO_EXPL
If this flag is activated ('X') and the recipient is a SAPoffice user, the user must process the document before he or she can delete it from his or her inbox.

TO_DO_GRP
If this field contains a value between '1' and '9', a SAPoffice user in the recipient group indicated by this number must process the document, before the recipients can delete it from their inboxes. If the value '0' is entered, the document does not need to be processed.

COM_TYPE
Communication type used to send the document. This field is only relevant if the recipient is an address number, that is, if the document is sent externally via address management. If the field is empty, the standard communication type specified in address management is used.

The following values are permitted:

'INT' : Send via Internet
'FAX' : Send as a fax
'X40' : Send via X.400
'RML' : Send in another SAP system
LFDNR
Current number from address management. This field is only relevant if the recipient is an address number, that is, if the document is sent via address management. If the field is empty, the default current number in address management is used.

FAX
This field is not used.

COUNTRY
This field is not used.

SPOOL_ID
This field is not used.

NOTIF_DEL
If this flag is activated ('X'), the sender receives confirmation when the recipient receives the document. He or she also receives a message if the document could not be delivered. This flag should only be activated for external sending, since internal sending is synchronous. Confirmation is only supported by a small number of mail systems, however. For example: X.400 and SAP SAP.

NOTIF_READ
If this flag is activated ('X'), the sender is notified as soon as the recipient has read the document. This flag should only be activated for external sending, since internal sending is synchronous. Read notification is only supported by a small number of mail systems, however. For example: X.400 and SAP SAP.

NOTIF_NDEL
If this flag is activated ('X'), the recipient receives a message if the document could not be delivered to the recipient. This flag should only be activated for external sending, since internal sending is synchronous. The message is only supported by a small number of mail systems, however. For example: X.400 and SAP SAP.

SAP_BODY
If this flag is activated ('X'), SAP specific data is transferred to the document in an external body part when sending via X.400. This flag should only be activated if the target system is an SAP System.

Exceptions
TOO_MANY_RECEIVERS

Too many recipients were specified. The active user does not have authorization to send to this number of recipients.

DOCUMENT_NOT_SENT

The document could not be sent. It was not delivered to any of the specified recipients.

DOCUMENT_TYPE_NOT_EXIST

A document class assigned to the document or an attachment does not exist.

OPERATION_NO_AUTHORIZATION

The document was not allowed to be sent, because one of the required authorizations did not exist.

PARAMETER_ERROR

The combination of parameter values transferred to the function module was not a permitted combination.

X_ERROR

Am internal error or a data base inconsistency has occurred.

ENQUEUE_ERROR

A lock required for the send process could not be set. It is probable that another user is processing.

Example
Sending a new RAW document with a BMP attachment to an Internet address and a private distribution list.

REPORT  ZSSO_DOCUMENT_SEND_API1.


DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS  2 WITH HEADER LINE.

DATA: OBJHEAD LIKE SOLISTI1   OCCURS  1 WITH HEADER LINE.

DATA: OBJBIN  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE.

DATA: OBJTXT  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE.

DATA: RECLIST LIKE SOMLRECI1  OCCURS  5 WITH HEADER LINE.

DATA: DOC_CHNG LIKE SODOCCHGI1.

DATA: TAB_LINES LIKE SY-TABIX.


* Creating the document to be sent

DOC_CHNG-OBJ_NAME = 'OFFER'.

DOC_CHNG-OBJ_DESCR = 'Auction of a Picasso jr'.

OBJTXT = 'Reserve price : $250000'.

APPEND OBJTXT.

OBJTXT = 'A reproduction of the painting to be auctioned'.

APPEND OBJTXT.

OBJTXT = 'is enclosed as an attachment.'.

APPEND OBJTXT.

DESCRIBE TABLE OBJTXT LINES TAB_LINES.

READ TABLE OBJTXT INDEX TAB_LINES.

DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).

* Creating the entry for the compressed document

CLEAR OBJPACK-TRANSF_BIN.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM   = 0.

OBJPACK-BODY_START = 1.

OBJPACK-BODY_NUM   = TAB_LINES.

OBJPACK-DOC_TYPE   = 'RAW'.

APPEND OBJPACK.

* Creating the document attachment

* (Assume the data in OBJBIN are given in BMP format)

OBJBIN = ' /O/ '. APPEND OBJBIN.

OBJBIN = '  |  '. APPEND OBJBIN.

OBJBIN = ' / / '. APPEND OBJBIN.

DESCRIBE TABLE OBJBIN LINES TAB_LINES.

OBJHEAD = 'picasso.bmp'. APPEND OBJHEAD.

* Creating the entry for the compressed attachment

OBJPACK-TRANSF_BIN = 'X'.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM   = 1.

OBJPACK-BODY_START = 1.

OBJPACK-BODY_NUM   = TAB_LINES.

OBJPACK-DOC_TYPE   = 'BMP'.

OBJPACK-OBJ_NAME   = 'ATTACHMENT'.

OBJPACK-OBJ_DESCR = 'Reproduction object 138'.

OBJPACK-DOC_SIZE   = TAB_LINES * 255.

APPEND OBJPACK..

* Entering names in the distribution list

RECLIST-RECEIVER = 'guido.geldsack@money.com'.

RECLIST-REC_TYPE = 'U'.

APPEND RECLIST.

RECLIST-RECEIVER = 'DLI-NEUREICH'.

RECLIST-REC_TYPE = 'P'.

APPEND RECLIST.

* Sending the document

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

     EXPORTING

          DOCUMENT_DATA = DOC_CHNG

          PUT_IN_OUTBOX = 'X'

          COMMIT_WORK   = 'X'

     TABLES

          PACKING_LIST  = OBJPACK

          OBJECT_HEADER = OBJHEAD

          CONTENTS_BIN  = OBJBIN

          CONTENTS_TXT  = OBJTXT

          RECEIVERS     = RECLIST

     EXCEPTIONS

          TOO_MANY_RECEIVERS = 1

          DOCUMENT_NOT_SENT  = 2

          OPERATION_NO_AUTHORIZATION = 4

          OTHERS = 99.

CASE SY-SUBRC.

  WHEN 0.

    WRITE: / 'Result of the send process:'.

    LOOP AT RECLIST.

      WRITE: / RECLIST-RECEIVER(48), ':'.

      IF RECLIST-RETRN_CODE = 0.

        WRITE 'sent successfully'.

      ELSE.

        WRITE 'not sent'.

      ENDIF.

    ENDLOOP.

  WHEN 1.

    WRITE: / 'no authorization to send to the specified number of'              'recipients!'.

  WHEN 2.

    WRITE: / 'document could not be sent to any of the recipients!'.

  WHEN 4.

    WRITE: / 'no authorization to send !'.

  WHEN OTHERS.

    WRITE: / 'error occurred during sending !'.

ENDCASE.

 

Parameters
DOCUMENT_DATA
PUT_IN_OUTBOX
COMMIT_WORK
SENT_TO_ALL
NEW_OBJECT_ID
PACKING_LIST
OBJECT_HEADER
CONTENTS_BIN
CONTENTS_TXT
CONTENTS_HEX
OBJECT_PARA
OBJECT_PARB
RECEIVERS

Exceptions
TOO_MANY_RECEIVERS
DOCUMENT_NOT_SENT
DOCUMENT_TYPE_NOT_EXIST
OPERATION_NO_AUTHORIZATION
PARAMETER_ERROR
X_ERROR
ENQUEUE_ERROR

Function Group
SOI1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值