SAP FIND_REF_PLANT Function Module for NOTRANSL: Ermitteln Vorlagewerk zu einem Werk oder zu einer Vertriebslinie
FIND_REF_PLANT is a standard find ref plant SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for NOTRANSL: Ermitteln Vorlagewerk zu einem Werk oder zu einer Vertriebslinie 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 find ref plant FM, simply by entering the name FIND_REF_PLANT into the relevant SAP transaction such as SE37 or SE38.
Function Group: MGWL
Program Name: SAPLMGWL
Main Program: SAPLMGWL
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function FIND_REF_PLANT 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 'FIND_REF_PLANT'"NOTRANSL: Ermitteln Vorlagewerk zu einem Werk oder zu einer Vertriebslinie.
EXPORTING
* P_WERKS = "Plant
* P_VKORG = "Sales Organization
* P_VTWEG = "Distribution Channel
* KZ_READ_T001W = ' ' "ABAP System Field: Highlighted Input in Dynpro Field
IMPORTING
P_VLGW1 = "Plant
P_VLGW2 = "Plant
P_T001W_VLGW1 = "Plants/Branches
P_T001W_VLGW2 = "Plants/Branches
P_T001W_WERKS = "Plants/Branches
P_KZREFPLANT = "DE-EN-LANG-SWITCH-NO-TRANSLATION
P_KZREFPL_DETAIL = "DE-EN-LANG-SWITCH-NO-TRANSLATION
EXCEPTIONS
PLANT_NOT_FOUND = 1 REF_PLANT_NOT_DEFINED = 2 DIST_CHAIN_NOT_FOUND = 3
IMPORTING Parameters details for FIND_REF_PLANT
P_WERKS - Plant
Data type: T001W-WERKSOptional: Yes
Call by Reference: No ( called with pass by value option)
P_VKORG - Sales Organization
Data type: TVKOV-VKORGOptional: Yes
Call by Reference: No ( called with pass by value option)
P_VTWEG - Distribution Channel
Data type: TVKOV-VTWEGOptional: Yes
Call by Reference: No ( called with pass by value option)
KZ_READ_T001W - ABAP System Field: Highlighted Input in Dynpro Field
Data type: SY-DATARDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for FIND_REF_PLANT
P_VLGW1 - Plant
Data type: T001W-WERKSOptional: No
Call by Reference: No ( called with pass by value option)
P_VLGW2 - Plant
Data type: T001W-WERKSOptional: No
Call by Reference: No ( called with pass by value option)
P_T001W_VLGW1 - Plants/Branches
Data type: T001WOptional: No
Call by Reference: No ( called with pass by value option)
P_T001W_VLGW2 - Plants/Branches
Data type: T001WOptional: No
Call by Reference: No ( called with pass by value option)
P_T001W_WERKS - Plants/Branches
Data type: T001WOptional: No
Call by Reference: No ( called with pass by value option)
P_KZREFPLANT - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
P_KZREFPL_DETAIL - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
PLANT_NOT_FOUND - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
REF_PLANT_NOT_DEFINED - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
DIST_CHAIN_NOT_FOUND - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for FIND_REF_PLANT 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_p_vlgw1 | TYPE T001W-WERKS, " | |||
| lv_p_werks | TYPE T001W-WERKS, " | |||
| lv_plant_not_found | TYPE T001W, " | |||
| lv_p_vkorg | TYPE TVKOV-VKORG, " | |||
| lv_p_vlgw2 | TYPE T001W-WERKS, " | |||
| lv_ref_plant_not_defined | TYPE T001W, " | |||
| lv_p_vtweg | TYPE TVKOV-VTWEG, " | |||
| lv_p_t001w_vlgw1 | TYPE T001W, " | |||
| lv_dist_chain_not_found | TYPE T001W, " | |||
| lv_kz_read_t001w | TYPE SY-DATAR, " ' ' | |||
| lv_p_t001w_vlgw2 | TYPE T001W, " | |||
| lv_p_t001w_werks | TYPE T001W, " | |||
| lv_p_kzrefplant | TYPE T001W, " | |||
| lv_p_kzrefpl_detail | TYPE T001W. " |
|   CALL FUNCTION 'FIND_REF_PLANT' "NOTRANSL: Ermitteln Vorlagewerk zu einem Werk oder zu einer Vertriebslinie |
| EXPORTING | ||
| P_WERKS | = lv_p_werks | |
| P_VKORG | = lv_p_vkorg | |
| P_VTWEG | = lv_p_vtweg | |
| KZ_READ_T001W | = lv_kz_read_t001w | |
| IMPORTING | ||
| P_VLGW1 | = lv_p_vlgw1 | |
| P_VLGW2 | = lv_p_vlgw2 | |
| P_T001W_VLGW1 | = lv_p_t001w_vlgw1 | |
| P_T001W_VLGW2 | = lv_p_t001w_vlgw2 | |
| P_T001W_WERKS | = lv_p_t001w_werks | |
| P_KZREFPLANT | = lv_p_kzrefplant | |
| P_KZREFPL_DETAIL | = lv_p_kzrefpl_detail | |
| EXCEPTIONS | ||
| PLANT_NOT_FOUND = 1 | ||
| REF_PLANT_NOT_DEFINED = 2 | ||
| DIST_CHAIN_NOT_FOUND = 3 | ||
| . " FIND_REF_PLANT | ||
ABAP code using 7.40 inline data declarations to call FM FIND_REF_PLANT
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 WERKS FROM T001W INTO @DATA(ld_p_vlgw1). | ||||
| "SELECT single WERKS FROM T001W INTO @DATA(ld_p_werks). | ||||
| "SELECT single VKORG FROM TVKOV INTO @DATA(ld_p_vkorg). | ||||
| "SELECT single WERKS FROM T001W INTO @DATA(ld_p_vlgw2). | ||||
| "SELECT single VTWEG FROM TVKOV INTO @DATA(ld_p_vtweg). | ||||
| "SELECT single DATAR FROM SY INTO @DATA(ld_kz_read_t001w). | ||||
| DATA(ld_kz_read_t001w) | = ' '. | |||
Search for further information about these or an SAP related objects