SAP Function SO_OLD_DOCUMENT_SEND_API1 - SAPoffice: Send existing document using RFC

Parameter Reference Type Length Default Optional Text
DOCUMENT_ID SOFOLENTI1-DOC_ID C 46 ID of document to be sent
PUT_IN_OUTBOX SONV-FLAG C 1 X Flag: Move document to outbox after send

Parameter Reference Type Length Text
SENT_TO_ALL SONV-FLAG C 1 Flag: Document sent to all

Parameter Reference Length Optional Text
RECEIVERS SOMLRECI1 1367 Document recipients with send attributes

Exception Text
DOCUMENT_NOT_EXIST Specified document does not exist
DOCUMENT_NOT_SENT Document not sent to any recipients
ENQUEUE_ERROR Required locks could not be set
OPERATION_NO_AUTHORIZATION No authorization to send document
PARAMETER_ERROR Invalid combination of parameter values
TOO_MANY_RECEIVER Too many recipients, no authorization
X_ERROR Internal error or database inconsistency

Functionality
This function module allows a document which already exists to be sentinternally and externally.

Import parameters
DOCUMENT_ID
ID of the folder entry of the document to be sent. This is theconnection between the document and the folder in which it is located.
PUT_IN_OUTBOX
Default = ' '.
If this flag is set ('X'), the document is also placed in the outbox ofthe active user when it is sent.

Export parameters
SENT_TO_ALL
If this flag is set ('X'), the document could be sent to all specifiedrecipients or the appropriate send requests made to a subsystem in thecase of external forwarding. If the document could not be sent to atleast one participant, the flag is not set.

Table parameters
RECEIVERS
This table must contain the recipients of the document.

  • RECEIVER

  • Name of the recipient.
    The following entry types are possible:
    the SAP user name of the recipient
    the SAPoffice name of the recipient
    a shared distribution list
    a fax number in the form of the stucture SADRFD
    an Internet address in the form of the structure SADRUD
    a remote SAP name in the form of the structure SADR7D
    an X.400 address in the form of the structure SADR8D
    • ADR_TYPE

    • Type of RECEIVER entry.
      The following values are allowed:
      '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 ID of the user can bespecified in this field instead of the recipient name in RECEIVER.
        • REPLY_DOC

        • If this field is filled, the document sent is regarded as a reply tothe folder entry identified by the ID specified. A correspondencehistory is set up and recorded automatically.
          • REC_DATE

          • Date on which the document is to reach the recipient. It is notpossible to guarantee that the document will be received on this date inthe case of external recipients since this depends on the behaviourof the products connected.
            • PROXY_ID

            • If automatic forwarding is active for the recipient of the document,this field contains the SAP user ID or the address ID of the externaladdress to which the document was finally sent.
              • RETRN_CODE

              • If the recipient has received the document, this field is filled by thefunction module with the value '0', otherwise a value which is notequal to '0' is entered.
                • EXPRESS

                • If this flag is set ('X'), the document is sent with the attribute'Express'. If the recipient is a logged on SAPoffice user, he/shereceives a message immediately stating that an express mail has beenreceived.
                  • COPY

                  • If this flag is set ('X'), the document is sent with the attribute'Copy'.
                    • BLIND_COPY

                    • If this flag is set ('X'), the document is sent with the attribute'Blind copy'. If the recipient is a SAPoffice user, he/she cannot printnor forward the document.
                      • NO_FORWARD

                      • If this flag is set ('X') and the recipient is a SAPoffice user, he/shecannot forward the document.
                        • NO_PRINT

                        • If this flag is set ('X') and the recipient is a SAPoffice user, he/shecannot print the document.
                          • TO_ANSWER

                          • If this flag is set ('X') and the recipient is a SAPoffice user, he/shemust send a reply to the document before it can be removed from theinbox.
                            • TO_DO_EXPL

                            • If this flag is set ('X') and the recipient is a SAPoffice user, he/shemust act upon the document before it can be removed from the inbox.
                              • TO_DO_GRP

                              • If this field has a value between '1' and '9', a SAPoffice user fromthe recipient group formed by this number must take action on thedocument before it can be removed from the inbox by the personsinvolved. If the value '0' is entered, it is not necessary to takeaction.
                                • COM_TYPE

                                • Communication method with which the document is to be sent. This fieldis only taken into account if the recipient is an address number, thatis if the document is sent externally via the address management. Ifthe field is not filled, the standard communication method specified inthe address management is used.
                                  The following values are allowed:
                                  'INT' : Send via Internet
                                  'FAX' : Send as fax
                                  'X40' : Send via X.400
                                  'RML' : Send to another SAP System
                                  • LFDNR

                                  • Sequential number from the address management. This field is only takeninto account if the recipient is an address number, that is ifthe document is sent via the address management. If the field is notfilled, the sequential number specified in the address management isused.
                                    • 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 set ('X'), the sender receives a confirmation as soonas the document has been delivered to the recipient. He/she alsoreceives a message if the document could not be delivered. This flagshould only be set if documents are sent externally since the processis carried out synchronously if documents are sent internally. However,the confirmation is only supported by a few mail systems such as X.400and SAP SAP.
                                            • NOTIF_READ

                                            • If this flag is set ('X'), the sender is notified as soon as therecipient has read the document. This flag should only be set ifdocuments are sent externally since the process is carried outsynchronously if documents are sent internally. However, the readconfirmation is only supported by a few mail systems such as X.400 andSAP SAP.
                                              • NOTIF_NDEL

                                              • If this flag is set ('X'), the recipient receives a message if thedocument could not be delivered to the recipient. This flag should onlybe set if documents are sent externally since the process is carriedout synchronously when documents are sent internally. However, themessage is only supported by a few mail systems such as X.400 and SAPSAP.
                                                • SAP_BODY

                                                • If this flag is set ('X'), the SAP-specific data is also sent in anexternal bodypart when the document is sent via X.400. However, thisshould only be done if the target system is an SAP System.

                                                  Exceptions
                                                  TOO_MANY_RECEIVERS
                                                  Too many recipients were specified. The active user is not authorizedto send to this number of recipients.
                                                  DOCUMENT_NOT_SENT
                                                  The document could not be sent. It was not delivered to any of thespecified recipients.
                                                  DOCUMENT_NOT_EXIST
                                                  The folder entry specified does not exist. An incorrect ID was probablypassed or the relevant folder entry has been deleted.
                                                  OPERATION_NO_AUTHORIZATION
                                                  The document could not be sent. One of the authorizations required ismissing.
                                                  PARAMETER_ERROR
                                                  An invalid combination of parameter values was passed to the functionmodule.
                                                  X_ERROR
                                                  An internal error or database inconsistency occurred.
                                                  ENQUEUE_ERROR
                                                  A lock required for the send operation could not be set. Processing isprobably being carried out by another user.

                                                  Example
                                                  Sending documents in the inbox of the active user to a specifiedInternet address. Documents with the attribute 'no forwarding' are notincluded. To determine the ID of the inbox, the function moduleSO_USER_READ_API1 is used, the contents of the inbox are read using thefunction module SO_FOLDER_READ_API1.
                                                  PARAMETERS: RECEIVER LIKE SOMLRECI1-RECEIVER.
                                                  DATA: FOL_CONT LIKE SOFOLENTI1 OCCURS 20 WITH HEADER LINE.
                                                  DATA: RECLIST LIKE SOMLRECI1 OCCURS 1 WITH HEADER LINE.
                                                  DATA: USER_DATA LIKE SOUDATAI1.
                                                  CALL FUNCTION 'SO_USER_READ_API1'
                                                  IMPORTING
                                                  USER_DATA = USER_DATA
                                                  EXCEPTIONS
                                                  OTHERS = 1.
                                                  IF SY-SUBRC <> 0.
                                                  WRITE: / 'User data could not be read !'.
                                                  EXIT.
                                                  ENDIF.
                                                  CALL FUNCTION 'SO_FOLDER_READ_API1'
                                                  EXPORTING
                                                  FOLDER_ID = USER_DATA-INBOXFOL
                                                  TABLES
                                                  FOLDER_CONTENT = FOL_CONT
                                                  EXCEPTIONS
                                                  OTHERS = 1.
                                                  IF SY-SUBRC <> 0.
                                                  WRITE: / 'Inbox could not be read !'.
                                                  EXIT.
                                                  ENDIF.
                                                  LOOP AT FOL_CONT WHERE BLIND_COPY IS INITIAL
                                                  AND NO_FORWARD IS INITIAL.
                                                  CLEAR RECLIST.
                                                  REFRESH RECLIST.
                                                  RECLIST-RECEIVER = RECEIVER.
                                                  RECLIST-REC_TYPE = 'U'.
                                                  APPEND RECLIST.
                                                  CALL FUNCTION 'SO_OLD_DOCUMENT_SEND_API1'
                                                  EXPORTING
                                                  DOCUMENT_ID = FOL_CONT-DOC_ID
                                                  TABLES
                                                  RECEIVERS = RECLIST
                                                  EXCEPTIONS
                                                  TOO_MANY_RECEIVERS = 1
                                                  DOCUMENT_NOT_SENT = 2
                                                  OPERATION_NO_AUTHORIZATION = 4
                                                  OTHERS = 99.
                                                  CASE SY-SUBRC.
                                                  WHEN 0.
                                                  WRITE: / 'Document', FOL_CONT-OBJ_DESCR, 'sent.'.
                                                  WHEN 1.
                                                  WRITE: / 'Too many recipients, document cannot be sent !'.
                                                  EXIT.
                                                  WHEN 2.
                                                  WRITE: / 'Document', FOL_CONT-OBJ_DESCR, 'not sent !'.
                                                  WHEN 4.
                                                  WRITE: / 'No authorization to send via Internet !'.
                                                  EXIT.
                                                  WHEN OTHERS.
                                                  WRITE: / 'Unexpected error occurred !'.
                                                  EXIT.
                                                  ENDCASE.
                                                  ENDLOOP.

                                                  Notes
                                                  To send a document which has not yet been created, the functionmodule SO_NEW_DOCUMENT_SEND_API1 must be used.
                                                  It is not possible to use the address name of a user as the recipientsince it is not necessarily unique. To avoid this problem, the functionmodule SO_NAME_CONVERT_API1 can be used. It returns a hit list for aspecified name, which is followed by a dialog when the value requiredis selected.

                                                  Further information
                                                  Information on calling the function modules SO_USER_READ_API1 andSO_FOLDER_READ_API1 can be found in the documentation of the respectivefunction modules.