SAP DOCUMENT_ASSIGNMENT Function Module for Allocate documents to object from application









DOCUMENT_ASSIGNMENT is a standard document assignment SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Allocate documents to object from application processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.


See here to view full function module documentation and code listing for document assignment FM, simply by entering the name DOCUMENT_ASSIGNMENT into the relevant SAP transaction such as SE37 or SE38.

Function Group: CVOB
Program Name: SAPLCVOB
Main Program: SAPLCVOB
Appliation area: M
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function DOCUMENT_ASSIGNMENT pattern details

In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.
CALL FUNCTION 'DOCUMENT_ASSIGNMENT'"Allocate documents to object from application
EXPORTING
* CHECK_EXIST = 'X' "X=Link for existing documents only
* PROGRAM_NAME = ' ' "Program name for sub-screen
* REFRESH_FLAG = ' ' "If 'X' then work area becomes initial during the call.
* VORSCHLAG_DOKAR = ' ' "Default document type
* FB_VALUE_REQUEST = ' ' "FM for F4 on document fields
* FB_CHECK_ASSIGNMENT = ' ' "FM for checking document link
* DATUM = SY-DATUM "
* DOKOB = ' ' "Table name
* DOKOB_VORLAGE = ' ' "Object reference
* INCLUDE_DYNPRO = ' ' "Number of object key sub-screen
* OBJKY = ' ' "Object key as a string
* OBJKY_VORLAGE = ' ' "Key reference
* OBJTXT = ' ' "
OPCODE = "1=Create 2=Change 3=Display
* PREV_NEXT = ' ' "Functions PREVIOUS/NEXT active

IMPORTING
RETURN_CODE = "Return code
VB_FLAG = "X=Update required
CAD_LEAVE = "

TABLES
TABDRAD = "Table of links
.



IMPORTING Parameters details for DOCUMENT_ASSIGNMENT

CHECK_EXIST - X=Link for existing documents only

Data type: MCDOK-CVHIER
Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)

PROGRAM_NAME - Program name for sub-screen

Data type: SY-REPID
Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)

REFRESH_FLAG - If 'X' then work area becomes initial during the call.

Data type:
Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)

VORSCHLAG_DOKAR - Default document type

Data type: DRAW-DOKAR
Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)

FB_VALUE_REQUEST - FM for F4 on document fields

Data type: RS38L-NAME
Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)

FB_CHECK_ASSIGNMENT - FM for checking document link

Data type: RS38L-NAME
Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)

DATUM -

Data type: SY-DATUM
Default: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)

DOKOB - Table name

Data type: DRAD-DOKOB
Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)

DOKOB_VORLAGE - Object reference

Data type: DRAD-DOKOB
Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)

INCLUDE_DYNPRO - Number of object key sub-screen

Data type: SY-DYNNR
Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)

OBJKY - Object key as a string

Data type: DRAD-OBJKY
Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)

OBJKY_VORLAGE - Key reference

Data type: DRAD-OBJKY
Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)

OBJTXT -

Data type:
Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)

OPCODE - 1=Create 2=Change 3=Display

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

PREV_NEXT - Functions PREVIOUS/NEXT active

Data type: MCDOK-CVHIER
Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for DOCUMENT_ASSIGNMENT

RETURN_CODE - Return code

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

VB_FLAG - X=Update required

Data type: MCDOK-CVHIER
Optional: No
Call by Reference: No ( called with pass by value option)

CAD_LEAVE -

Data type: SY-SUBRC
Optional: No
Call by Reference: No ( called with pass by value option)

TABLES Parameters details for DOCUMENT_ASSIGNMENT

TABDRAD - Table of links

Data type: DRAD
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for DOCUMENT_ASSIGNMENT Function Module

The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than 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 newer method of declaring data variables on the fly. 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), which i why i have stuck to the origianl for this example.

DATA:
lt_tabdrad  TYPE STANDARD TABLE OF DRAD, "   
lv_check_exist  TYPE MCDOK-CVHIER, "   'X'
lv_return_code  TYPE MCDOK, "   
lv_program_name  TYPE SY-REPID, "   ' '
lv_refresh_flag  TYPE SY, "   ' '
lv_vorschlag_dokar  TYPE DRAW-DOKAR, "   ' '
lv_fb_value_request  TYPE RS38L-NAME, "   ' '
lv_fb_check_assignment  TYPE RS38L-NAME, "   ' '
lv_datum  TYPE SY-DATUM, "   SY-DATUM
lv_dokob  TYPE DRAD-DOKOB, "   ' '
lv_vb_flag  TYPE MCDOK-CVHIER, "   
lv_cad_leave  TYPE SY-SUBRC, "   
lv_dokob_vorlage  TYPE DRAD-DOKOB, "   ' '
lv_include_dynpro  TYPE SY-DYNNR, "   ' '
lv_objky  TYPE DRAD-OBJKY, "   ' '
lv_objky_vorlage  TYPE DRAD-OBJKY, "   ' '
lv_objtxt  TYPE DRAD, "   ' '
lv_opcode  TYPE DRAD, "   
lv_prev_next  TYPE MCDOK-CVHIER. "   ' '

  CALL FUNCTION 'DOCUMENT_ASSIGNMENT'  "Allocate documents to object from application
    EXPORTING
         CHECK_EXIST = lv_check_exist
         PROGRAM_NAME = lv_program_name
         REFRESH_FLAG = lv_refresh_flag
         VORSCHLAG_DOKAR = lv_vorschlag_dokar
         FB_VALUE_REQUEST = lv_fb_value_request
         FB_CHECK_ASSIGNMENT = lv_fb_check_assignment
         DATUM = lv_datum
         DOKOB = lv_dokob
         DOKOB_VORLAGE = lv_dokob_vorlage
         INCLUDE_DYNPRO = lv_include_dynpro
         OBJKY = lv_objky
         OBJKY_VORLAGE = lv_objky_vorlage
         OBJTXT = lv_objtxt
         OPCODE = lv_opcode
         PREV_NEXT = lv_prev_next
    IMPORTING
         RETURN_CODE = lv_return_code
         VB_FLAG = lv_vb_flag
         CAD_LEAVE = lv_cad_leave
    TABLES
         TABDRAD = lt_tabdrad
. " DOCUMENT_ASSIGNMENT




ABAP code using 7.40 inline data declarations to call FM DOCUMENT_ASSIGNMENT

The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.

 
"SELECT single CVHIER FROM MCDOK INTO @DATA(ld_check_exist).
DATA(ld_check_exist) = 'X'.
 
 
"SELECT single REPID FROM SY INTO @DATA(ld_program_name).
DATA(ld_program_name) = ' '.
 
DATA(ld_refresh_flag) = ' '.
 
"SELECT single DOKAR FROM DRAW INTO @DATA(ld_vorschlag_dokar).
DATA(ld_vorschlag_dokar) = ' '.
 
"SELECT single NAME FROM RS38L INTO @DATA(ld_fb_value_request).
DATA(ld_fb_value_request) = ' '.
 
"SELECT single NAME FROM RS38L INTO @DATA(ld_fb_check_assignment).
DATA(ld_fb_check_assignment) = ' '.
 
"SELECT single DATUM FROM SY INTO @DATA(ld_datum).
DATA(ld_datum) = SY-DATUM.
 
"SELECT single DOKOB FROM DRAD INTO @DATA(ld_dokob).
DATA(ld_dokob) = ' '.
 
"SELECT single CVHIER FROM MCDOK INTO @DATA(ld_vb_flag).
 
"SELECT single SUBRC FROM SY INTO @DATA(ld_cad_leave).
 
"SELECT single DOKOB FROM DRAD INTO @DATA(ld_dokob_vorlage).
DATA(ld_dokob_vorlage) = ' '.
 
"SELECT single DYNNR FROM SY INTO @DATA(ld_include_dynpro).
DATA(ld_include_dynpro) = ' '.
 
"SELECT single OBJKY FROM DRAD INTO @DATA(ld_objky).
DATA(ld_objky) = ' '.
 
"SELECT single OBJKY FROM DRAD INTO @DATA(ld_objky_vorlage).
DATA(ld_objky_vorlage) = ' '.
 
DATA(ld_objtxt) = ' '.
 
 
"SELECT single CVHIER FROM MCDOK INTO @DATA(ld_prev_next).
DATA(ld_prev_next) = ' '.
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!