SAP Function Modules

AICH_PROG_HIER_READ SAP Function module







AICH_PROG_HIER_READ 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 AICH_PROG_HIER_READ into the relevant SAP transaction such as SE37 or SE80.

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


Pattern for FM AICH_PROG_HIER_READ - AICH PROG HIER READ





CALL FUNCTION 'AICH_PROG_HIER_READ' "
  EXPORTING
    i_compr_vrsn =              " imchie-compr_vrsn
    i_inv_prog =                " imchie-inv_prog
    i_appr_year =               " imchie-appr_year
*   i_from_pos = SPACE          " imchie-prog_pos
*   i_flg_leafs_only = ' '      " imis_type_flg
*   i_flg_with_text = 'X'       " imis_type_flg
*   i_langu = SY-LANGU          " imceppt-langu
*   i_flg_buffer = ' '          " imis_type_flg
*   i_flg_use_packages = ' '    " imis_type_flg
  IMPORTING
    es_imchie_from_pos =        " imis_type_s_imchie
    et_rsthie =                 " imis_type_t_rsthie
    eth_positions =             " imis_type_th_pos
    et_imchie =                 " imis_type_t_imchie
    et_imceppt =                " imis_type_t_imceppt
    e_flg_positions_found =     " imis_type_flg
  EXCEPTIONS
    ENTRY_POSITION_NOT_FOUND = 1  "
    NO_HIERARCHY_FOUND = 2      "
    .  "  AICH_PROG_HIER_READ

ABAP code example for Function Module AICH_PROG_HIER_READ





The ABAP code below is a full code listing to execute function module AICH_PROG_HIER_READ 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:
ld_es_imchie_from_pos  TYPE IMIS_TYPE_S_IMCHIE ,
ld_et_rsthie  TYPE IMIS_TYPE_T_RSTHIE ,
ld_eth_positions  TYPE IMIS_TYPE_TH_POS ,
ld_et_imchie  TYPE IMIS_TYPE_T_IMCHIE ,
ld_et_imceppt  TYPE IMIS_TYPE_T_IMCEPPT ,
ld_e_flg_positions_found  TYPE IMIS_TYPE_FLG .


SELECT single COMPR_VRSN
FROM IMCHIE
INTO @DATA(ld_i_compr_vrsn).


SELECT single INV_PROG
FROM IMCHIE
INTO @DATA(ld_i_inv_prog).


SELECT single APPR_YEAR
FROM IMCHIE
INTO @DATA(ld_i_appr_year).


SELECT single PROG_POS
FROM IMCHIE
INTO @DATA(ld_i_from_pos).

DATA(ld_i_flg_leafs_only) = 'Check type of data required'.
DATA(ld_i_flg_with_text) = 'Check type of data required'.

SELECT single LANGU
FROM IMCEPPT
INTO @DATA(ld_i_langu).

DATA(ld_i_flg_buffer) = 'Check type of data required'.
DATA(ld_i_flg_use_packages) = 'Check type of data required'. . CALL FUNCTION 'AICH_PROG_HIER_READ' EXPORTING i_compr_vrsn = ld_i_compr_vrsn i_inv_prog = ld_i_inv_prog i_appr_year = ld_i_appr_year * i_from_pos = ld_i_from_pos * i_flg_leafs_only = ld_i_flg_leafs_only * i_flg_with_text = ld_i_flg_with_text * i_langu = ld_i_langu * i_flg_buffer = ld_i_flg_buffer * i_flg_use_packages = ld_i_flg_use_packages IMPORTING es_imchie_from_pos = ld_es_imchie_from_pos et_rsthie = ld_et_rsthie eth_positions = ld_eth_positions et_imchie = ld_et_imchie et_imceppt = ld_et_imceppt e_flg_positions_found = ld_e_flg_positions_found EXCEPTIONS ENTRY_POSITION_NOT_FOUND = 1 NO_HIERARCHY_FOUND = 2 . " AICH_PROG_HIER_READ
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 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_es_imchie_from_pos  TYPE IMIS_TYPE_S_IMCHIE ,
ld_i_compr_vrsn  TYPE IMCHIE-COMPR_VRSN ,
ld_et_rsthie  TYPE IMIS_TYPE_T_RSTHIE ,
ld_i_inv_prog  TYPE IMCHIE-INV_PROG ,
ld_eth_positions  TYPE IMIS_TYPE_TH_POS ,
ld_i_appr_year  TYPE IMCHIE-APPR_YEAR ,
ld_et_imchie  TYPE IMIS_TYPE_T_IMCHIE ,
ld_i_from_pos  TYPE IMCHIE-PROG_POS ,
ld_et_imceppt  TYPE IMIS_TYPE_T_IMCEPPT ,
ld_i_flg_leafs_only  TYPE IMIS_TYPE_FLG ,
ld_e_flg_positions_found  TYPE IMIS_TYPE_FLG ,
ld_i_flg_with_text  TYPE IMIS_TYPE_FLG ,
ld_i_langu  TYPE IMCEPPT-LANGU ,
ld_i_flg_buffer  TYPE IMIS_TYPE_FLG ,
ld_i_flg_use_packages  TYPE IMIS_TYPE_FLG .


SELECT single COMPR_VRSN
FROM IMCHIE
INTO ld_i_compr_vrsn.


SELECT single INV_PROG
FROM IMCHIE
INTO ld_i_inv_prog.


SELECT single APPR_YEAR
FROM IMCHIE
INTO ld_i_appr_year.


SELECT single PROG_POS
FROM IMCHIE
INTO ld_i_from_pos.

ld_i_flg_leafs_only = 'Check type of data required'.
ld_i_flg_with_text = 'Check type of data required'.

SELECT single LANGU
FROM IMCEPPT
INTO ld_i_langu.

ld_i_flg_buffer = 'Check type of data required'.
ld_i_flg_use_packages = 'Check type of data required'.

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 AICH_PROG_HIER_READ or its description.