SAP BAPI_MATERIAL_GET_PRODUCTHIER Function Module for BAPI Material Get Product Hierarchy ()









BAPI_MATERIAL_GET_PRODUCTHIER is a standard bapi material get producthier SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for BAPI Material Get Product Hierarchy () 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 bapi material get producthier FM, simply by entering the name BAPI_MATERIAL_GET_PRODUCTHIER into the relevant SAP transaction such as SE37 or SE38.

Function Group: V81ABAPI
Program Name: SAPLV81ABAPI
Main Program: SAPLV81ABAPI
Appliation area: V
Release date: 19-May-1999
Mode(Normal, Remote etc): Remote-Enabled
Update:



Function BAPI_MATERIAL_GET_PRODUCTHIER 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 'BAPI_MATERIAL_GET_PRODUCTHIER'"BAPI Material Get Product Hierarchy ()
EXPORTING
HIERARCHY_TYPE = "Hierarchy Type for Product Hierarchy
* PRODUCT_HIERARCHY = "Product Hierarchy
* SALES_ORGANIZATION = "Restrict Sales Organization
* DISTRIBUTION_CHANNEL = "Restrict Distribution Channel
* READ_REFERENCE = ' ' "Read References (yes/no)

IMPORTING
RETURN = "Return Code

TABLES
* NODE_LIST = "Product Hierarchy Nodes
* NODE_REFERENCE_LIST = "Nodes with Reference to Material Master Records
.



IMPORTING Parameters details for BAPI_MATERIAL_GET_PRODUCTHIER

HIERARCHY_TYPE - Hierarchy Type for Product Hierarchy

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

PRODUCT_HIERARCHY - Product Hierarchy

Data type: BAPIMAT_PRODH-PROD_HIER
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_ORGANIZATION - Restrict Sales Organization

Data type: BAPI_SDVTBER-SALES_ORG
Optional: Yes
Call by Reference: No ( called with pass by value option)

DISTRIBUTION_CHANNEL - Restrict Distribution Channel

Data type: BAPI_SDVTBER-DISTR_CHAN
Optional: Yes
Call by Reference: No ( called with pass by value option)

READ_REFERENCE - Read References (yes/no)

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

EXPORTING Parameters details for BAPI_MATERIAL_GET_PRODUCTHIER

RETURN - Return Code

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

TABLES Parameters details for BAPI_MATERIAL_GET_PRODUCTHIER

NODE_LIST - Product Hierarchy Nodes

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

NODE_REFERENCE_LIST - Nodes with Reference to Material Master Records

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

Copy and paste ABAP code example for BAPI_MATERIAL_GET_PRODUCTHIER 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:
lv_return  TYPE BAPIRET2, "   
lt_node_list  TYPE STANDARD TABLE OF BAPIMAT_PRODH, "   
lv_hierarchy_type  TYPE BAPIMAT_PRODHR-HIER_TYPE, "   
lv_product_hierarchy  TYPE BAPIMAT_PRODH-PROD_HIER, "   
lt_node_reference_list  TYPE STANDARD TABLE OF BAPIMAT_PRODHR, "   
lv_sales_organization  TYPE BAPI_SDVTBER-SALES_ORG, "   
lv_distribution_channel  TYPE BAPI_SDVTBER-DISTR_CHAN, "   
lv_read_reference  TYPE BAPIMAT_PRODHM-READ_REF. "   ' '

  CALL FUNCTION 'BAPI_MATERIAL_GET_PRODUCTHIER'  "BAPI Material Get Product Hierarchy ()
    EXPORTING
         HIERARCHY_TYPE = lv_hierarchy_type
         PRODUCT_HIERARCHY = lv_product_hierarchy
         SALES_ORGANIZATION = lv_sales_organization
         DISTRIBUTION_CHANNEL = lv_distribution_channel
         READ_REFERENCE = lv_read_reference
    IMPORTING
         RETURN = lv_return
    TABLES
         NODE_LIST = lt_node_list
         NODE_REFERENCE_LIST = lt_node_reference_list
. " BAPI_MATERIAL_GET_PRODUCTHIER




ABAP code using 7.40 inline data declarations to call FM BAPI_MATERIAL_GET_PRODUCTHIER

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 HIER_TYPE FROM BAPIMAT_PRODHR INTO @DATA(ld_hierarchy_type).
 
"SELECT single PROD_HIER FROM BAPIMAT_PRODH INTO @DATA(ld_product_hierarchy).
 
 
"SELECT single SALES_ORG FROM BAPI_SDVTBER INTO @DATA(ld_sales_organization).
 
"SELECT single DISTR_CHAN FROM BAPI_SDVTBER INTO @DATA(ld_distribution_channel).
 
"SELECT single READ_REF FROM BAPIMAT_PRODHM INTO @DATA(ld_read_reference).
DATA(ld_read_reference) = ' '.
 


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!