SAP Function Modules

G_GENERATE_SINGLE_SET SAP Function module







G_GENERATE_SINGLE_SET is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name G_GENERATE_SINGLE_SET into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: GSGF
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM G_GENERATE_SINGLE_SET - G GENERATE SINGLE SET





CALL FUNCTION 'G_GENERATE_SINGLE_SET' "
  EXPORTING
*   client = SPACE              " sy-mandt      Client in which set is to be created
*   langu = SY-LANGU            " sy-langu      Language of text
    set_header =                " rgsbs         Header of the S set
*   ref_set = SPACE             " rgsbs-setnr   Name of reference set
*   tolerate_ambiguity = SPACE  " sy-datar      'X': Unambiguity indicator ignored
*   nothing_changed = SPACE     " sy-datar      Internal use only (set not changed)
*   flag_use_rgsbs_user = SPACE  " sy-datar     Internal use (take user from header)
* TABLES
*   set_lines =                 " rgsb1         Table with set lines
*   set_lines_basic =           " rgsbv         Table with values of single set
*   formula_lines =             " rgsbf         Table with formulas for the values
  EXCEPTIONS
    NOT_UNIQUE = 1              "               Set is not unique, although required
    OLD_SET_HAS_WRONG_DATA_ELEMENT = 2  "       Set with same name but different data element
    OLD_SET_HAS_WRONG_TYPE = 3  "               Set with same name but different type
    SUBSET_DOES_NOT_EXIST = 4   "               Subset used does not exist
    SET_IS_RECURSIVE = 5        "               Subset used contains the highest set
    TEMPORARY_IN_PERMANENT_SET = 6  "           Set contains temporary set
    SETNAME_TOO_LONG = 7        "               Set name too long for temporary set
    SUBSET_HAS_WRONG_DATA_ELEMENT = 8  "        Subset used has a different set data element
    SUBSET_HAS_WRONG_CLASS = 9  "               Subset used has a different class
    TABLE_OR_FIELDNAME_MISSING = 10  "          Table or field name has not been specified
    SUBSET_HAS_WRONG_TYPE = 11  "               Subset used has incorrect type (M/D)
    VARIABLE_DOES_NOT_EXIST = 12  "             Variable used does not exist
    .  "  G_GENERATE_SINGLE_SET

ABAP code example for Function Module G_GENERATE_SINGLE_SET





The ABAP code below is a full code listing to execute function module G_GENERATE_SINGLE_SET including all data declarations. The code uses 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 original method of declaring data variables up front. 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).

DATA:
it_set_lines  TYPE STANDARD TABLE OF RGSB1,"TABLES PARAM
wa_set_lines  LIKE LINE OF it_set_lines ,
it_set_lines_basic  TYPE STANDARD TABLE OF RGSBV,"TABLES PARAM
wa_set_lines_basic  LIKE LINE OF it_set_lines_basic ,
it_formula_lines  TYPE STANDARD TABLE OF RGSBF,"TABLES PARAM
wa_formula_lines  LIKE LINE OF it_formula_lines .

DATA(ld_client) = 'Check type of data required'.
DATA(ld_langu) = 'Check type of data required'.
DATA(ld_set_header) = 'Check type of data required'.

DATA(ld_ref_set) = some text here
DATA(ld_tolerate_ambiguity) = 'some text here'.
DATA(ld_nothing_changed) = 'some text here'.
DATA(ld_flag_use_rgsbs_user) = 'some text here'.

"populate fields of struture and append to itab
append wa_set_lines to it_set_lines.

"populate fields of struture and append to itab
append wa_set_lines_basic to it_set_lines_basic.

"populate fields of struture and append to itab
append wa_formula_lines to it_formula_lines. . CALL FUNCTION 'G_GENERATE_SINGLE_SET' EXPORTING * client = ld_client * langu = ld_langu set_header = ld_set_header * ref_set = ld_ref_set * tolerate_ambiguity = ld_tolerate_ambiguity * nothing_changed = ld_nothing_changed * flag_use_rgsbs_user = ld_flag_use_rgsbs_user * TABLES * set_lines = it_set_lines * set_lines_basic = it_set_lines_basic * formula_lines = it_formula_lines EXCEPTIONS NOT_UNIQUE = 1 OLD_SET_HAS_WRONG_DATA_ELEMENT = 2 OLD_SET_HAS_WRONG_TYPE = 3 SUBSET_DOES_NOT_EXIST = 4 SET_IS_RECURSIVE = 5 TEMPORARY_IN_PERMANENT_SET = 6 SETNAME_TOO_LONG = 7 SUBSET_HAS_WRONG_DATA_ELEMENT = 8 SUBSET_HAS_WRONG_CLASS = 9 TABLE_OR_FIELDNAME_MISSING = 10 SUBSET_HAS_WRONG_TYPE = 11 VARIABLE_DOES_NOT_EXIST = 12 . " G_GENERATE_SINGLE_SET
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 4. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 6. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 7. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 8. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 9. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 10. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 11. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 12. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
it_set_lines  TYPE STANDARD TABLE OF RGSB1 ,
wa_set_lines  LIKE LINE OF it_set_lines,
ld_client  TYPE SY-MANDT ,
ld_langu  TYPE SY-LANGU ,
it_set_lines_basic  TYPE STANDARD TABLE OF RGSBV ,
wa_set_lines_basic  LIKE LINE OF it_set_lines_basic,
ld_set_header  TYPE RGSBS ,
it_formula_lines  TYPE STANDARD TABLE OF RGSBF ,
wa_formula_lines  LIKE LINE OF it_formula_lines,
ld_ref_set  TYPE RGSBS-SETNR ,
ld_tolerate_ambiguity  TYPE SY-DATAR ,
ld_nothing_changed  TYPE SY-DATAR ,
ld_flag_use_rgsbs_user  TYPE SY-DATAR .


"populate fields of struture and append to itab
append wa_set_lines to it_set_lines.
ld_client = 'Check type of data required'.
ld_langu = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_set_lines_basic to it_set_lines_basic.
ld_set_header = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_formula_lines to it_formula_lines.

ld_ref_set = some text here
ld_tolerate_ambiguity = 'some text here'.
ld_nothing_changed = 'some text here'.
ld_flag_use_rgsbs_user = 'some text here'.

SAP Documentation for FM G_GENERATE_SINGLE_SET


The function module G_GENERATE_SINGLE_SET creates a single set or changes an existing one. ...See here for full SAP fm documentation

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name G_GENERATE_SINGLE_SET or its description.