SAP Function Modules

SO_DOC_INSERT_WITH_ORIG_API1 SAP Function module - SAPoffice: Create new document with owner







SO_DOC_INSERT_WITH_ORIG_API1 is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name SO_DOC_INSERT_WITH_ORIG_API1 into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: SOI1
Released Date: 14.04.1998
Processing type: Remote-Enabled
remote enabled module settings


Pattern for FM SO_DOC_INSERT_WITH_ORIG_API1 - SO DOC INSERT WITH ORIG API1





CALL FUNCTION 'SO_DOC_INSERT_WITH_ORIG_API1' "SAPoffice: Create new document with owner
  EXPORTING
    folder_id =                 " soobjinfi1-object_id  ID of folder in which document is to be created
    document_data =             " sodocchgi2    Document attributes (general header)
    document_type =             " soodk-objtp   Document Class
    originator =                " soextreci1-receiver  Address of document owner
    originator_type =           " soextreci1-adr_typ  Type of address for document owner
*   iv_vsi_profile =            " vscan_profile  Virus Scan Profile
  IMPORTING
    document_info =             " sofolenti1    Complete attributes of document
* TABLES
*   object_header =             " solisti1      Header data for document (spec.header)
*   object_content =            " solisti1      Document Content
*   contents_hex =              " solix         Document contents (binary)
*   object_para =               " soparai1      SET/GET parameter for processing
*   object_parb =               " soparbi1      Fields and values for processing
*   et_vsi_error =              " bapiret2      Return Parameter(s)
  EXCEPTIONS
    OWNER_NOT_EXIST = 1         "               Specified owner does not exist
    FOLDER_NOT_EXIST = 2        "               Specified folder does not exist
    DOCUMENT_TYPE_NOT_EXIST = 3  "              Document type does not exist
    OPERATION_NO_AUTHORIZATION = 4  "           No authorization to create document
    PARAMETER_ERROR = 5         "               Invalid combination of parameter values
    X_ERROR = 6                 "               Internal error or database inconsistency
    ENQUEUE_ERROR = 7           "               Required locks could not be set
    .  "  SO_DOC_INSERT_WITH_ORIG_API1

ABAP code example for Function Module SO_DOC_INSERT_WITH_ORIG_API1





The ABAP code below is a full code listing to execute function module SO_DOC_INSERT_WITH_ORIG_API1 including all data declarations. The code uses the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).

DATA:
ld_document_info  TYPE SOFOLENTI1 ,
it_object_header  TYPE STANDARD TABLE OF SOLISTI1,"TABLES PARAM
wa_object_header  LIKE LINE OF it_object_header ,
it_object_content  TYPE STANDARD TABLE OF SOLISTI1,"TABLES PARAM
wa_object_content  LIKE LINE OF it_object_content ,
it_contents_hex  TYPE STANDARD TABLE OF SOLIX,"TABLES PARAM
wa_contents_hex  LIKE LINE OF it_contents_hex ,
it_object_para  TYPE STANDARD TABLE OF SOPARAI1,"TABLES PARAM
wa_object_para  LIKE LINE OF it_object_para ,
it_object_parb  TYPE STANDARD TABLE OF SOPARBI1,"TABLES PARAM
wa_object_parb  LIKE LINE OF it_object_parb ,
it_et_vsi_error  TYPE STANDARD TABLE OF BAPIRET2,"TABLES PARAM
wa_et_vsi_error  LIKE LINE OF it_et_vsi_error .


DATA(ld_folder_id) = some text here
DATA(ld_document_data) = 'Check type of data required'.

DATA(ld_document_type) = some text here

DATA(ld_originator) = some text here

DATA(ld_originator_type) = some text here
DATA(ld_iv_vsi_profile) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_object_header to it_object_header.

"populate fields of struture and append to itab
append wa_object_content to it_object_content.

"populate fields of struture and append to itab
append wa_contents_hex to it_contents_hex.

"populate fields of struture and append to itab
append wa_object_para to it_object_para.

"populate fields of struture and append to itab
append wa_object_parb to it_object_parb.

"populate fields of struture and append to itab
append wa_et_vsi_error to it_et_vsi_error. . CALL FUNCTION 'SO_DOC_INSERT_WITH_ORIG_API1' EXPORTING folder_id = ld_folder_id document_data = ld_document_data document_type = ld_document_type originator = ld_originator originator_type = ld_originator_type * iv_vsi_profile = ld_iv_vsi_profile IMPORTING document_info = ld_document_info * TABLES * object_header = it_object_header * object_content = it_object_content * contents_hex = it_contents_hex * object_para = it_object_para * object_parb = it_object_parb * et_vsi_error = it_et_vsi_error EXCEPTIONS OWNER_NOT_EXIST = 1 FOLDER_NOT_EXIST = 2 DOCUMENT_TYPE_NOT_EXIST = 3 OPERATION_NO_AUTHORIZATION = 4 PARAMETER_ERROR = 5 X_ERROR = 6 ENQUEUE_ERROR = 7 . " SO_DOC_INSERT_WITH_ORIG_API1
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 4. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 6. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 7. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_document_info  TYPE SOFOLENTI1 ,
ld_folder_id  TYPE SOOBJINFI1-OBJECT_ID ,
it_object_header  TYPE STANDARD TABLE OF SOLISTI1 ,
wa_object_header  LIKE LINE OF it_object_header,
ld_document_data  TYPE SODOCCHGI2 ,
it_object_content  TYPE STANDARD TABLE OF SOLISTI1 ,
wa_object_content  LIKE LINE OF it_object_content,
ld_document_type  TYPE SOODK-OBJTP ,
it_contents_hex  TYPE STANDARD TABLE OF SOLIX ,
wa_contents_hex  LIKE LINE OF it_contents_hex,
ld_originator  TYPE SOEXTRECI1-RECEIVER ,
it_object_para  TYPE STANDARD TABLE OF SOPARAI1 ,
wa_object_para  LIKE LINE OF it_object_para,
ld_originator_type  TYPE SOEXTRECI1-ADR_TYP ,
it_object_parb  TYPE STANDARD TABLE OF SOPARBI1 ,
wa_object_parb  LIKE LINE OF it_object_parb,
ld_iv_vsi_profile  TYPE VSCAN_PROFILE ,
it_et_vsi_error  TYPE STANDARD TABLE OF BAPIRET2 ,
wa_et_vsi_error  LIKE LINE OF it_et_vsi_error.


ld_folder_id = some text here

"populate fields of struture and append to itab
append wa_object_header to it_object_header.
ld_document_data = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_object_content to it_object_content.

ld_document_type = some text here

"populate fields of struture and append to itab
append wa_contents_hex to it_contents_hex.

ld_originator = some text here

"populate fields of struture and append to itab
append wa_object_para to it_object_para.

ld_originator_type = some text here

"populate fields of struture and append to itab
append wa_object_parb to it_object_parb.
ld_iv_vsi_profile = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_et_vsi_error to it_et_vsi_error.

SAP Documentation for FM SO_DOC_INSERT_WITH_ORIG_API1


This function module facilitates the creation of a new document in a specified folder. ...See here for full SAP fm documentation

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name SO_DOC_INSERT_WITH_ORIG_API1 or its description.