BAPI_DOCUMENT_CREATE2 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 BAPI_DOCUMENT_CREATE2 into the relevant SAP transaction such as SE37 or SE80.
Associated Function Group:
CVBAPI
Released Date:
25.03.1999
Processing type: Remote-Enabled
CALL FUNCTION 'BAPI_DOCUMENT_CREATE2' "
EXPORTING
documentdata = " bapi_doc_draw2 Document Data
* hostname = " bapi_doc_aux-hostname Name of Frontend
* docbomchangenumber = " bapi_doc_draw2-ecnumber Change Number
* docbomvalidfrom = " bapi_doc_draw2-validfromdate Valid-From Date
* docbomrevisionlevel = " bapi_doc_draw2-revlevel Revision level
* cad_mode = SPACE " csdata-xfeld CAD FLag for Document Structure
* pf_ftp_dest = SPACE " rfcdes-rfcdest Logical Destination (Specified in Function Call)
* pf_http_dest = SPACE " rfcdes-rfcdest Logical Destination (Specified in Function Call)
* defaultclass = 'X' " bapi_doc_aux-flag Uses class maintained in customization
IMPORTING
documenttype = " bapi_doc_aux-doctype Document Type
documentnumber = " bapi_doc_aux-docnumber Document Number
documentpart = " bapi_doc_aux-docpart Document Part
documentversion = " bapi_doc_aux-docversion Document Version
return = " bapiret2 Return Structure
* TABLES
* characteristicvalues = " bapi_characteristic_values Characteristic Value Assignments
* classallocations = " bapi_class_allocation Classifications
* documentdescriptions = " bapi_doc_drat Descriptions
* objectlinks = " bapi_doc_drad Object Links
* documentstructure = " bapi_doc_structure Document Structure
* documentfiles = " bapi_doc_files2 Originals
* longtexts = " bapi_doc_text Long Texts
* components = " bapi_doc_comp Additional Files for Originals (in future development)
. " BAPI_DOCUMENT_CREATE2
The ABAP code below is a full code listing to execute function module BAPI_DOCUMENT_CREATE2 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).
| ld_documenttype | TYPE BAPI_DOC_AUX-DOCTYPE , |
| ld_documentnumber | TYPE BAPI_DOC_AUX-DOCNUMBER , |
| ld_documentpart | TYPE BAPI_DOC_AUX-DOCPART , |
| ld_documentversion | TYPE BAPI_DOC_AUX-DOCVERSION , |
| ld_return | TYPE BAPIRET2 , |
| it_characteristicvalues | TYPE STANDARD TABLE OF BAPI_CHARACTERISTIC_VALUES,"TABLES PARAM |
| wa_characteristicvalues | LIKE LINE OF it_characteristicvalues , |
| it_classallocations | TYPE STANDARD TABLE OF BAPI_CLASS_ALLOCATION,"TABLES PARAM |
| wa_classallocations | LIKE LINE OF it_classallocations , |
| it_documentdescriptions | TYPE STANDARD TABLE OF BAPI_DOC_DRAT,"TABLES PARAM |
| wa_documentdescriptions | LIKE LINE OF it_documentdescriptions , |
| it_objectlinks | TYPE STANDARD TABLE OF BAPI_DOC_DRAD,"TABLES PARAM |
| wa_objectlinks | LIKE LINE OF it_objectlinks , |
| it_documentstructure | TYPE STANDARD TABLE OF BAPI_DOC_STRUCTURE,"TABLES PARAM |
| wa_documentstructure | LIKE LINE OF it_documentstructure , |
| it_documentfiles | TYPE STANDARD TABLE OF BAPI_DOC_FILES2,"TABLES PARAM |
| wa_documentfiles | LIKE LINE OF it_documentfiles , |
| it_longtexts | TYPE STANDARD TABLE OF BAPI_DOC_TEXT,"TABLES PARAM |
| wa_longtexts | LIKE LINE OF it_longtexts , |
| it_components | TYPE STANDARD TABLE OF BAPI_DOC_COMP,"TABLES PARAM |
| wa_components | LIKE LINE OF it_components . |
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_documenttype | TYPE BAPI_DOC_AUX-DOCTYPE , |
| ld_documentdata | TYPE BAPI_DOC_DRAW2 , |
| it_characteristicvalues | TYPE STANDARD TABLE OF BAPI_CHARACTERISTIC_VALUES , |
| wa_characteristicvalues | LIKE LINE OF it_characteristicvalues, |
| ld_documentnumber | TYPE BAPI_DOC_AUX-DOCNUMBER , |
| ld_hostname | TYPE BAPI_DOC_AUX-HOSTNAME , |
| it_classallocations | TYPE STANDARD TABLE OF BAPI_CLASS_ALLOCATION , |
| wa_classallocations | LIKE LINE OF it_classallocations, |
| ld_documentpart | TYPE BAPI_DOC_AUX-DOCPART , |
| ld_docbomchangenumber | TYPE BAPI_DOC_DRAW2-ECNUMBER , |
| it_documentdescriptions | TYPE STANDARD TABLE OF BAPI_DOC_DRAT , |
| wa_documentdescriptions | LIKE LINE OF it_documentdescriptions, |
| ld_documentversion | TYPE BAPI_DOC_AUX-DOCVERSION , |
| ld_docbomvalidfrom | TYPE BAPI_DOC_DRAW2-VALIDFROMDATE , |
| it_objectlinks | TYPE STANDARD TABLE OF BAPI_DOC_DRAD , |
| wa_objectlinks | LIKE LINE OF it_objectlinks, |
| ld_return | TYPE BAPIRET2 , |
| ld_docbomrevisionlevel | TYPE BAPI_DOC_DRAW2-REVLEVEL , |
| it_documentstructure | TYPE STANDARD TABLE OF BAPI_DOC_STRUCTURE , |
| wa_documentstructure | LIKE LINE OF it_documentstructure, |
| it_documentfiles | TYPE STANDARD TABLE OF BAPI_DOC_FILES2 , |
| wa_documentfiles | LIKE LINE OF it_documentfiles, |
| ld_cad_mode | TYPE CSDATA-XFELD , |
| ld_pf_ftp_dest | TYPE RFCDES-RFCDEST , |
| it_longtexts | TYPE STANDARD TABLE OF BAPI_DOC_TEXT , |
| wa_longtexts | LIKE LINE OF it_longtexts, |
| ld_pf_http_dest | TYPE RFCDES-RFCDEST , |
| it_components | TYPE STANDARD TABLE OF BAPI_DOC_COMP , |
| wa_components | LIKE LINE OF it_components, |
| ld_defaultclass | TYPE BAPI_DOC_AUX-FLAG . |
You can use this function module to create documents and all data that
belongs to it.
...See here for full SAP fm documentation
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 BAPI_DOCUMENT_CREATE2 or its description.