SAP Function Modules

DP_CONTROL_ASSIGN_TABLE SAP Function module - Assigning a Structured Table to a Control







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

Associated Function Group: CNDP
Released Date: 29.01.1999
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM DP_CONTROL_ASSIGN_TABLE - DP CONTROL ASSIGN TABLE





CALL FUNCTION 'DP_CONTROL_ASSIGN_TABLE' "Assigning a Structured Table to a Control
  EXPORTING
*   h_dp =                      " cntl_handle   DataProvider Handle
    h_cntl =                    " cntl_handle   Control Handle
*   tabname =                   " x030l-tabname  Name of Table Structure
*   medium =                    " c             Means of Assignment
    propertyname =              " c             Name of Control Property
*   date =                      " sy-datum      Date From Which Data is Valid
*   time =                      " sy-uzeit      Time from which the Data is Valid
*   description =               " c             Additional Description
  TABLES
    data =                      "               Internal Table to Assign
*   tabfields =                 " rfc_fields    Structure Description of the Table
*   columns_to_stretch =        " table_of_strings  INTERNAL: Columns to be Widened in Unicode Systems
  EXCEPTIONS
    DP_ERROR_CREATE = 1         "               DataProvider Could not be Created
    DP_ERROR_SEND_DATA = 2      "               Error Sending Data
    DP_ERROR_ASSIGN = 3         "               Could not make assignment
    DP_ERROR_INVALID_PARAM = 4  "               One of the Parameters is Invalid
    DP_ERROR_TABNAME = 5        "               Parameter TABNAME does not Exist in the ABAP Dictionary
    .  "  DP_CONTROL_ASSIGN_TABLE

ABAP code example for Function Module DP_CONTROL_ASSIGN_TABLE





The ABAP code below is a full code listing to execute function module DP_CONTROL_ASSIGN_TABLE 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:
it_data  TYPE STANDARD TABLE OF STRING,"TABLES PARAM
wa_data  LIKE LINE OF it_data ,
it_tabfields  TYPE STANDARD TABLE OF RFC_FIELDS,"TABLES PARAM
wa_tabfields  LIKE LINE OF it_tabfields ,
it_columns_to_stretch  TYPE STANDARD TABLE OF TABLE_OF_STRINGS,"TABLES PARAM
wa_columns_to_stretch  LIKE LINE OF it_columns_to_stretch .

DATA(ld_h_dp) = 'Check type of data required'.
DATA(ld_h_cntl) = 'Check type of data required'.

DATA(ld_tabname) = some text here
DATA(ld_medium) = 'Check type of data required'.
DATA(ld_propertyname) = 'Check type of data required'.
DATA(ld_date) = '20210129'.
DATA(ld_time) = 'Check type of data required'.
DATA(ld_description) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_data to it_data.

"populate fields of struture and append to itab
append wa_tabfields to it_tabfields.

"populate fields of struture and append to itab
append wa_columns_to_stretch to it_columns_to_stretch. . CALL FUNCTION 'DP_CONTROL_ASSIGN_TABLE' EXPORTING * h_dp = ld_h_dp h_cntl = ld_h_cntl * tabname = ld_tabname * medium = ld_medium propertyname = ld_propertyname * date = ld_date * time = ld_time * description = ld_description TABLES data = it_data * tabfields = it_tabfields * columns_to_stretch = it_columns_to_stretch EXCEPTIONS DP_ERROR_CREATE = 1 DP_ERROR_SEND_DATA = 2 DP_ERROR_ASSIGN = 3 DP_ERROR_INVALID_PARAM = 4 DP_ERROR_TABNAME = 5 . " DP_CONTROL_ASSIGN_TABLE
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 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_h_dp  TYPE CNTL_HANDLE ,
it_data  TYPE STANDARD TABLE OF STRING ,
wa_data  LIKE LINE OF it_data,
ld_h_cntl  TYPE CNTL_HANDLE ,
it_tabfields  TYPE STANDARD TABLE OF RFC_FIELDS ,
wa_tabfields  LIKE LINE OF it_tabfields,
ld_tabname  TYPE X030L-TABNAME ,
it_columns_to_stretch  TYPE STANDARD TABLE OF TABLE_OF_STRINGS ,
wa_columns_to_stretch  LIKE LINE OF it_columns_to_stretch,
ld_medium  TYPE C ,
ld_propertyname  TYPE C ,
ld_date  TYPE SY-DATUM ,
ld_time  TYPE SY-UZEIT ,
ld_description  TYPE C .

ld_h_dp = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_data to it_data.
ld_h_cntl = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_tabfields to it_tabfields.

ld_tabname = some text here

"populate fields of struture and append to itab
append wa_columns_to_stretch to it_columns_to_stretch.
ld_medium = 'Check type of data required'.
ld_propertyname = 'Check type of data required'.
ld_date = '20210129'.
ld_time = 'Check type of data required'.
ld_description = 'Check type of data required'.

SAP Documentation for FM DP_CONTROL_ASSIGN_TABLE


The function module sends a typed table to the client. The table structure information is retained at the client. There is a special ...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 DP_CONTROL_ASSIGN_TABLE or its description.