SAP GJ_LINK_GR_IR Function Module for Links goods receipts and invoice receipts for each line of purchase order
GJ_LINK_GR_IR is a standard gj link gr ir SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Links goods receipts and invoice receipts for each line of purchase order 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 gj link gr ir FM, simply by entering the name GJ_LINK_GR_IR into the relevant SAP transaction such as SE37 or SE38.
Function Group: GJTL
Program Name: SAPLGJTL
Main Program:
Appliation area: G
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function GJ_LINK_GR_IR 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 'GJ_LINK_GR_IR'"Links goods receipts and invoice receipts for each line of purchase order.
EXPORTING
BUKRS = "Company Code
PO_NBR = "Purchase Order Document
PO_LINE = "Purchase Order Line Item
* MM_DOC = "MM Document
* MM_LINE = "MM Line Item
* FYEAR = "Fiscal Year
* NO_UNIT_OF_MEASURE = "No unit of measure on entry (unit of entry)
TABLES
ASSIGNMENT = "GR/IR link table
EXCEPTIONS
NO_PO = 1 NO_DOC = 2 MISSING_YEAR = 3
IMPORTING Parameters details for GJ_LINK_GR_IR
BUKRS - Company Code
Data type: BSEG-BUKRSOptional: No
Call by Reference: No ( called with pass by value option)
PO_NBR - Purchase Order Document
Data type: EKBE-EBELNOptional: No
Call by Reference: No ( called with pass by value option)
PO_LINE - Purchase Order Line Item
Data type: EKBE-EBELPOptional: No
Call by Reference: No ( called with pass by value option)
MM_DOC - MM Document
Data type: EKBE-BELNROptional: Yes
Call by Reference: No ( called with pass by value option)
MM_LINE - MM Line Item
Data type: EKBE-BUZEIOptional: Yes
Call by Reference: No ( called with pass by value option)
FYEAR - Fiscal Year
Data type: BSEG-GJAHROptional: Yes
Call by Reference: No ( called with pass by value option)
NO_UNIT_OF_MEASURE - No unit of measure on entry (unit of entry)
Data type: T8JZ-ITDOptional: Yes
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for GJ_LINK_GR_IR
ASSIGNMENT - GR/IR link table
Data type: T8JVM01Optional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
NO_PO - No Purchase Order found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_DOC - No documents found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
MISSING_YEAR - Fiscal year missing
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for GJ_LINK_GR_IR 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_bukrs | TYPE BSEG-BUKRS, " | |||
| lv_no_po | TYPE BSEG, " | |||
| lt_assignment | TYPE STANDARD TABLE OF T8JVM01, " | |||
| lv_no_doc | TYPE T8JVM01, " | |||
| lv_po_nbr | TYPE EKBE-EBELN, " | |||
| lv_po_line | TYPE EKBE-EBELP, " | |||
| lv_missing_year | TYPE EKBE, " | |||
| lv_mm_doc | TYPE EKBE-BELNR, " | |||
| lv_mm_line | TYPE EKBE-BUZEI, " | |||
| lv_fyear | TYPE BSEG-GJAHR, " | |||
| lv_no_unit_of_measure | TYPE T8JZ-ITD. " |
|   CALL FUNCTION 'GJ_LINK_GR_IR' "Links goods receipts and invoice receipts for each line of purchase order |
| EXPORTING | ||
| BUKRS | = lv_bukrs | |
| PO_NBR | = lv_po_nbr | |
| PO_LINE | = lv_po_line | |
| MM_DOC | = lv_mm_doc | |
| MM_LINE | = lv_mm_line | |
| FYEAR | = lv_fyear | |
| NO_UNIT_OF_MEASURE | = lv_no_unit_of_measure | |
| TABLES | ||
| ASSIGNMENT | = lt_assignment | |
| EXCEPTIONS | ||
| NO_PO = 1 | ||
| NO_DOC = 2 | ||
| MISSING_YEAR = 3 | ||
| . " GJ_LINK_GR_IR | ||
ABAP code using 7.40 inline data declarations to call FM GJ_LINK_GR_IR
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 BUKRS FROM BSEG INTO @DATA(ld_bukrs). | ||||
| "SELECT single EBELN FROM EKBE INTO @DATA(ld_po_nbr). | ||||
| "SELECT single EBELP FROM EKBE INTO @DATA(ld_po_line). | ||||
| "SELECT single BELNR FROM EKBE INTO @DATA(ld_mm_doc). | ||||
| "SELECT single BUZEI FROM EKBE INTO @DATA(ld_mm_line). | ||||
| "SELECT single GJAHR FROM BSEG INTO @DATA(ld_fyear). | ||||
| "SELECT single ITD FROM T8JZ INTO @DATA(ld_no_unit_of_measure). | ||||
Search for further information about these or an SAP related objects