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

Function GET_GKONT_2 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 'GET_GKONT_2'"Getting offsetting item, document is transferred.
EXPORTING
* GKNKZ = ' ' "Indicator for the offsetting account calculation
TABLES
XBSEG = "Table into which the document is transferred
XBSEGZ = "Table into which the offsetting account is returned
EXCEPTIONS
BUZEI_NOT_FOUND = 1 GKNKZ_NOT_FOUND = 2
IMPORTING Parameters details for GET_GKONT_2
GKNKZ - Indicator for the offsetting account calculation
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for GET_GKONT_2
XBSEG - Table into which the document is transferred
Data type: BSEGOptional: No
Call by Reference: No ( called with pass by value option)
XBSEGZ - Table into which the offsetting account is returned
Data type: BSEGZOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
BUZEI_NOT_FOUND -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
GKNKZ_NOT_FOUND - The indicator is unknown
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for GET_GKONT_2 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_gknkz | TYPE STRING, " SPACE | |||
| lt_xbseg | TYPE STANDARD TABLE OF BSEG, " | |||
| lv_buzei_not_found | TYPE BSEG, " | |||
| lt_xbsegz | TYPE STANDARD TABLE OF BSEGZ, " | |||
| lv_gknkz_not_found | TYPE BSEGZ. " |
|   CALL FUNCTION 'GET_GKONT_2' "Getting offsetting item, document is transferred |
| EXPORTING | ||
| GKNKZ | = lv_gknkz | |
| TABLES | ||
| XBSEG | = lt_xbseg | |
| XBSEGZ | = lt_xbsegz | |
| EXCEPTIONS | ||
| BUZEI_NOT_FOUND = 1 | ||
| GKNKZ_NOT_FOUND = 2 | ||
| . " GET_GKONT_2 | ||
ABAP code using 7.40 inline data declarations to call FM GET_GKONT_2
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_gknkz) | = ' '. | |||
Search for further information about these or an SAP related objects