SAP OIH_VAL_DEF_HANTYP Function Module for Validation/Defaulting Handlingtype
OIH_VAL_DEF_HANTYP is a standard oih val def hantyp SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Validation/Defaulting Handlingtype 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 oih val def hantyp FM, simply by entering the name OIH_VAL_DEF_HANTYP into the relevant SAP transaction such as SE37 or SE38.
Function Group: OIHB
Program Name: SAPLOIHB
Main Program: SAPLOIHB
Appliation area: V
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function OIH_VAL_DEF_HANTYP 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 'OIH_VAL_DEF_HANTYP'"Validation/Defaulting Handlingtype.
EXPORTING
I_STRUCT = "Import-Structure filled by calling program
* I_ACT_TYPE = "Transaction type
* IS_EKKO = "Purchasing Document Header
* IS_VBAK = "Sales Document: Header Data
* IS_MSEG = "Document Segment: Material
* IS_VBAP = "Sales Document: Item Data
* IS_EKPO = "Purchasing Document Item
IMPORTING
E_STRUCT = "Export-Structure filled by function-pool
TABLES
* XVBPA = "
* IT_EKPO = "Purchasing Document Item
* IT_MSEG = "Document Segment: Material
* IT_VBAP = "Sales Document: Item Data
EXCEPTIONS
ERROR = 1 IMPORT_INCOMPLETE = 2
IMPORTING Parameters details for OIH_VAL_DEF_HANTYP
I_STRUCT - Import-Structure filled by calling program
Data type: OIH_HTYPEOptional: No
Call by Reference: No ( called with pass by value option)
I_ACT_TYPE - Transaction type
Data type: T180-TRTYPOptional: Yes
Call by Reference: Yes
IS_EKKO - Purchasing Document Header
Data type: EKKOOptional: Yes
Call by Reference: No ( called with pass by value option)
IS_VBAK - Sales Document: Header Data
Data type: VBAKOptional: Yes
Call by Reference: No ( called with pass by value option)
IS_MSEG - Document Segment: Material
Data type: MSEGOptional: Yes
Call by Reference: No ( called with pass by value option)
IS_VBAP - Sales Document: Item Data
Data type: VBAPOptional: Yes
Call by Reference: No ( called with pass by value option)
IS_EKPO - Purchasing Document Item
Data type: EKPOOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for OIH_VAL_DEF_HANTYP
E_STRUCT - Export-Structure filled by function-pool
Data type: OIH_HTYPEOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for OIH_VAL_DEF_HANTYP
XVBPA -
Data type: VBPAVBOptional: Yes
Call by Reference: No ( called with pass by value option)
IT_EKPO - Purchasing Document Item
Data type: EKPOOptional: Yes
Call by Reference: Yes
IT_MSEG - Document Segment: Material
Data type: MSEGOptional: Yes
Call by Reference: Yes
IT_VBAP - Sales Document: Item Data
Data type: VBAPOptional: Yes
Call by Reference: Yes
EXCEPTIONS details
ERROR - Any Error that may occur
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
IMPORT_INCOMPLETE - Error in Import Parameters
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for OIH_VAL_DEF_HANTYP 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_error | TYPE STRING, " | |||
| lt_xvbpa | TYPE STANDARD TABLE OF VBPAVB, " | |||
| lv_e_struct | TYPE OIH_HTYPE, " | |||
| lv_i_struct | TYPE OIH_HTYPE, " | |||
| lt_it_ekpo | TYPE STANDARD TABLE OF EKPO, " | |||
| lv_i_act_type | TYPE T180-TRTYP, " | |||
| lv_import_incomplete | TYPE T180, " | |||
| lv_is_ekko | TYPE EKKO, " | |||
| lt_it_mseg | TYPE STANDARD TABLE OF MSEG, " | |||
| lv_is_vbak | TYPE VBAK, " | |||
| lt_it_vbap | TYPE STANDARD TABLE OF VBAP, " | |||
| lv_is_mseg | TYPE MSEG, " | |||
| lv_is_vbap | TYPE VBAP, " | |||
| lv_is_ekpo | TYPE EKPO. " |
|   CALL FUNCTION 'OIH_VAL_DEF_HANTYP' "Validation/Defaulting Handlingtype |
| EXPORTING | ||
| I_STRUCT | = lv_i_struct | |
| I_ACT_TYPE | = lv_i_act_type | |
| IS_EKKO | = lv_is_ekko | |
| IS_VBAK | = lv_is_vbak | |
| IS_MSEG | = lv_is_mseg | |
| IS_VBAP | = lv_is_vbap | |
| IS_EKPO | = lv_is_ekpo | |
| IMPORTING | ||
| E_STRUCT | = lv_e_struct | |
| TABLES | ||
| XVBPA | = lt_xvbpa | |
| IT_EKPO | = lt_it_ekpo | |
| IT_MSEG | = lt_it_mseg | |
| IT_VBAP | = lt_it_vbap | |
| EXCEPTIONS | ||
| ERROR = 1 | ||
| IMPORT_INCOMPLETE = 2 | ||
| . " OIH_VAL_DEF_HANTYP | ||
ABAP code using 7.40 inline data declarations to call FM OIH_VAL_DEF_HANTYP
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 TRTYP FROM T180 INTO @DATA(ld_i_act_type). | ||||
Search for further information about these or an SAP related objects