SAP G_SUBRULE_ENVIRONMENT Function Module for Maintain Subrule: Create, Change, Delete....
G_SUBRULE_ENVIRONMENT is a standard g subrule environment SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Maintain Subrule: Create, Change, Delete.... 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 g subrule environment FM, simply by entering the name G_SUBRULE_ENVIRONMENT into the relevant SAP transaction such as SE37 or SE38.
Function Group: GBLO
Program Name: SAPLGBLO
Main Program: SAPLGBLO
Appliation area: G
Release date: 20-Jul-1999
Mode(Normal, Remote etc): Normal Function Module
Update:

Function G_SUBRULE_ENVIRONMENT 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 'G_SUBRULE_ENVIRONMENT'"Maintain Subrule: Create, Change, Delete.....
EXPORTING
* RULE_TEMPLATE = ' ' "Template of the Subrule
* VIEW_ONLY = ' ' "'X' = Changes not Possible
* XBOOLCLASS = ' ' "'X' = BOOLCLASS Cannot be Changed
* SKIP_FIRST_SCREEN = ' ' "'X' = Skip First Screen of Subrule Maintenance
* ACTION_MODE = 'C' "Calling Mode: 'C' = Change, 'N' = Create
* BOOLCLASS = ' ' "Boolean Class for Conditions
* BOOLID = ' ' "
* BRULEVENT = ' ' "'X' = RULEVENT Cannot be Changed by User
* BRULUSER = 'X' "'X' = RULUSER Cannot be Changed by User
* RULEVENT = ' ' "ID or Rule Event from Table GB31
* RULUSER = ' ' "
IMPORTING
HEADER_INFO = "Subrule Header Information
RULE_MODIFIED = "'X' = Rule has been Modified
EXCEPTIONS
NOT_FOUND = 1
IMPORTING Parameters details for G_SUBRULE_ENVIRONMENT
RULE_TEMPLATE - Template of the Subrule
Data type: RGBLO-BOOLPROTODefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
VIEW_ONLY - 'X' = Changes not Possible
Data type: GB01-BEXCLUDEDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
XBOOLCLASS - 'X' = BOOLCLASS Cannot be Changed
Data type:Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
SKIP_FIRST_SCREEN - 'X' = Skip First Screen of Subrule Maintenance
Data type: GB01-BEXCLUDEDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
ACTION_MODE - Calling Mode: 'C' = Change, 'N' = Create
Data type: GB01-BEXCLUDEDefault: 'C'
Optional: Yes
Call by Reference: No ( called with pass by value option)
BOOLCLASS - Boolean Class for Conditions
Data type: GB01-BOOLCLASSDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
BOOLID -
Data type: RGBLO-BOOLIDDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
BRULEVENT - 'X' = RULEVENT Cannot be Changed by User
Data type: GB01-BEXCLUDEDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
BRULUSER - 'X' = RULUSER Cannot be Changed by User
Data type: GB01-BEXCLUDEDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
RULEVENT - ID or Rule Event from Table GB31
Data type: GB31-VALEVENTDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
RULUSER -
Data type: GB03-VALUSERDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for G_SUBRULE_ENVIRONMENT
HEADER_INFO - Subrule Header Information
Data type: GB90Optional: No
Call by Reference: No ( called with pass by value option)
RULE_MODIFIED - 'X' = Rule has been Modified
Data type: GB01-BEXCLUDEOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
NOT_FOUND - Boolean Class does not Exist
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for G_SUBRULE_ENVIRONMENT 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_not_found | TYPE STRING, " | |||
| lv_header_info | TYPE GB90, " | |||
| lv_rule_template | TYPE RGBLO-BOOLPROTO, " ' ' | |||
| lv_view_only | TYPE GB01-BEXCLUDE, " ' ' | |||
| lv_xboolclass | TYPE GB01, " ' ' | |||
| lv_rule_modified | TYPE GB01-BEXCLUDE, " | |||
| lv_skip_first_screen | TYPE GB01-BEXCLUDE, " ' ' | |||
| lv_action_mode | TYPE GB01-BEXCLUDE, " 'C' | |||
| lv_boolclass | TYPE GB01-BOOLCLASS, " ' ' | |||
| lv_boolid | TYPE RGBLO-BOOLID, " ' ' | |||
| lv_brulevent | TYPE GB01-BEXCLUDE, " ' ' | |||
| lv_bruluser | TYPE GB01-BEXCLUDE, " 'X' | |||
| lv_rulevent | TYPE GB31-VALEVENT, " ' ' | |||
| lv_ruluser | TYPE GB03-VALUSER. " ' ' |
|   CALL FUNCTION 'G_SUBRULE_ENVIRONMENT' "Maintain Subrule: Create, Change, Delete.... |
| EXPORTING | ||
| RULE_TEMPLATE | = lv_rule_template | |
| VIEW_ONLY | = lv_view_only | |
| XBOOLCLASS | = lv_xboolclass | |
| SKIP_FIRST_SCREEN | = lv_skip_first_screen | |
| ACTION_MODE | = lv_action_mode | |
| BOOLCLASS | = lv_boolclass | |
| BOOLID | = lv_boolid | |
| BRULEVENT | = lv_brulevent | |
| BRULUSER | = lv_bruluser | |
| RULEVENT | = lv_rulevent | |
| RULUSER | = lv_ruluser | |
| IMPORTING | ||
| HEADER_INFO | = lv_header_info | |
| RULE_MODIFIED | = lv_rule_modified | |
| EXCEPTIONS | ||
| NOT_FOUND = 1 | ||
| . " G_SUBRULE_ENVIRONMENT | ||
ABAP code using 7.40 inline data declarations to call FM G_SUBRULE_ENVIRONMENT
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 BOOLPROTO FROM RGBLO INTO @DATA(ld_rule_template). | ||||
| DATA(ld_rule_template) | = ' '. | |||
| "SELECT single BEXCLUDE FROM GB01 INTO @DATA(ld_view_only). | ||||
| DATA(ld_view_only) | = ' '. | |||
| DATA(ld_xboolclass) | = ' '. | |||
| "SELECT single BEXCLUDE FROM GB01 INTO @DATA(ld_rule_modified). | ||||
| "SELECT single BEXCLUDE FROM GB01 INTO @DATA(ld_skip_first_screen). | ||||
| DATA(ld_skip_first_screen) | = ' '. | |||
| "SELECT single BEXCLUDE FROM GB01 INTO @DATA(ld_action_mode). | ||||
| DATA(ld_action_mode) | = 'C'. | |||
| "SELECT single BOOLCLASS FROM GB01 INTO @DATA(ld_boolclass). | ||||
| DATA(ld_boolclass) | = ' '. | |||
| "SELECT single BOOLID FROM RGBLO INTO @DATA(ld_boolid). | ||||
| DATA(ld_boolid) | = ' '. | |||
| "SELECT single BEXCLUDE FROM GB01 INTO @DATA(ld_brulevent). | ||||
| DATA(ld_brulevent) | = ' '. | |||
| "SELECT single BEXCLUDE FROM GB01 INTO @DATA(ld_bruluser). | ||||
| DATA(ld_bruluser) | = 'X'. | |||
| "SELECT single VALEVENT FROM GB31 INTO @DATA(ld_rulevent). | ||||
| DATA(ld_rulevent) | = ' '. | |||
| "SELECT single VALUSER FROM GB03 INTO @DATA(ld_ruluser). | ||||
| DATA(ld_ruluser) | = ' '. | |||
Search for further information about these or an SAP related objects