SAP Function SO_DOC_INSERT_WITH_ORIG_API1 - SAPoffice: Create new document with owner

Parameter Reference Type Length Default Optional Text
DOCUMENT_DATA SODOCCHGI2 u 153 Document attributes (general header)
DOCUMENT_TYPE SOODK-OBJTP C 3 Document Class
FOLDER_ID SOOBJINFI1-OBJECT_ID C 17 ID of folder in which document is to be created
ORIGINATOR SOEXTRECI1-RECEIVER C 1215 Address of document owner
ORIGINATOR_TYPE SOEXTRECI1-ADR_TYP C 4 Type of address for document owner

Parameter Reference Type Length Text
DOCUMENT_INFO SOFOLENTI1 u 770 Complete attributes of document

Parameter Reference Length Optional Text
CONTENTS_HEX SOLIX 255 X Document contents (binary)
OBJECT_CONTENT SOLISTI1 255 X Document Content
OBJECT_HEADER SOLISTI1 255 X Header data for document (spec.header)
OBJECT_PARA SOPARAI1 92 X SET/GET parameter for processing
OBJECT_PARB SOPARBI1 285 X Fields and values for processing

Exception Text
DOCUMENT_TYPE_NOT_EXIST Document type does not exist
ENQUEUE_ERROR Required locks could not be set
FOLDER_NOT_EXIST Specified folder does not exist
OPERATION_NO_AUTHORIZATION No authorization to create document
OWNER_NOT_EXIST Specified owner does not exist
PARAMETER_ERROR Invalid combination of parameter values
X_ERROR Internal error or database inconsistency

Functionality
This function module facilitates the creation of a new document in aspecified folder.
Here the document and its folder entries must be differentiated. Thedocument itself exists once only in the database. It serves as atemplate for the folder entries and can be addressed by its object ID.Any number of folder entries can belong to the document. These havethe content and attributes of the document as well as some additionalattributes related to the folder entry. These include, for example,the send priority and expiration date of the entry. Folder entriesresult when a document is resubmitted, sent or a link to the documentis created or when a new document is created.

Import parameters
FOLDER_ID
Object ID of the folder in which the document is to be created.
DOCUMENT_TYPE
Type of document. Distribution lists ('DLI') und folders ('FOL')cannot be created via this function module.
DOCUMENT_DATA
This structure must contain the attributes of the document to becreated. Values in the fields of the attributes belonging to thedocument have an effect on every future folder entry, whereasspecifications in the fields relating to the entry only effect thefolder entry which is automatically generated by the creation of thedocument.

  • OBJ_NAME

  • Document name.
    • OBJ_DESCR

    • Document title (brief description).
      • OBJ_LANGU

      • Document language.
        • OBJ_SORT

        • Document sort field. This term can be searched for in the attributesearch.
          • OBJ_EXPDAT

          • Document expiration date. The document itself cannot expire, however,
            for every new folder entry of the document this date is used as areference for the expiration date of the entry (field EXPIRY_DAT).
            • SENSITIVTY

            • Document sensitivity.
              A private document can have the following sensitivity:
              'O' : Standard, normal sensitivity
              'F' : Functional, can be forwarded functionally
              'P' : Confidential, not visible for substitutes
              For documents in shared folders only sensitivity 'O' is allowed.
              • OBJ_PRIO

              • Recipient priority. The document itself does not have a priority,however, for every new folder entry of the document this value is usedas a reference for the recipient priority of the entry (fieldPRIORITY).
                • NO_CHANGE

                • If this flag is set ('X'), the document can only be changed by theauthor via shared folder entries. For private folder entries theauthor can still make changes even after the document has been sent.
                  • PRIORITY

                  • Recipient priority of the folder entry. This value repeats theimportance assigned to the entry by the owner after the document hasbeen received.
                    • EXPIRY_DAT

                    • Expiration date of folder entry. If the expiration date is reached oris exceeded, the entry is put in private trash and, is necessary, canbe retrieved from there before it is next emptied. A new folder entryis supplied initially with the expiration date of the document from thefield OBJ_EXPDAT.
                      • PROC_TYPE

                      • If this is not the initial field (unequal ' '), the document can beprocessed.
                        The following specifications are allowed:
                        'D' : Dialog module
                        'F' : Function module
                        'R' : Report
                        'S' : Report with transfer of values into the global memory
                        'T' : Transaction
                        'U' : Transaction with transfer of values into the global memory
                        • PROC_NAME

                        • Processing element. The name of the dialog module, function module,report or transaction must be specified in accordance with thespecification in the field PROC_TYPE.
                          • PROC_SYST

                          • Name of the system in which the document is to be processed. If nosystem or the value '*' is specified, processing is possible in everysystem.
                            • PROC_CLINT

                            • Client in which the document is to be processed. If no client or thevalue '*' is specified, processing is possible in every system.
                              • SKIP_SCREN

                              • If this flag is set ('X'), the first screen is skipped when processing.
                                • TO_DO_OUT

                                • If this flag is set ('X'), the document cannot be processed from theSAPoffice interface. It must be processed outside of SAPoffice via theAPI function module SO_DOCUMENT_SET_STATUS_API1.
                                  • FREE_DEL

                                  • If this flag is set ('X'), the document can also be deleted via the APIin external folders.
                                    • DOC_SIZE

                                    • Size of document in bytes. For PC documents the size of the respectivefile should be entered, for RAW and SCR documents the size iscalculated by "length of the last line" + "number of remaining linesmultiplied by 255".

                                      Export parameters
                                      DOCUMENT_INFO
                                      This structure contains the attributes of the document after it hasbeen created.

                                      • DOC_ID

                                      • Folder entry ID of the document to be changed. It contains theconnection between the document and the folder that it is in.
                                        • OBJECT_ID

                                        • Object ID of the document.
                                          • OBJ_TYPE

                                          • Document type.
                                            • OBJ_NAME

                                            • Document name.
                                              • OBJ_DESCR

                                              • Document title (brief description).
                                                • OBJ_LANGU

                                                • Document language.
                                                  • OBJ_SORT

                                                  • Document sort field. This term can be searched for in the attributesearch.
                                                    • CREATOR_ID

                                                    • SAPoffice ID of the document creator.
                                                      • CREAT_NAME

                                                      • SAPoffice name of the document creator. The SAPoffice name is uniquefor the whole client.
                                                        • CREAT_FNAM

                                                        • Full name of the document creator from address management.
                                                          • CREAT_DATE

                                                          • Document creation date.
                                                            • CREAT_TIME

                                                            • Document creation time.
                                                              • CHANGE_ID

                                                              • SAPoffice ID of the last changer of the document.
                                                                • CHANG_NAME

                                                                • SAPoffice name of the last changer of the document. The SAPoffice nameis unique for the whole client.
                                                                  • CHANG_FNAM

                                                                  • Full name of the last changer of the document from address management.
                                                                    • CHANG_DATE

                                                                    • Last change date.
                                                                      • CHANG_TIME

                                                                      • Last change time.
                                                                        • OWNER_ID

                                                                        • SAPoffice ID of document owner.
                                                                          • OWNER_NAM

                                                                          • SAPoffice name of document owner. The SAPoffice name is unique for thewhole client.
                                                                            • OWNER_FNAM

                                                                            • Full name of the document owner from address management.
                                                                              • LAST_ACCES

                                                                              • Document creation/change date. Contains the newer of the two values.
                                                                                • OBJ_EXPDAT

                                                                                • Document expiration date. The document itself cannot expire, however,for every new folder entry of the document this date is used as areference for the expiration date of the entry (field EXPIRY_DATE).
                                                                                  • SENSITIVTY

                                                                                  • Document sensitivity.
                                                                                    A private document can have the following sensitivity:
                                                                                    'O' : Standard, normal sensitivity
                                                                                    'F' : Functional, can be forwarded functionally.
                                                                                    'P' : Confidential, not visible for substitutes
                                                                                    For documents in shared folders only the sensitivity 'O' is allowed.
                                                                                    • OBJ_PRIO

                                                                                    • Recipient priority. The document itself does not have a priority,however, for every new folder entry of the document this value is usedas a reference for the expiration date of the entry (fieldEXPIRY_DATE).
                                                                                      • NO_CHANGE

                                                                                      • If this flag is set ('X'), the document can only be changed by theauthor via shared folder entries. For private folder entries theauthor can still make changes even after the document has been sent.
                                                                                        • PRIORITY

                                                                                        • Recipient priority of the folder entry. This value repeats theimportance assigned to the entry by the owner after the document hasbeen received.
                                                                                          • HISTORY

                                                                                          • If this flag is set ('X'), the document has a correspondence history.
                                                                                            • RESUB

                                                                                            • If this is not the initial field (unequal ' '), the folder entry is aresubmitted document.
                                                                                              • RESUB_DATE

                                                                                              • Resubmission date.
                                                                                                • SENDER_ID

                                                                                                • If the document was sent internally this field contains the SAPofficeID of the sender, if it was received from an external sender theaddress ID of the sender is entered.
                                                                                                  • SEND_NAM

                                                                                                  • If the document was sent internally this field contains the SAPofficename of the sender, if it was received from an external sender the nameof the address ID of the sender is entered.
                                                                                                    • SEND_FNAM

                                                                                                    • If the document was sent internally, this field contains the full nameof the sender from address management. If the document was receivedfrom an external sender an exact as possible description of the addressof the sender is entered.
                                                                                                      • SEND_DATE

                                                                                                      • Date of send operation.
                                                                                                        • SEND_TIME

                                                                                                        • Time of send operation.
                                                                                                          • FORWARD_ID

                                                                                                          • SAPoffice ID of forwarder of document.
                                                                                                            • FORW_NAM

                                                                                                            • SAPoffice name of forwarder of document. The SAPoffice name is uniquefor the whole client.
                                                                                                              • FORW_FNAM

                                                                                                              • Full name of the forwarder of the document from address management.
                                                                                                                • FORW_DATE

                                                                                                                • Date of forwarding.
                                                                                                                  • FORW_TIME

                                                                                                                  • Time of forwarding.
                                                                                                                    • REC_ID

                                                                                                                    • If the document was sent internally this field contains the SAPofficeID of the recipient, if it was sent externally the address ID of therecipient is entered.
                                                                                                                      • REC_NAM

                                                                                                                      • If the document was sent internally this field contains the SAPofficename of the recipient, if it was sent externally the name of theaddress ID of the recipient is entered.
                                                                                                                        • REC_FNAM

                                                                                                                        • If the document was sent internally this field contains the full nameof the recipient from address management. For documents sentexternally an exact as possible description of the address of therecipient is entered.
                                                                                                                          • REC_DATE

                                                                                                                          • Date received.
                                                                                                                            • REC_TIME

                                                                                                                            • Time document received.
                                                                                                                              • EXPRESS

                                                                                                                              • If this flag is set ('X'), the document was received with the attribute'express'.
                                                                                                                                • COPY

                                                                                                                                • If this flag is set ('X'), the document was received with the attribute'copy'.
                                                                                                                                  • BLIND_COPY

                                                                                                                                  • If this flag is set ('X'), the document was received with the attribute'blind copy'. As a result it can be neither printed nor forwarded.
                                                                                                                                    • NO_FORWARD

                                                                                                                                    • If this flag is set ('X'), the document cannot be forwarded by therecipient.
                                                                                                                                      • NO_PRINT

                                                                                                                                      • If this flag is set ('X'), the document cannot be printed by therecipient.
                                                                                                                                        • TO_ANSWER

                                                                                                                                        • If this flag is set ('X'), the recipient must reply to the documentbefore they can delete the corresponding folder entry from their inbox.
                                                                                                                                          • TO_DO_EXPL

                                                                                                                                          • If this flag is set ('X'), the recipient must process the documentbefore they can delete the corresponding folder entry from their inbox.
                                                                                                                                            • TO_DO_GRP

                                                                                                                                            • If this field has a value between '1' and '9', a user of the recipientgroup connected by this number must process the document before thecorresponding folder entry can be deleted from one of the affectedinboxes. If the value '0' is entered, it is not necessary to processthe document.
                                                                                                                                              • C_TO_DO

                                                                                                                                              • Number of recipients who must process the document.
                                                                                                                                                • C_IN_PROC

                                                                                                                                                • Number of recipients who are processing the document.
                                                                                                                                                  • C_DONE

                                                                                                                                                  • Number of recipients who have processed the document.
                                                                                                                                                    • C_EXPRESS

                                                                                                                                                    • Number of recipients who have received the document with the attribute'express'.
                                                                                                                                                      • C_COPY

                                                                                                                                                      • Number of recipients who have received the document with the attribute'copy'.
                                                                                                                                                        • C_BLIND_CP

                                                                                                                                                        • Number of recipients who have received the document with the attribute'blind copy'.
                                                                                                                                                          • C_TO_REPLY

                                                                                                                                                          • Number of recipients who must reply to the document.
                                                                                                                                                            • C_ANSWERED

                                                                                                                                                            • Number of recipients who have replied to the document.
                                                                                                                                                              • C_READ

                                                                                                                                                              • Number of recipients who have read the document.
                                                                                                                                                                • C_RECEIVER

                                                                                                                                                                • Number of people who have received the document visible for allrecipients. In order to receive the total number of recipients, thenumber of blind copies in C_BLIND_CP must be added to this number.
                                                                                                                                                                  • PROC_TYPE

                                                                                                                                                                  • If this is not the initial field (unequal ' '), the document can beprocessed.
                                                                                                                                                                    The following values are possible:
                                                                                                                                                                    'D' : Dialog module
                                                                                                                                                                    'F' : Function module
                                                                                                                                                                    'R' : Report
                                                                                                                                                                    'S' : Report with transfer of values into the global memory
                                                                                                                                                                    'T' : Transaction
                                                                                                                                                                    'U' : Transaction with transfer of values into the global memory
                                                                                                                                                                    • PROC_NAME

                                                                                                                                                                    • Processing element. The name of the dialog module, function module,report or transaction is specified in accordance with the specificationin the field PROC_TYPE.
                                                                                                                                                                      • PROC_SYST

                                                                                                                                                                      • Name of the system in which the document is to be processed. If nosystem or the value '*' is specified, processing is possible in everysystem.
                                                                                                                                                                        • PROC_CLINT

                                                                                                                                                                        • Client in which the document is to be processed. If no client or thevalue '*' is specified, processing is possible in every client.
                                                                                                                                                                          • SKIP_SCREN

                                                                                                                                                                          • If this flag is set ('X'), the first screen is skipped when processing.
                                                                                                                                                                            • TO_DO_OUT

                                                                                                                                                                            • If this flag is set ('X'), the document cannot be processed from theSAPoffice interface. It must be processed outside of the SAPoffice viathe API function module SO_DOCUMENT_SET_STATUS_API1.
                                                                                                                                                                              • FREE_DEL

                                                                                                                                                                              • If this flag is set ('X'), the document can also be deleted via the APIin external folders.
                                                                                                                                                                                • READ

                                                                                                                                                                                • If the folder entry is a received document and this flag is set ('X'),it has already been read.
                                                                                                                                                                                  • READ_DATE

                                                                                                                                                                                  • Date on which the document was read.
                                                                                                                                                                                    • READ_TIME

                                                                                                                                                                                    • Time at which the document was read.
                                                                                                                                                                                      • TO_DO_STAT

                                                                                                                                                                                      • Status of folder entry with regard to processing.
                                                                                                                                                                                        The following values are possible:
                                                                                                                                                                                        'TAAC' : still ToDo
                                                                                                                                                                                        'INPR' : in process
                                                                                                                                                                                        'ACCO' : processed
                                                                                                                                                                                        • STILL_TODO

                                                                                                                                                                                        • If this flag is set ('X'), the folder entry must still be processed.
                                                                                                                                                                                          • REPLY_SENT

                                                                                                                                                                                          • If this flag is set ('X'), the folder entry has already been repliedto.
                                                                                                                                                                                            • RESUB_READ

                                                                                                                                                                                            • If this flag is set ('X'), the folder entry is a resubmitted documentthat has already be read.
                                                                                                                                                                                              • EXPIRY_DAT

                                                                                                                                                                                              • Expiration date of the folder entry. If the expiration date is reachedor is exceeded, the entry is put in private trash and, if necessary,can be retrieved from there before it is next emptied. A new folderentry is initially supplied with the expiration date of the documentfrom the field OBJ_EXPDAT.
                                                                                                                                                                                                • DOC_SIZE

                                                                                                                                                                                                • Size of the document in bytes.

                                                                                                                                                                                                  Table parameters
                                                                                                                                                                                                  OBJECT_HEADER
                                                                                                                                                                                                  This table must contain the data that is dependent on the documenttype. Store SAPscript documents here, for example, information aboutforms and style, Excel Listviewer documents including the number oflines and columns, and PC documents of their original file names.

                                                                                                                                                                                                  • LINE

                                                                                                                                                                                                  • Requires the type-dependent information of the document by row.
                                                                                                                                                                                                    OBJECT_CONTENT
                                                                                                                                                                                                    This table must contain the actual content of the document.
                                                                                                                                                                                                    • LINE

                                                                                                                                                                                                    • Requires the content of the document by row.
                                                                                                                                                                                                      OBJECT_PARA
                                                                                                                                                                                                      This document is only used by documents which are to be processed. Itmust contain the SET/GET parameters which will transfer to theprocessing element.
                                                                                                                                                                                                      • NAME

                                                                                                                                                                                                      • Name of the SET/GET parameter. Only the first three characters areused.
                                                                                                                                                                                                        • OPTION

                                                                                                                                                                                                        • This field is not used.
                                                                                                                                                                                                          • LOW

                                                                                                                                                                                                          • Requires the corresponding 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 processingtype is assigned. Depending on this, they have a differentsignificance. If the processing element is a report or a transactionwith transfer of values into the global memory, the table content isinterpreted as an number of parameters with corresponding values andexported to the memory ID taken from the first line. If the processingelement is a function module or a dialog module, the table istransferred to this as the table parameter MSGDIAL.
                                                                                                                                                                                                              • NAME

                                                                                                                                                                                                              • If the processing element is a report or a transaction with transfer ofvalues into the global memory, the field of the first table line mustcontain the name of the memory ID used for the export. The fields ofthe remaining lines are for the names of the parameters. If theprocessing element is a function module or a dialog module, the fieldsmust be appropriately supplied in accordance with the purpose.
                                                                                                                                                                                                                • VALUE

                                                                                                                                                                                                                • If the processing element is a report or a transaction with transfer ofvalues into the global memory, the field of the first table line mustremain empty. The fields of the remaining lines are for the valuescorresponding to the parameters in NAME. If the processing element isa function module or a dialog module, the fields must be appropriatelysupplied in accordance with the purpose.

                                                                                                                                                                                                                  Exceptions
                                                                                                                                                                                                                  FOLDER_NOT_EXIST
                                                                                                                                                                                                                  The specified folder does not exist. The wrong ID was probably enteredor the affected folder was deleted in the meantime.
                                                                                                                                                                                                                  DOCUMENT_TYPE_NOT_EXIST
                                                                                                                                                                                                                  The specified document type does not exist or is not allowed.
                                                                                                                                                                                                                  OPERATION_NO_AUTHORIZATION
                                                                                                                                                                                                                  The specified document cannot be created. The reason for this may, forexample, be that it was to be created in the private folder area of adifferent user or in a shared folder for which the active user has noauthorization to create.
                                                                                                                                                                                                                  PARAMETER_ERROR
                                                                                                                                                                                                                  An invalid combination of parameter values was transferred to thefunction module. The reason for this may, for example, be that aninvalid value was tranferred as a priority, sensitivity or processingparameter. In some areas (inbox, resubmissions, trash) it is also notpossible to create documents.
                                                                                                                                                                                                                  ENQUEUE_ERROR
                                                                                                                                                                                                                  The specified folder could not be locked. It is probably currentlybeing processed by another user.

                                                                                                                                                                                                                  Example
                                                                                                                                                                                                                  In the outbox of the active user a private document is being created.The outbox ID is determined via the function module SO_USER_READ_API1.
                                                                                                                                                                                                                  DATA: OBJCONT LIKE SOLISTI1 OCCURS 5 WITH HEADER LINE.
                                                                                                                                                                                                                  DATA: USER_DATA LIKE SOUDATAI1.
                                                                                                                                                                                                                  DATA: DOC_CHNG LIKE SODOCCHGI1.
                                                                                                                                                                                                                  DATA: ENTRIES LIKE SY-TABIX.
                                                                                                                                                                                                                  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.
                                                                                                                                                                                                                  DOC_CHNG-OBJ_NAME = 'PRIVAT'.
                                                                                                                                                                                                                  DOC_CHNG-OBJ_DESCR = 'My private document'.
                                                                                                                                                                                                                  DOC_CHNG-LANGU = SY_LANGU.
                                                                                                                                                                                                                  DOC_CHNG-SENSITIVTY = 'P'.
                                                                                                                                                                                                                  OBJCONT = 'Everything user-created'.
                                                                                                                                                                                                                  APPEND OBJCONT.
                                                                                                                                                                                                                  OBJCONT = 'Noone else has access to it!'
                                                                                                                                                                                                                  APPEND OBJCONT.
                                                                                                                                                                                                                  DESCRIBE TABLE OBJCONT LINES ENTRIES.
                                                                                                                                                                                                                  READ TABLE OBJCONT INDEX ENTRIES.
                                                                                                                                                                                                                  DOC_CHNG-DOC_SIZE = ( ENTRIES - 1 ) * 255 + STRLEN( OBJCONT ).
                                                                                                                                                                                                                  CALL FUNCTION 'SO_DOCUMENT_INSERT_API1'
                                                                                                                                                                                                                  EXPORTING
                                                                                                                                                                                                                  FOLDER_ID = USER_DATA-OUTBOXFOL
                                                                                                                                                                                                                  DOCUMENT_TYPE = 'RAW'
                                                                                                                                                                                                                  DOCUMENT_DATA = DOC_CHNG
                                                                                                                                                                                                                  TABLES
                                                                                                                                                                                                                  OBJECT_CONTENT = OBJCONT
                                                                                                                                                                                                                  EXCEPTIONS
                                                                                                                                                                                                                  OTHERS = 1.
                                                                                                                                                                                                                  CASE SY-SUBRC.
                                                                                                                                                                                                                  WHEN 0.
                                                                                                                                                                                                                  WRITE: / 'Document successfully created!'.
                                                                                                                                                                                                                  WHEN 1.
                                                                                                                                                                                                                  WRITE: / 'Error when creating document!'.
                                                                                                                                                                                                                  ENDCASE.

                                                                                                                                                                                                                  Notes
                                                                                                                                                                                                                  The function modules SO_FOLDER_INSERT_API1 or SO_DLI_INSERT_API1 mustbe used for creating folders or distribution lists.

                                                                                                                                                                                                                  Further information
                                                                                                                                                                                                                  Information on calling-up the function module SO_USER_READ_API1 can befound in the documentation on this function module.