BAPI_DOCUMENT_GETLATEST2 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_GETLATEST2 into the relevant SAP transaction such as SE37 or SE80.
Associated Function Group:
CVBAPI
Released Date:
Not Released
Processing type: Remote-Enabled
CALL FUNCTION 'BAPI_DOCUMENT_GETLATEST2' "
EXPORTING
documenttype = " bapi_doc_aux-doctype Document type
documentnumber = " bapi_doc_aux-docnumber Document number
documentpart = " bapi_doc_aux-docpart Documentation - text lines
documentversion = " bapi_doc_aux-docversion Document version
multilevelexplosion = 'X' " bapi_doc_aux-flag Document management indicator
* docbomchangenumber = SPACE " bapi_doc_draw2-ecnumber Change number
* docbomvalidfrom = SY-DATUM " bapi_doc_draw2-validfromdate Valid-From Date
* docbomrevisionlevel = SPACE " bapi_doc_draw2-revlevel Revision level
* loadlatest = 'X' " bapi_doc_aux-flag Document management indicator
* loadlatestreleased = 'X' " bapi_doc_aux-flag Document management indicator
* search_new_maindoc = SPACE " bapi_doc_aux-flag Document management indicator
* getdocdata = SPACE " bapi_doc_aux-flag Document management indicator
* getobjectlinks = SPACE " bapi_doc_aux-flag Document management indicator
* getdocdescriptions = SPACE " bapi_doc_aux-flag Document management indicator
* getlongtexts = SPACE " bapi_doc_aux-flag Document management indicator
* getstatuslog = SPACE " bapi_doc_aux-flag Document management indicator
* getdocfiles = SPACE " bapi_doc_aux-flag Document management indicator
* getcomponents = SPACE " bapi_doc_aux-flag Document management indicator
* getclassification = " bapi_doc_aux-flag Document Management Indicator
* getstructures = " bapi_doc_aux-flag Document Management Indicator
* getwhereused = " bapi_doc_aux-flag Document Management Indicator
* sortf_exclude = SPACE " stpox-sortf Sort string
* sortf_stop_expl = SPACE " stpox-sortf Sort string
* expl_docs_only_once = 'X' " bapi_doc_aux-flag Document management indicator
* stop_on_first_error = SPACE " bapi_doc_aux-flag Document Management Indicator
IMPORTING
return = " bapiret2 Return parameter
newversion = " bapi_doc_aux-docversion Document version
TABLES
docstructure = " stpox BOM Items (Extended for List Displays)
* changedversions = " tchg_vers Table for Transferring Changed Document Versions
* statuslist = " tstate_order Sequence of Status Check
* documentdata = " bapi_doc_draw2 BAPIS DMS: document data
* objectlinks = " bapi_doc_drad_keys BAPIS DMS: document data
* documentdescriptions = " bapi_doc_drat_keys BAPIS DMS: document data
* longtexts = " bapi_doc_text_keys BAPIS DMS: document data
* statuslog = " bapi_doc_drap_keys BAPIS DMS: document data
* documentfiles = " bapi_doc_files2_keys BAPIS DMS: document data
* components = " bapi_doc_comp_keys BAPIS DMS: document data
* all_returns = " bapiret2 Return Parameters
* characteristicvalues = " bapi_char_values_keys BAPI Structure for Characteristic Value Assignment (Docs)
* classallocations = " bapi_class_allocation_keys BAPI Structure for the Assignment of Classes to Several Objects
* documentstructures = " bapi_doc_structure_keys BAPIs DMS: Structure Data for Several Documents
* whereusedlists = " bapi_doc_structure_keys BAPIs DMS: Structure Data for Several Documents
. " BAPI_DOCUMENT_GETLATEST2
The ABAP code below is a full code listing to execute function module BAPI_DOCUMENT_GETLATEST2 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_return | TYPE BAPIRET2 , |
| ld_newversion | TYPE BAPI_DOC_AUX-DOCVERSION , |
| it_docstructure | TYPE STANDARD TABLE OF STPOX,"TABLES PARAM |
| wa_docstructure | LIKE LINE OF it_docstructure , |
| it_changedversions | TYPE STANDARD TABLE OF TCHG_VERS,"TABLES PARAM |
| wa_changedversions | LIKE LINE OF it_changedversions , |
| it_statuslist | TYPE STANDARD TABLE OF TSTATE_ORDER,"TABLES PARAM |
| wa_statuslist | LIKE LINE OF it_statuslist , |
| it_documentdata | TYPE STANDARD TABLE OF BAPI_DOC_DRAW2,"TABLES PARAM |
| wa_documentdata | LIKE LINE OF it_documentdata , |
| it_objectlinks | TYPE STANDARD TABLE OF BAPI_DOC_DRAD_KEYS,"TABLES PARAM |
| wa_objectlinks | LIKE LINE OF it_objectlinks , |
| it_documentdescriptions | TYPE STANDARD TABLE OF BAPI_DOC_DRAT_KEYS,"TABLES PARAM |
| wa_documentdescriptions | LIKE LINE OF it_documentdescriptions , |
| it_longtexts | TYPE STANDARD TABLE OF BAPI_DOC_TEXT_KEYS,"TABLES PARAM |
| wa_longtexts | LIKE LINE OF it_longtexts , |
| it_statuslog | TYPE STANDARD TABLE OF BAPI_DOC_DRAP_KEYS,"TABLES PARAM |
| wa_statuslog | LIKE LINE OF it_statuslog , |
| it_documentfiles | TYPE STANDARD TABLE OF BAPI_DOC_FILES2_KEYS,"TABLES PARAM |
| wa_documentfiles | LIKE LINE OF it_documentfiles , |
| it_components | TYPE STANDARD TABLE OF BAPI_DOC_COMP_KEYS,"TABLES PARAM |
| wa_components | LIKE LINE OF it_components , |
| it_all_returns | TYPE STANDARD TABLE OF BAPIRET2,"TABLES PARAM |
| wa_all_returns | LIKE LINE OF it_all_returns , |
| it_characteristicvalues | TYPE STANDARD TABLE OF BAPI_CHAR_VALUES_KEYS,"TABLES PARAM |
| wa_characteristicvalues | LIKE LINE OF it_characteristicvalues , |
| it_classallocations | TYPE STANDARD TABLE OF BAPI_CLASS_ALLOCATION_KEYS,"TABLES PARAM |
| wa_classallocations | LIKE LINE OF it_classallocations , |
| it_documentstructures | TYPE STANDARD TABLE OF BAPI_DOC_STRUCTURE_KEYS,"TABLES PARAM |
| wa_documentstructures | LIKE LINE OF it_documentstructures , |
| it_whereusedlists | TYPE STANDARD TABLE OF BAPI_DOC_STRUCTURE_KEYS,"TABLES PARAM |
| wa_whereusedlists | LIKE LINE OF it_whereusedlists . |
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_return | TYPE BAPIRET2 , |
| ld_documenttype | TYPE BAPI_DOC_AUX-DOCTYPE , |
| it_docstructure | TYPE STANDARD TABLE OF STPOX , |
| wa_docstructure | LIKE LINE OF it_docstructure, |
| ld_newversion | TYPE BAPI_DOC_AUX-DOCVERSION , |
| ld_documentnumber | TYPE BAPI_DOC_AUX-DOCNUMBER , |
| it_changedversions | TYPE STANDARD TABLE OF TCHG_VERS , |
| wa_changedversions | LIKE LINE OF it_changedversions, |
| ld_documentpart | TYPE BAPI_DOC_AUX-DOCPART , |
| it_statuslist | TYPE STANDARD TABLE OF TSTATE_ORDER , |
| wa_statuslist | LIKE LINE OF it_statuslist, |
| ld_documentversion | TYPE BAPI_DOC_AUX-DOCVERSION , |
| it_documentdata | TYPE STANDARD TABLE OF BAPI_DOC_DRAW2 , |
| wa_documentdata | LIKE LINE OF it_documentdata, |
| ld_multilevelexplosion | TYPE BAPI_DOC_AUX-FLAG , |
| it_objectlinks | TYPE STANDARD TABLE OF BAPI_DOC_DRAD_KEYS , |
| wa_objectlinks | LIKE LINE OF it_objectlinks, |
| ld_docbomchangenumber | TYPE BAPI_DOC_DRAW2-ECNUMBER , |
| it_documentdescriptions | TYPE STANDARD TABLE OF BAPI_DOC_DRAT_KEYS , |
| wa_documentdescriptions | LIKE LINE OF it_documentdescriptions, |
| ld_docbomvalidfrom | TYPE BAPI_DOC_DRAW2-VALIDFROMDATE , |
| it_longtexts | TYPE STANDARD TABLE OF BAPI_DOC_TEXT_KEYS , |
| wa_longtexts | LIKE LINE OF it_longtexts, |
| ld_docbomrevisionlevel | TYPE BAPI_DOC_DRAW2-REVLEVEL , |
| it_statuslog | TYPE STANDARD TABLE OF BAPI_DOC_DRAP_KEYS , |
| wa_statuslog | LIKE LINE OF it_statuslog, |
| ld_loadlatest | TYPE BAPI_DOC_AUX-FLAG , |
| it_documentfiles | TYPE STANDARD TABLE OF BAPI_DOC_FILES2_KEYS , |
| wa_documentfiles | LIKE LINE OF it_documentfiles, |
| it_components | TYPE STANDARD TABLE OF BAPI_DOC_COMP_KEYS , |
| wa_components | LIKE LINE OF it_components, |
| ld_loadlatestreleased | TYPE BAPI_DOC_AUX-FLAG , |
| ld_search_new_maindoc | TYPE BAPI_DOC_AUX-FLAG , |
| it_all_returns | TYPE STANDARD TABLE OF BAPIRET2 , |
| wa_all_returns | LIKE LINE OF it_all_returns, |
| it_characteristicvalues | TYPE STANDARD TABLE OF BAPI_CHAR_VALUES_KEYS , |
| wa_characteristicvalues | LIKE LINE OF it_characteristicvalues, |
| ld_getdocdata | TYPE BAPI_DOC_AUX-FLAG , |
| it_classallocations | TYPE STANDARD TABLE OF BAPI_CLASS_ALLOCATION_KEYS , |
| wa_classallocations | LIKE LINE OF it_classallocations, |
| ld_getobjectlinks | TYPE BAPI_DOC_AUX-FLAG , |
| it_documentstructures | TYPE STANDARD TABLE OF BAPI_DOC_STRUCTURE_KEYS , |
| wa_documentstructures | LIKE LINE OF it_documentstructures, |
| ld_getdocdescriptions | TYPE BAPI_DOC_AUX-FLAG , |
| it_whereusedlists | TYPE STANDARD TABLE OF BAPI_DOC_STRUCTURE_KEYS , |
| wa_whereusedlists | LIKE LINE OF it_whereusedlists, |
| ld_getlongtexts | TYPE BAPI_DOC_AUX-FLAG , |
| ld_getstatuslog | TYPE BAPI_DOC_AUX-FLAG , |
| ld_getdocfiles | TYPE BAPI_DOC_AUX-FLAG , |
| ld_getcomponents | TYPE BAPI_DOC_AUX-FLAG , |
| ld_getclassification | TYPE BAPI_DOC_AUX-FLAG , |
| ld_getstructures | TYPE BAPI_DOC_AUX-FLAG , |
| ld_getwhereused | TYPE BAPI_DOC_AUX-FLAG , |
| ld_sortf_exclude | TYPE STPOX-SORTF , |
| ld_sortf_stop_expl | TYPE STPOX-SORTF , |
| ld_expl_docs_only_once | TYPE BAPI_DOC_AUX-FLAG , |
| ld_stop_on_first_error | TYPE BAPI_DOC_AUX-FLAG . |
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_GETLATEST2 or its description.