SAP Function Modules

G_SET_TREE_GENERATE SAP Function module







G_SET_TREE_GENERATE 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_SET_TREE_GENERATE 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_SET_TREE_GENERATE - G SET TREE GENERATE





CALL FUNCTION 'G_SET_TREE_GENERATE' "
* EXPORTING
*   client = SPACE              " sy-mandt      Client
*   langu = SPACE               " sy-langu      Language of Hierarchy
*   tolerate_ambiguity = SPACE  " sy-datar      Suppress Uniqueness Check
*   create_top_node_only = SPACE  " sy-datar    Test Temp. Sets !!! Do Not Use !!!
  TABLES
    set_hierarchy =             " sethier       Table of Sets
    set_values =                " setvalues     Table of Set Values
  EXCEPTIONS
    BAD_FORMULA = 1             "               Error in a Formula
    DOUBLE_FIELD = 2            "               Field used Repeatedly in the Set
    ENTRY_NOT_FOUND = 3         "               Unknown entry
    HIERARCHY_NOT_CORRECT = 4   "               Incorrect Hierarchy Table
    NOT_UNIQUE = 5              "               Set is not unique, although required
    OLD_SET_HAS_WRONG_DATA_ELEMENT = 6  "       Set with same name but different set data element
    OLD_SET_HAS_WRONG_TYPE = 7  "               Set with same name but different type
    SET_IS_RECURSIVE = 8        "               Subset used contains the highest set
    SETNAME_TOO_LONG = 9        "               Set name is too long for a temporary set
    SUBSET_HAS_WRONG_CLASS = 10  "              Subset used has a Different Class
    SUBSET_HAS_WRONG_DATA_ELEMENT = 11  "       Subset used has a Different Set Data Element
    SUBSET_HAS_WRONG_TYPE = 12  "               Subset used has Incorrect Type
    TEMPORARY_IN_PERMANENT_SET = 13  "          Set contains temporary set
    VARIABLE_DOES_NOT_EXIST = 14  "             Variable used does not exist
    VARIABLE_HAS_WRONG_DATA_ELEM = 15  "        Variable used has a different set data element
    VARIABLE_HAS_WRONG_TABLE = 16  "            Set variable belongs to wrong table
    VARIABLE_HAS_WRONG_TYPE = 17  "             Variable used has incorrect type
    WRONG_INTERVAL = 18         "               Interval with From value > To Value
    WRONG_SETCLASS = 19         "               Incorrect set class (for M/D general sets only)
    .  "  G_SET_TREE_GENERATE

ABAP code example for Function Module G_SET_TREE_GENERATE





The ABAP code below is a full code listing to execute function module G_SET_TREE_GENERATE 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_hierarchy  TYPE STANDARD TABLE OF SETHIER,"TABLES PARAM
wa_set_hierarchy  LIKE LINE OF it_set_hierarchy ,
it_set_values  TYPE STANDARD TABLE OF SETVALUES,"TABLES PARAM
wa_set_values  LIKE LINE OF it_set_values .

DATA(ld_client) = 'Check type of data required'.
DATA(ld_langu) = 'Check type of data required'.
DATA(ld_tolerate_ambiguity) = 'some text here'.
DATA(ld_create_top_node_only) = 'some text here'.

"populate fields of struture and append to itab
append wa_set_hierarchy to it_set_hierarchy.

"populate fields of struture and append to itab
append wa_set_values to it_set_values. . CALL FUNCTION 'G_SET_TREE_GENERATE' * EXPORTING * client = ld_client * langu = ld_langu * tolerate_ambiguity = ld_tolerate_ambiguity * create_top_node_only = ld_create_top_node_only TABLES set_hierarchy = it_set_hierarchy set_values = it_set_values EXCEPTIONS BAD_FORMULA = 1 DOUBLE_FIELD = 2 ENTRY_NOT_FOUND = 3 HIERARCHY_NOT_CORRECT = 4 NOT_UNIQUE = 5 OLD_SET_HAS_WRONG_DATA_ELEMENT = 6 OLD_SET_HAS_WRONG_TYPE = 7 SET_IS_RECURSIVE = 8 SETNAME_TOO_LONG = 9 SUBSET_HAS_WRONG_CLASS = 10 SUBSET_HAS_WRONG_DATA_ELEMENT = 11 SUBSET_HAS_WRONG_TYPE = 12 TEMPORARY_IN_PERMANENT_SET = 13 VARIABLE_DOES_NOT_EXIST = 14 VARIABLE_HAS_WRONG_DATA_ELEM = 15 VARIABLE_HAS_WRONG_TABLE = 16 VARIABLE_HAS_WRONG_TYPE = 17 WRONG_INTERVAL = 18 WRONG_SETCLASS = 19 . " G_SET_TREE_GENERATE
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 ELSEIF SY-SUBRC EQ 13. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 14. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 15. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 16. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 17. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 18. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 19. "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:
ld_client  TYPE SY-MANDT ,
it_set_hierarchy  TYPE STANDARD TABLE OF SETHIER ,
wa_set_hierarchy  LIKE LINE OF it_set_hierarchy,
ld_langu  TYPE SY-LANGU ,
it_set_values  TYPE STANDARD TABLE OF SETVALUES ,
wa_set_values  LIKE LINE OF it_set_values,
ld_tolerate_ambiguity  TYPE SY-DATAR ,
ld_create_top_node_only  TYPE SY-DATAR .

ld_client = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_set_hierarchy to it_set_hierarchy.
ld_langu = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_set_values to it_set_values.
ld_tolerate_ambiguity = 'some text here'.
ld_create_top_node_only = 'some text here'.

SAP Documentation for FM G_SET_TREE_GENERATE


This function module creates or changes the sets in the hierarchy structure transferred with the tables 'SET_HIERARCHY' and 'SETVALUES'. ...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_SET_TREE_GENERATE or its description.