SAP Function Modules

API_DOCUMENT_CREATEFROMSRC2 SAP Function module







API_DOCUMENT_CREATEFROMSRC2 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 API_DOCUMENT_CREATEFROMSRC2 into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: CVBAPI
Released Date: Not Released
Processing type: Remote-Enabled
remote enabled module settings


Pattern for FM API_DOCUMENT_CREATEFROMSRC2 - API DOCUMENT CREATEFROMSRC2





CALL FUNCTION 'API_DOCUMENT_CREATEFROMSRC2' "
  EXPORTING
    refdocumenttype =           " bapi_doc_aux-doctype
    refdocumentnumber =         " bapi_doc_aux-docnumber
    refdocumentpart =           " bapi_doc_aux-docpart
    refdocumentversion =        " bapi_doc_aux-docversion
*   newdocumenttype =           " bapi_doc_aux-doctype
    newdocumentnumber =         " bapi_doc_aux-docnumber
    newdocumentpart =           " bapi_doc_aux-docpart
    newdocumentversion =        " bapi_doc_aux-docversion
*   newdescription =            " bapi_doc_draw2-description
*   statusintern =              " bapi_doc_draw-statusintern
*   statusextern =              " bapi_doc_draw-statusextern
*   statuslog =                 " bapi_doc_draw-statuslog
*   revlevel =                  " bapi_doc_draw2-revlevel
*   aennr =                     " bapi_doc_draw2-ecnumber
*   copyclassification =        " bapi_doc_aux-flag
*   copyoriginals = 'X'         " bapi_doc_aux-flag
*   copydocbom = 'X'            " bapi_doc_aux-flag
*   docbomchangenumberread =    " bapi_doc_draw2-ecnumber
*   docbomvalidfromread =       " bapi_doc_draw2-validfromdate
*   docbomrevlevelread =        " bapi_doc_draw2-revlevel
*   docbomchangenumberwrite =   " bapi_doc_draw2-ecnumber
*   docbomvalidfromwrite =      " bapi_doc_draw2-validfromdate
*   docbomrevlevelwrite =       " bapi_doc_draw2-revlevel
  IMPORTING
    doctype =                   " bapi_doc_aux-doctype
    docnumber =                 " bapi_doc_aux-docnumber
    docpart =                   " bapi_doc_aux-docpart
    docversion =                " bapi_doc_aux-docversion
    return =                    " bapiret2
* TABLES
*   copyobjectlinks =           " bapi_doc_drad_select
    .  "  API_DOCUMENT_CREATEFROMSRC2

ABAP code example for Function Module API_DOCUMENT_CREATEFROMSRC2





The ABAP code below is a full code listing to execute function module API_DOCUMENT_CREATEFROMSRC2 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_doctype  TYPE BAPI_DOC_AUX-DOCTYPE ,
ld_docnumber  TYPE BAPI_DOC_AUX-DOCNUMBER ,
ld_docpart  TYPE BAPI_DOC_AUX-DOCPART ,
ld_docversion  TYPE BAPI_DOC_AUX-DOCVERSION ,
ld_return  TYPE BAPIRET2 ,
it_copyobjectlinks  TYPE STANDARD TABLE OF BAPI_DOC_DRAD_SELECT,"TABLES PARAM
wa_copyobjectlinks  LIKE LINE OF it_copyobjectlinks .


DATA(ld_refdocumenttype) = some text here

DATA(ld_refdocumentnumber) = some text here

DATA(ld_refdocumentpart) = some text here

DATA(ld_refdocumentversion) = some text here

DATA(ld_newdocumenttype) = some text here

DATA(ld_newdocumentnumber) = some text here

DATA(ld_newdocumentpart) = some text here

DATA(ld_newdocumentversion) = some text here

DATA(ld_newdescription) = some text here

DATA(ld_statusintern) = some text here

DATA(ld_statusextern) = some text here

DATA(ld_statuslog) = some text here

DATA(ld_revlevel) = some text here

DATA(ld_aennr) = some text here

DATA(ld_copyclassification) = some text here

DATA(ld_copyoriginals) = some text here

DATA(ld_copydocbom) = some text here

DATA(ld_docbomchangenumberread) = some text here

DATA(ld_docbomvalidfromread) = 20210129

DATA(ld_docbomrevlevelread) = some text here

DATA(ld_docbomchangenumberwrite) = some text here

DATA(ld_docbomvalidfromwrite) = 20210129

DATA(ld_docbomrevlevelwrite) = some text here

"populate fields of struture and append to itab
append wa_copyobjectlinks to it_copyobjectlinks. . CALL FUNCTION 'API_DOCUMENT_CREATEFROMSRC2' EXPORTING refdocumenttype = ld_refdocumenttype refdocumentnumber = ld_refdocumentnumber refdocumentpart = ld_refdocumentpart refdocumentversion = ld_refdocumentversion * newdocumenttype = ld_newdocumenttype newdocumentnumber = ld_newdocumentnumber newdocumentpart = ld_newdocumentpart newdocumentversion = ld_newdocumentversion * newdescription = ld_newdescription * statusintern = ld_statusintern * statusextern = ld_statusextern * statuslog = ld_statuslog * revlevel = ld_revlevel * aennr = ld_aennr * copyclassification = ld_copyclassification * copyoriginals = ld_copyoriginals * copydocbom = ld_copydocbom * docbomchangenumberread = ld_docbomchangenumberread * docbomvalidfromread = ld_docbomvalidfromread * docbomrevlevelread = ld_docbomrevlevelread * docbomchangenumberwrite = ld_docbomchangenumberwrite * docbomvalidfromwrite = ld_docbomvalidfromwrite * docbomrevlevelwrite = ld_docbomrevlevelwrite IMPORTING doctype = ld_doctype docnumber = ld_docnumber docpart = ld_docpart docversion = ld_docversion return = ld_return * TABLES * copyobjectlinks = it_copyobjectlinks . " API_DOCUMENT_CREATEFROMSRC2
IF SY-SUBRC EQ 0. "All OK 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_doctype  TYPE BAPI_DOC_AUX-DOCTYPE ,
ld_refdocumenttype  TYPE BAPI_DOC_AUX-DOCTYPE ,
it_copyobjectlinks  TYPE STANDARD TABLE OF BAPI_DOC_DRAD_SELECT ,
wa_copyobjectlinks  LIKE LINE OF it_copyobjectlinks,
ld_docnumber  TYPE BAPI_DOC_AUX-DOCNUMBER ,
ld_refdocumentnumber  TYPE BAPI_DOC_AUX-DOCNUMBER ,
ld_docpart  TYPE BAPI_DOC_AUX-DOCPART ,
ld_refdocumentpart  TYPE BAPI_DOC_AUX-DOCPART ,
ld_docversion  TYPE BAPI_DOC_AUX-DOCVERSION ,
ld_refdocumentversion  TYPE BAPI_DOC_AUX-DOCVERSION ,
ld_return  TYPE BAPIRET2 ,
ld_newdocumenttype  TYPE BAPI_DOC_AUX-DOCTYPE ,
ld_newdocumentnumber  TYPE BAPI_DOC_AUX-DOCNUMBER ,
ld_newdocumentpart  TYPE BAPI_DOC_AUX-DOCPART ,
ld_newdocumentversion  TYPE BAPI_DOC_AUX-DOCVERSION ,
ld_newdescription  TYPE BAPI_DOC_DRAW2-DESCRIPTION ,
ld_statusintern  TYPE BAPI_DOC_DRAW-STATUSINTERN ,
ld_statusextern  TYPE BAPI_DOC_DRAW-STATUSEXTERN ,
ld_statuslog  TYPE BAPI_DOC_DRAW-STATUSLOG ,
ld_revlevel  TYPE BAPI_DOC_DRAW2-REVLEVEL ,
ld_aennr  TYPE BAPI_DOC_DRAW2-ECNUMBER ,
ld_copyclassification  TYPE BAPI_DOC_AUX-FLAG ,
ld_copyoriginals  TYPE BAPI_DOC_AUX-FLAG ,
ld_copydocbom  TYPE BAPI_DOC_AUX-FLAG ,
ld_docbomchangenumberread  TYPE BAPI_DOC_DRAW2-ECNUMBER ,
ld_docbomvalidfromread  TYPE BAPI_DOC_DRAW2-VALIDFROMDATE ,
ld_docbomrevlevelread  TYPE BAPI_DOC_DRAW2-REVLEVEL ,
ld_docbomchangenumberwrite  TYPE BAPI_DOC_DRAW2-ECNUMBER ,
ld_docbomvalidfromwrite  TYPE BAPI_DOC_DRAW2-VALIDFROMDATE ,
ld_docbomrevlevelwrite  TYPE BAPI_DOC_DRAW2-REVLEVEL .


ld_refdocumenttype = some text here

"populate fields of struture and append to itab
append wa_copyobjectlinks to it_copyobjectlinks.

ld_refdocumentnumber = some text here

ld_refdocumentpart = some text here

ld_refdocumentversion = some text here

ld_newdocumenttype = some text here

ld_newdocumentnumber = some text here

ld_newdocumentpart = some text here

ld_newdocumentversion = some text here

ld_newdescription = some text here

ld_statusintern = some text here

ld_statusextern = some text here

ld_statuslog = some text here

ld_revlevel = some text here

ld_aennr = some text here

ld_copyclassification = some text here

ld_copyoriginals = some text here

ld_copydocbom = some text here

ld_docbomchangenumberread = some text here

ld_docbomvalidfromread = 20210129

ld_docbomrevlevelread = some text here

ld_docbomchangenumberwrite = some text here

ld_docbomvalidfromwrite = 20210129

ld_docbomrevlevelwrite = some text here

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 API_DOCUMENT_CREATEFROMSRC2 or its description.