SAP Function Modules

BAPI_CUSTOMER_GET_ROOT SAP Function module - BAPI Customer Hiearchy getRoot() Implementation







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

Associated Function Group: V02HBAPI
Released Date: 09.06.1999
Processing type: Remote-Enabled
remote enabled module settings


Pattern for FM BAPI_CUSTOMER_GET_ROOT - BAPI CUSTOMER GET ROOT





CALL FUNCTION 'BAPI_CUSTOMER_GET_ROOT' "BAPI Customer Hiearchy getRoot() Implementation
  EXPORTING
*   valid_on = SY-DATUM         " bapikna1_knvh-valid_from  Validity Date
    custhityp =                 " bapikna1_knvh-custhityp  Hierarchy Type of Customer Hierarchy
    customerno =                " bapikna103-customer  Customer Number
  IMPORTING
    return =                    " bapiret2      Return Code
* TABLES
*   sales_area =                " bapi_sdvtber  Sales Area
*   node_list =                 " bapikna1_knvh  Nodes
    .  "  BAPI_CUSTOMER_GET_ROOT

ABAP code example for Function Module BAPI_CUSTOMER_GET_ROOT





The ABAP code below is a full code listing to execute function module BAPI_CUSTOMER_GET_ROOT 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_return  TYPE BAPIRET2 ,
it_sales_area  TYPE STANDARD TABLE OF BAPI_SDVTBER,"TABLES PARAM
wa_sales_area  LIKE LINE OF it_sales_area ,
it_node_list  TYPE STANDARD TABLE OF BAPIKNA1_KNVH,"TABLES PARAM
wa_node_list  LIKE LINE OF it_node_list .


DATA(ld_valid_on) = 20210129

DATA(ld_custhityp) = some text here

DATA(ld_customerno) = some text here

"populate fields of struture and append to itab
append wa_sales_area to it_sales_area.

"populate fields of struture and append to itab
append wa_node_list to it_node_list. . CALL FUNCTION 'BAPI_CUSTOMER_GET_ROOT' EXPORTING * valid_on = ld_valid_on custhityp = ld_custhityp customerno = ld_customerno IMPORTING return = ld_return * TABLES * sales_area = it_sales_area * node_list = it_node_list . " BAPI_CUSTOMER_GET_ROOT
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_return  TYPE BAPIRET2 ,
ld_valid_on  TYPE BAPIKNA1_KNVH-VALID_FROM ,
it_sales_area  TYPE STANDARD TABLE OF BAPI_SDVTBER ,
wa_sales_area  LIKE LINE OF it_sales_area,
ld_custhityp  TYPE BAPIKNA1_KNVH-CUSTHITYP ,
it_node_list  TYPE STANDARD TABLE OF BAPIKNA1_KNVH ,
wa_node_list  LIKE LINE OF it_node_list,
ld_customerno  TYPE BAPIKNA103-CUSTOMER .


ld_valid_on = 20210129

"populate fields of struture and append to itab
append wa_sales_area to it_sales_area.

ld_custhityp = some text here

"populate fields of struture and append to itab
append wa_node_list to it_node_list.

ld_customerno = some text here

SAP Documentation for FM BAPI_CUSTOMER_GET_ROOT


Implementation of the Customer.getRoot() Instance Method
The system determines the highest-level customer for the customer in ...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 BAPI_CUSTOMER_GET_ROOT or its description.