SAP OIK_GET_DOCUMENT Function Module for Get the document/pos
OIK_GET_DOCUMENT is a standard oik get document SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Get the document/pos 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 oik get document FM, simply by entering the name OIK_GET_DOCUMENT into the relevant SAP transaction such as SE37 or SE38.
Function Group: OIK2
Program Name: SAPLOIK2
Main Program: SAPLOIK2
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function OIK_GET_DOCUMENT 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 'OIK_GET_DOCUMENT'"Get the document/pos.
EXPORTING
I_VBTYP = "SD document category
I_VBELN = "Sales and distribution document number
* I_POSNR = "TD document item number
I_MATNR = "Material number
I_TD_ACTION = "TD action (schedule, load, delivery confirmation)
IMPORTING
E_VBTYP = "SD document category
E_VBELN = "Sales and distribution document number
E_POSNR = "TD document item number
E_WERKS = "Plant
E_LGORT = "Storage location
E_MATNR = "Material number
EXCEPTIONS
NOT_UNIQUE = 1 NOT_FOUND = 2 DOCTYP_NOT_SUPPORTED = 3
Customer Function user exits
Below is a list of CUSTOMER FUNCTION exit user exits that are available within this program and maybe relevant for this FM.EXIT_SAPLOIK2_110 Userexit to set messagelevel at OIK_DELIVERY_CHECK
IMPORTING Parameters details for OIK_GET_DOCUMENT
I_VBTYP - SD document category
Data type: ROIKSHIP-VBTYPOptional: No
Call by Reference: Yes
I_VBELN - Sales and distribution document number
Data type: ROIKSHIP-VBELNOptional: No
Call by Reference: Yes
I_POSNR - TD document item number
Data type: ROIKSHIP-POSNROptional: Yes
Call by Reference: Yes
I_MATNR - Material number
Data type: ROIKSHIP-MATNROptional: No
Call by Reference: Yes
I_TD_ACTION - TD action (schedule, load, delivery confirmation)
Data type: ROIKSHIP-TD_ACTIONOptional: No
Call by Reference: Yes
EXPORTING Parameters details for OIK_GET_DOCUMENT
E_VBTYP - SD document category
Data type: ROIKSHIP-VBTYPOptional: No
Call by Reference: Yes
E_VBELN - Sales and distribution document number
Data type: ROIKSHIP-VBELNOptional: No
Call by Reference: Yes
E_POSNR - TD document item number
Data type: ROIKSHIP-POSNROptional: No
Call by Reference: Yes
E_WERKS - Plant
Data type: ROIKSHIP-WERKSOptional: No
Call by Reference: Yes
E_LGORT - Storage location
Data type: ROIKSHIP-LGORTOptional: No
Call by Reference: Yes
E_MATNR - Material number
Data type: ROIKSHIP-MATNROptional: No
Call by Reference: Yes
EXCEPTIONS details
NOT_UNIQUE -
Data type:Optional: No
Call by Reference: Yes
NOT_FOUND -
Data type:Optional: No
Call by Reference: Yes
DOCTYP_NOT_SUPPORTED -
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for OIK_GET_DOCUMENT 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_vbtyp | TYPE ROIKSHIP-VBTYP, " | |||
| lv_i_vbtyp | TYPE ROIKSHIP-VBTYP, " | |||
| lv_not_unique | TYPE ROIKSHIP, " | |||
| lv_e_vbeln | TYPE ROIKSHIP-VBELN, " | |||
| lv_i_vbeln | TYPE ROIKSHIP-VBELN, " | |||
| lv_not_found | TYPE ROIKSHIP, " | |||
| lv_e_posnr | TYPE ROIKSHIP-POSNR, " | |||
| lv_i_posnr | TYPE ROIKSHIP-POSNR, " | |||
| lv_doctyp_not_supported | TYPE ROIKSHIP, " | |||
| lv_e_werks | TYPE ROIKSHIP-WERKS, " | |||
| lv_i_matnr | TYPE ROIKSHIP-MATNR, " | |||
| lv_e_lgort | TYPE ROIKSHIP-LGORT, " | |||
| lv_i_td_action | TYPE ROIKSHIP-TD_ACTION, " | |||
| lv_e_matnr | TYPE ROIKSHIP-MATNR. " |
|   CALL FUNCTION 'OIK_GET_DOCUMENT' "Get the document/pos |
| EXPORTING | ||
| I_VBTYP | = lv_i_vbtyp | |
| I_VBELN | = lv_i_vbeln | |
| I_POSNR | = lv_i_posnr | |
| I_MATNR | = lv_i_matnr | |
| I_TD_ACTION | = lv_i_td_action | |
| IMPORTING | ||
| E_VBTYP | = lv_e_vbtyp | |
| E_VBELN | = lv_e_vbeln | |
| E_POSNR | = lv_e_posnr | |
| E_WERKS | = lv_e_werks | |
| E_LGORT | = lv_e_lgort | |
| E_MATNR | = lv_e_matnr | |
| EXCEPTIONS | ||
| NOT_UNIQUE = 1 | ||
| NOT_FOUND = 2 | ||
| DOCTYP_NOT_SUPPORTED = 3 | ||
| . " OIK_GET_DOCUMENT | ||
ABAP code using 7.40 inline data declarations to call FM OIK_GET_DOCUMENT
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 VBTYP FROM ROIKSHIP INTO @DATA(ld_e_vbtyp). | ||||
| "SELECT single VBTYP FROM ROIKSHIP INTO @DATA(ld_i_vbtyp). | ||||
| "SELECT single VBELN FROM ROIKSHIP INTO @DATA(ld_e_vbeln). | ||||
| "SELECT single VBELN FROM ROIKSHIP INTO @DATA(ld_i_vbeln). | ||||
| "SELECT single POSNR FROM ROIKSHIP INTO @DATA(ld_e_posnr). | ||||
| "SELECT single POSNR FROM ROIKSHIP INTO @DATA(ld_i_posnr). | ||||
| "SELECT single WERKS FROM ROIKSHIP INTO @DATA(ld_e_werks). | ||||
| "SELECT single MATNR FROM ROIKSHIP INTO @DATA(ld_i_matnr). | ||||
| "SELECT single LGORT FROM ROIKSHIP INTO @DATA(ld_e_lgort). | ||||
| "SELECT single TD_ACTION FROM ROIKSHIP INTO @DATA(ld_i_td_action). | ||||
| "SELECT single MATNR FROM ROIKSHIP INTO @DATA(ld_e_matnr). | ||||
Search for further information about these or an SAP related objects