SAP BM_BRANCH_INSERT Function Module for Inserting sub-tree in hierarchical list
BM_BRANCH_INSERT is a standard bm branch insert SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Inserting sub-tree in hierarchical list 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 bm branch insert FM, simply by entering the name BM_BRANCH_INSERT into the relevant SAP transaction such as SE37 or SE38.
Function Group: SF06
Program Name: SAPLSF06
Main Program: SAPLSF06
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function BM_BRANCH_INSERT 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 'BM_BRANCH_INSERT'"Inserting sub-tree in hierarchical list.
EXPORTING
VIEW_TYP = "View, for example, functional area view
* TEXT2_DISPLAY = ' ' "
* TEXT3_DISPLAY = ' ' "
* SEL_ID = ' ' "
* CONSTRUCT_TREE = 'X' "
OBJECT_TYP = "Object type
OBJECT_ID = "Object ID
MODEL_TYP = "
NODE_ID = "Node number
* LEVELS = 1 "Number of levels to be read (' ' = ALL)
* NODE_DISPLAY = ' ' "Field NAME (internal object ID) will be displayed
* TEXT_DISPLAY = ' ' "Field TEXT (application ID) will be displayed
* TEXT1_DISPLAY = 'X' "
IMPORTING Parameters details for BM_BRANCH_INSERT
VIEW_TYP - View, for example, functional area view
Data type: BMT_FLAGOptional: No
Call by Reference: No ( called with pass by value option)
TEXT2_DISPLAY -
Data type: BMT_FLAGDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TEXT3_DISPLAY -
Data type: BMT_FLAGDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
SEL_ID -
Data type: DF55L-SEL_IDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
CONSTRUCT_TREE -
Data type: BMT_FLAGDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
OBJECT_TYP - Object type
Data type: DF41S-PARENT_TYPOptional: No
Call by Reference: No ( called with pass by value option)
OBJECT_ID - Object ID
Data type: DF41S-PARENT_OBJOptional: No
Call by Reference: No ( called with pass by value option)
MODEL_TYP -
Data type: DF41S-MODEL_TYPOptional: No
Call by Reference: No ( called with pass by value option)
NODE_ID - Node number
Data type: SNODETEXT-IDOptional: No
Call by Reference: No ( called with pass by value option)
LEVELS - Number of levels to be read (SPACE = ALL)
Data type: IDefault: 1
Optional: Yes
Call by Reference: No ( called with pass by value option)
NODE_DISPLAY - Field NAME (internal object ID) will be displayed
Data type: BMT_FLAGDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TEXT_DISPLAY - Field TEXT (application ID) will be displayed
Data type: BMT_FLAGDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TEXT1_DISPLAY -
Data type: BMT_FLAGDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for BM_BRANCH_INSERT 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_view_typ | TYPE BMT_FLAG, " | |||
| lv_text2_display | TYPE BMT_FLAG, " SPACE | |||
| lv_text3_display | TYPE BMT_FLAG, " SPACE | |||
| lv_sel_id | TYPE DF55L-SEL_ID, " SPACE | |||
| lv_construct_tree | TYPE BMT_FLAG, " 'X' | |||
| lv_object_typ | TYPE DF41S-PARENT_TYP, " | |||
| lv_object_id | TYPE DF41S-PARENT_OBJ, " | |||
| lv_model_typ | TYPE DF41S-MODEL_TYP, " | |||
| lv_node_id | TYPE SNODETEXT-ID, " | |||
| lv_levels | TYPE I, " 1 | |||
| lv_node_display | TYPE BMT_FLAG, " SPACE | |||
| lv_text_display | TYPE BMT_FLAG, " SPACE | |||
| lv_text1_display | TYPE BMT_FLAG. " 'X' |
|   CALL FUNCTION 'BM_BRANCH_INSERT' "Inserting sub-tree in hierarchical list |
| EXPORTING | ||
| VIEW_TYP | = lv_view_typ | |
| TEXT2_DISPLAY | = lv_text2_display | |
| TEXT3_DISPLAY | = lv_text3_display | |
| SEL_ID | = lv_sel_id | |
| CONSTRUCT_TREE | = lv_construct_tree | |
| OBJECT_TYP | = lv_object_typ | |
| OBJECT_ID | = lv_object_id | |
| MODEL_TYP | = lv_model_typ | |
| NODE_ID | = lv_node_id | |
| LEVELS | = lv_levels | |
| NODE_DISPLAY | = lv_node_display | |
| TEXT_DISPLAY | = lv_text_display | |
| TEXT1_DISPLAY | = lv_text1_display | |
| . " BM_BRANCH_INSERT | ||
ABAP code using 7.40 inline data declarations to call FM BM_BRANCH_INSERT
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.| DATA(ld_text2_display) | = ' '. | |||
| DATA(ld_text3_display) | = ' '. | |||
| "SELECT single SEL_ID FROM DF55L INTO @DATA(ld_sel_id). | ||||
| DATA(ld_sel_id) | = ' '. | |||
| DATA(ld_construct_tree) | = 'X'. | |||
| "SELECT single PARENT_TYP FROM DF41S INTO @DATA(ld_object_typ). | ||||
| "SELECT single PARENT_OBJ FROM DF41S INTO @DATA(ld_object_id). | ||||
| "SELECT single MODEL_TYP FROM DF41S INTO @DATA(ld_model_typ). | ||||
| "SELECT single ID FROM SNODETEXT INTO @DATA(ld_node_id). | ||||
| DATA(ld_levels) | = 1. | |||
| DATA(ld_node_display) | = ' '. | |||
| DATA(ld_text_display) | = ' '. | |||
| DATA(ld_text1_display) | = 'X'. | |||
Search for further information about these or an SAP related objects