SAP IHC_UTIL_GET_POS_FOR_INSERT Function Module for Determine Index Where Segment Will Be Inserted
IHC_UTIL_GET_POS_FOR_INSERT is a standard ihc util get pos for insert SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Determine Index Where Segment Will Be Inserted 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 ihc util get pos for insert FM, simply by entering the name IHC_UTIL_GET_POS_FOR_INSERT into the relevant SAP transaction such as SE37 or SE38.
Function Group: IHC_APPL_IDOC
Program Name: SAPLIHC_APPL_IDOC
Main Program: SAPLIHC_APPL_IDOC
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function IHC_UTIL_GET_POS_FOR_INSERT 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 'IHC_UTIL_GET_POS_FOR_INSERT'"Determine Index Where Segment Will Be Inserted.
EXPORTING
I_BASIS_TYPE = "Basic Type
* I_EXT_TYPE = ' ' "Enhancement
I_SEGMENT_TYPE = "Segment Type
* I_MIN_INDEX = 1 "Minimale Position
IMPORTING
E_INDEX = "Index für Anweisung INSERT
TABLES
IT_EDIDD = "Data Record (IDoc)
EXCEPTIONS
BASIS_TYPE_NOT_FOUND = 1 EXTENSION_NOT_FOUND = 2 EXTENSION_ERROR = 3 INVALID_IDOC_DEFINITION = 4 IDOC_ERROR = 5 INVALID_SEGMENT_TYPE = 6 INVALID_START_INDEX = 7 NO_MORE_POSITION = 8 TOO_MANY_SEGMENTS = 9
IMPORTING Parameters details for IHC_UTIL_GET_POS_FOR_INSERT
I_BASIS_TYPE - Basic Type
Data type: EDI_IDOCTPOptional: No
Call by Reference: No ( called with pass by value option)
I_EXT_TYPE - Enhancement
Data type: EDI_CIMTYPDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_SEGMENT_TYPE - Segment Type
Data type: EDILSEGTYPOptional: No
Call by Reference: No ( called with pass by value option)
I_MIN_INDEX - Minimale Position
Data type: SYTABIXDefault: 1
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for IHC_UTIL_GET_POS_FOR_INSERT
E_INDEX - Index für Anweisung INSERT
Data type: SYTABIXOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for IHC_UTIL_GET_POS_FOR_INSERT
IT_EDIDD - Data Record (IDoc)
Data type: EDIDDOptional: No
Call by Reference: Yes
EXCEPTIONS details
BASIS_TYPE_NOT_FOUND - IDOC Basistyp ist nicht vorhanden
Data type:Optional: No
Call by Reference: Yes
EXTENSION_NOT_FOUND - IDOC Erweiterung ist nicht vorhanden
Data type:Optional: No
Call by Reference: Yes
EXTENSION_ERROR - Defintion der IDOC Erweiterung ist fehlerhaft
Data type:Optional: No
Call by Reference: Yes
INVALID_IDOC_DEFINITION - Definition der IDOC ist fehlerhaft.
Data type:Optional: No
Call by Reference: Yes
IDOC_ERROR - IDOC ist fehlerhaft.
Data type:Optional: No
Call by Reference: Yes
INVALID_SEGMENT_TYPE - Segmenttyp ist im IDOC-Typ nicht vorhanden
Data type:Optional: No
Call by Reference: Yes
INVALID_START_INDEX - Minimale Position ist nicht zulässig
Data type:Optional: No
Call by Reference: Yes
NO_MORE_POSITION - Keine passende Position wurde gefunden
Data type:Optional: No
Call by Reference: Yes
TOO_MANY_SEGMENTS - Maximaler Anzahl des Segmenttyps wurde erreicht
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for IHC_UTIL_GET_POS_FOR_INSERT 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_e_index | TYPE SYTABIX, " | |||
| lt_it_edidd | TYPE STANDARD TABLE OF EDIDD, " | |||
| lv_i_basis_type | TYPE EDI_IDOCTP, " | |||
| lv_basis_type_not_found | TYPE EDI_IDOCTP, " | |||
| lv_i_ext_type | TYPE EDI_CIMTYP, " SPACE | |||
| lv_extension_not_found | TYPE EDI_CIMTYP, " | |||
| lv_i_segment_type | TYPE EDILSEGTYP, " | |||
| lv_extension_error | TYPE EDILSEGTYP, " | |||
| lv_i_min_index | TYPE SYTABIX, " 1 | |||
| lv_invalid_idoc_definition | TYPE SYTABIX, " | |||
| lv_idoc_error | TYPE SYTABIX, " | |||
| lv_invalid_segment_type | TYPE SYTABIX, " | |||
| lv_invalid_start_index | TYPE SYTABIX, " | |||
| lv_no_more_position | TYPE SYTABIX, " | |||
| lv_too_many_segments | TYPE SYTABIX. " |
|   CALL FUNCTION 'IHC_UTIL_GET_POS_FOR_INSERT' "Determine Index Where Segment Will Be Inserted |
| EXPORTING | ||
| I_BASIS_TYPE | = lv_i_basis_type | |
| I_EXT_TYPE | = lv_i_ext_type | |
| I_SEGMENT_TYPE | = lv_i_segment_type | |
| I_MIN_INDEX | = lv_i_min_index | |
| IMPORTING | ||
| E_INDEX | = lv_e_index | |
| TABLES | ||
| IT_EDIDD | = lt_it_edidd | |
| EXCEPTIONS | ||
| BASIS_TYPE_NOT_FOUND = 1 | ||
| EXTENSION_NOT_FOUND = 2 | ||
| EXTENSION_ERROR = 3 | ||
| INVALID_IDOC_DEFINITION = 4 | ||
| IDOC_ERROR = 5 | ||
| INVALID_SEGMENT_TYPE = 6 | ||
| INVALID_START_INDEX = 7 | ||
| NO_MORE_POSITION = 8 | ||
| TOO_MANY_SEGMENTS = 9 | ||
| . " IHC_UTIL_GET_POS_FOR_INSERT | ||
ABAP code using 7.40 inline data declarations to call FM IHC_UTIL_GET_POS_FOR_INSERT
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.| DATA(ld_i_ext_type) | = ' '. | |||
| DATA(ld_i_min_index) | = 1. | |||
Search for further information about these or an SAP related objects