SAP G_GENERATE_BASIC_SET Function Module for
G_GENERATE_BASIC_SET is a standard g generate basic set SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, 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 generate basic set FM, simply by entering the name G_GENERATE_BASIC_SET into the relevant SAP transaction such as SE37 or SE38.
Function Group: GSGF
Program Name: SAPLGSGF
Main Program:
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function G_GENERATE_BASIC_SET 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_GENERATE_BASIC_SET'".
EXPORTING
* CLIENT = ' ' "Client for which set is to be created
* LANGU = SY-LANGU "Language of text
SET_HEADER = "Header of basic set
* REF_SET = ' ' "Name of reference set
* TOLERATE_AMBIGUITY = ' ' "'X': Unambiguity indicator ignored
* NOTHING_CHANGED = ' ' "Internal use only (set not changed)
* FLAG_USE_RGSBS_USER = ' ' "Internal use (take user from header)
TABLES
* FORMULA_LINES = "Table with formulas
* SET_LINES = "Table with set lines
EXCEPTIONS
BAD_FORMULA = 1 WRONG_INTERVAL = 10 NOT_UNIQUE = 2 OLD_SET_HAS_WRONG_DATA_ELEMENT = 3 OLD_SET_HAS_WRONG_TYPE = 4 VARIABLE_DOES_NOT_EXIST = 5 VARIABLE_HAS_WRONG_DATA_ELEM = 6 VARIABLE_HAS_WRONG_TYPE = 7 SETNAME_TOO_LONG = 8 TABLE_OR_FIELDNAME_MISSING = 9
IMPORTING Parameters details for G_GENERATE_BASIC_SET
CLIENT - Client for which set is to be created
Data type: SY-MANDTDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
LANGU - Language of text
Data type: SY-LANGUDefault: SY-LANGU
Optional: Yes
Call by Reference: No ( called with pass by value option)
SET_HEADER - Header of basic set
Data type: RGSBSOptional: No
Call by Reference: No ( called with pass by value option)
REF_SET - Name of reference set
Data type: RGSBS-SETNRDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TOLERATE_AMBIGUITY - 'X': Unambiguity indicator ignored
Data type: SY-DATARDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
NOTHING_CHANGED - Internal use only (set not changed)
Data type: SY-DATARDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
FLAG_USE_RGSBS_USER - Internal use (take user from header)
Data type: SY-DATARDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for G_GENERATE_BASIC_SET
FORMULA_LINES - Table with formulas
Data type: RGSBFOptional: Yes
Call by Reference: No ( called with pass by value option)
SET_LINES - Table with set lines
Data type: RGSBVOptional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
BAD_FORMULA - Error in a formula
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
WRONG_INTERVAL - Interval with From value > To Value
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NOT_UNIQUE - Set is not unique, although required
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
OLD_SET_HAS_WRONG_DATA_ELEMENT - Set with same name but different set data element
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
OLD_SET_HAS_WRONG_TYPE - Set with same name but different type
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
VARIABLE_DOES_NOT_EXIST - Variable used does not exist
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
VARIABLE_HAS_WRONG_DATA_ELEM - Variable used has a different set data element
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
VARIABLE_HAS_WRONG_TYPE - Variable used has incorrect type (S)
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
SETNAME_TOO_LONG - Set name is too long for a temporary set
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
TABLE_OR_FIELDNAME_MISSING - Table or field name not specified
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for G_GENERATE_BASIC_SET 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_client | TYPE SY-MANDT, " SPACE | |||
| lv_bad_formula | TYPE SY, " | |||
| lt_formula_lines | TYPE STANDARD TABLE OF RGSBF, " | |||
| lv_wrong_interval | TYPE RGSBF, " | |||
| lv_langu | TYPE SY-LANGU, " SY-LANGU | |||
| lt_set_lines | TYPE STANDARD TABLE OF RGSBV, " | |||
| lv_not_unique | TYPE RGSBV, " | |||
| lv_set_header | TYPE RGSBS, " | |||
| lv_old_set_has_wrong_data_element | TYPE RGSBS, " | |||
| lv_ref_set | TYPE RGSBS-SETNR, " SPACE | |||
| lv_old_set_has_wrong_type | TYPE RGSBS, " | |||
| lv_tolerate_ambiguity | TYPE SY-DATAR, " SPACE | |||
| lv_variable_does_not_exist | TYPE SY, " | |||
| lv_nothing_changed | TYPE SY-DATAR, " SPACE | |||
| lv_variable_has_wrong_data_elem | TYPE SY, " | |||
| lv_flag_use_rgsbs_user | TYPE SY-DATAR, " SPACE | |||
| lv_variable_has_wrong_type | TYPE SY, " | |||
| lv_setname_too_long | TYPE SY, " | |||
| lv_table_or_fieldname_missing | TYPE SY. " |
|   CALL FUNCTION 'G_GENERATE_BASIC_SET' " |
| EXPORTING | ||
| CLIENT | = lv_client | |
| LANGU | = lv_langu | |
| SET_HEADER | = lv_set_header | |
| REF_SET | = lv_ref_set | |
| TOLERATE_AMBIGUITY | = lv_tolerate_ambiguity | |
| NOTHING_CHANGED | = lv_nothing_changed | |
| FLAG_USE_RGSBS_USER | = lv_flag_use_rgsbs_user | |
| TABLES | ||
| FORMULA_LINES | = lt_formula_lines | |
| SET_LINES | = lt_set_lines | |
| EXCEPTIONS | ||
| BAD_FORMULA = 1 | ||
| WRONG_INTERVAL = 10 | ||
| NOT_UNIQUE = 2 | ||
| OLD_SET_HAS_WRONG_DATA_ELEMENT = 3 | ||
| OLD_SET_HAS_WRONG_TYPE = 4 | ||
| VARIABLE_DOES_NOT_EXIST = 5 | ||
| VARIABLE_HAS_WRONG_DATA_ELEM = 6 | ||
| VARIABLE_HAS_WRONG_TYPE = 7 | ||
| SETNAME_TOO_LONG = 8 | ||
| TABLE_OR_FIELDNAME_MISSING = 9 | ||
| . " G_GENERATE_BASIC_SET | ||
ABAP code using 7.40 inline data declarations to call FM G_GENERATE_BASIC_SET
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 MANDT FROM SY INTO @DATA(ld_client). | ||||
| DATA(ld_client) | = ' '. | |||
| "SELECT single LANGU FROM SY INTO @DATA(ld_langu). | ||||
| DATA(ld_langu) | = SY-LANGU. | |||
| "SELECT single SETNR FROM RGSBS INTO @DATA(ld_ref_set). | ||||
| DATA(ld_ref_set) | = ' '. | |||
| "SELECT single DATAR FROM SY INTO @DATA(ld_tolerate_ambiguity). | ||||
| DATA(ld_tolerate_ambiguity) | = ' '. | |||
| "SELECT single DATAR FROM SY INTO @DATA(ld_nothing_changed). | ||||
| DATA(ld_nothing_changed) | = ' '. | |||
| "SELECT single DATAR FROM SY INTO @DATA(ld_flag_use_rgsbs_user). | ||||
| DATA(ld_flag_use_rgsbs_user) | = ' '. | |||
Search for further information about these or an SAP related objects