SAP K_ITEM_ATTACH_SINGLE Function Module for
K_ITEM_ATTACH_SINGLE is a standard k item attach single SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, 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 k item attach single FM, simply by entering the name K_ITEM_ATTACH_SINGLE into the relevant SAP transaction such as SE37 or SE38.
Function Group: KKPH
Program Name: SAPLKKPH
Main Program:
Appliation area: K
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function K_ITEM_ATTACH_SINGLE 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 'K_ITEM_ATTACH_SINGLE'".
EXPORTING
* ARBPL = ' ' "
* OBART = ' ' "
* PLNAL = ' ' "
* PLNNR = ' ' "
* PSPNR = '00000000' "
* SAUFN = ' ' "
* VERID = ' ' "
* WERKS = ' ' "
* PROCNR = 000000000000 "
* AUFNR = ' ' "
* DATBI = '99991231' "
* DIALOG = ' ' "
* FLG_UPD = 'I' "
I_CKPHS = "
* KSTRG = ' ' "
* KSTRG_CHECK = ' ' "
* MATNR = ' ' "
IMPORTING
E_CKPE = "
TABLES
I_CKPE_TOTAL = "
I_IT_MSA_LINK = "
I_X_CKPE_TOTAL = "
EXCEPTIONS
NOT_ATTACHED = 1 NOT_DELETED = 2 NOT_FOUND = 3
IMPORTING Parameters details for K_ITEM_ATTACH_SINGLE
ARBPL -
Data type: P3000-ARBPLDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
OBART -
Data type: KKHIE-OBARTDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
PLNAL -
Data type: SAFK-APLALDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
PLNNR -
Data type: SAFK-PLNNRDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
PSPNR -
Data type: PRPS-PSPNRDefault: '00000000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
SAUFN -
Data type: SAFK-AUFNRDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
VERID -
Data type: SAFK-VERIDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
WERKS -
Data type: CKPE-WERKSDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
PROCNR -
Data type: CKPE-PROCNRDefault: 000000000000
Optional: Yes
Call by Reference: No ( called with pass by value option)
AUFNR -
Data type: AUFK-AUFNRDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
DATBI -
Data type: CKPE-DATBIDefault: '99991231'
Optional: Yes
Call by Reference: No ( called with pass by value option)
DIALOG -
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
FLG_UPD -
Data type:Default: 'I'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_CKPHS -
Data type: CKPHSOptional: No
Call by Reference: No ( called with pass by value option)
KSTRG -
Data type: CKPE-KSTRGDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
KSTRG_CHECK -
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
MATNR -
Data type: MARA-MATNRDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for K_ITEM_ATTACH_SINGLE
E_CKPE -
Data type: CKPEOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for K_ITEM_ATTACH_SINGLE
I_CKPE_TOTAL -
Data type: CKPEOptional: No
Call by Reference: No ( called with pass by value option)
I_IT_MSA_LINK -
Data type: SAFKOptional: No
Call by Reference: No ( called with pass by value option)
I_X_CKPE_TOTAL -
Data type: CKPEOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
NOT_ATTACHED - Single objects not allocated
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NOT_DELETED -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NOT_FOUND - Cost object not available
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for K_ITEM_ATTACH_SINGLE 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_arbpl | TYPE P3000-ARBPL, " SPACE | |||
| lv_e_ckpe | TYPE CKPE, " | |||
| lt_i_ckpe_total | TYPE STANDARD TABLE OF CKPE, " | |||
| lv_not_attached | TYPE CKPE, " | |||
| lv_obart | TYPE KKHIE-OBART, " SPACE | |||
| lv_plnal | TYPE SAFK-APLAL, " SPACE | |||
| lv_plnnr | TYPE SAFK-PLNNR, " SPACE | |||
| lv_pspnr | TYPE PRPS-PSPNR, " '00000000' | |||
| lv_saufn | TYPE SAFK-AUFNR, " SPACE | |||
| lv_verid | TYPE SAFK-VERID, " SPACE | |||
| lv_werks | TYPE CKPE-WERKS, " SPACE | |||
| lv_procnr | TYPE CKPE-PROCNR, " 000000000000 | |||
| lv_aufnr | TYPE AUFK-AUFNR, " SPACE | |||
| lv_not_deleted | TYPE AUFK, " | |||
| lt_i_it_msa_link | TYPE STANDARD TABLE OF SAFK, " | |||
| lv_datbi | TYPE CKPE-DATBI, " '99991231' | |||
| lv_not_found | TYPE CKPE, " | |||
| lt_i_x_ckpe_total | TYPE STANDARD TABLE OF CKPE, " | |||
| lv_dialog | TYPE CKPE, " SPACE | |||
| lv_flg_upd | TYPE CKPE, " 'I' | |||
| lv_i_ckphs | TYPE CKPHS, " | |||
| lv_kstrg | TYPE CKPE-KSTRG, " SPACE | |||
| lv_kstrg_check | TYPE CKPE, " SPACE | |||
| lv_matnr | TYPE MARA-MATNR. " SPACE |
|   CALL FUNCTION 'K_ITEM_ATTACH_SINGLE' " |
| EXPORTING | ||
| ARBPL | = lv_arbpl | |
| OBART | = lv_obart | |
| PLNAL | = lv_plnal | |
| PLNNR | = lv_plnnr | |
| PSPNR | = lv_pspnr | |
| SAUFN | = lv_saufn | |
| VERID | = lv_verid | |
| WERKS | = lv_werks | |
| PROCNR | = lv_procnr | |
| AUFNR | = lv_aufnr | |
| DATBI | = lv_datbi | |
| DIALOG | = lv_dialog | |
| FLG_UPD | = lv_flg_upd | |
| I_CKPHS | = lv_i_ckphs | |
| KSTRG | = lv_kstrg | |
| KSTRG_CHECK | = lv_kstrg_check | |
| MATNR | = lv_matnr | |
| IMPORTING | ||
| E_CKPE | = lv_e_ckpe | |
| TABLES | ||
| I_CKPE_TOTAL | = lt_i_ckpe_total | |
| I_IT_MSA_LINK | = lt_i_it_msa_link | |
| I_X_CKPE_TOTAL | = lt_i_x_ckpe_total | |
| EXCEPTIONS | ||
| NOT_ATTACHED = 1 | ||
| NOT_DELETED = 2 | ||
| NOT_FOUND = 3 | ||
| . " K_ITEM_ATTACH_SINGLE | ||
ABAP code using 7.40 inline data declarations to call FM K_ITEM_ATTACH_SINGLE
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 ARBPL FROM P3000 INTO @DATA(ld_arbpl). | ||||
| DATA(ld_arbpl) | = ' '. | |||
| "SELECT single OBART FROM KKHIE INTO @DATA(ld_obart). | ||||
| DATA(ld_obart) | = ' '. | |||
| "SELECT single APLAL FROM SAFK INTO @DATA(ld_plnal). | ||||
| DATA(ld_plnal) | = ' '. | |||
| "SELECT single PLNNR FROM SAFK INTO @DATA(ld_plnnr). | ||||
| DATA(ld_plnnr) | = ' '. | |||
| "SELECT single PSPNR FROM PRPS INTO @DATA(ld_pspnr). | ||||
| DATA(ld_pspnr) | = '00000000'. | |||
| "SELECT single AUFNR FROM SAFK INTO @DATA(ld_saufn). | ||||
| DATA(ld_saufn) | = ' '. | |||
| "SELECT single VERID FROM SAFK INTO @DATA(ld_verid). | ||||
| DATA(ld_verid) | = ' '. | |||
| "SELECT single WERKS FROM CKPE INTO @DATA(ld_werks). | ||||
| DATA(ld_werks) | = ' '. | |||
| "SELECT single PROCNR FROM CKPE INTO @DATA(ld_procnr). | ||||
| DATA(ld_procnr) | = 000000000000. | |||
| "SELECT single AUFNR FROM AUFK INTO @DATA(ld_aufnr). | ||||
| DATA(ld_aufnr) | = ' '. | |||
| "SELECT single DATBI FROM CKPE INTO @DATA(ld_datbi). | ||||
| DATA(ld_datbi) | = '99991231'. | |||
| DATA(ld_dialog) | = ' '. | |||
| DATA(ld_flg_upd) | = 'I'. | |||
| "SELECT single KSTRG FROM CKPE INTO @DATA(ld_kstrg). | ||||
| DATA(ld_kstrg) | = ' '. | |||
| DATA(ld_kstrg_check) | = ' '. | |||
| "SELECT single MATNR FROM MARA INTO @DATA(ld_matnr). | ||||
| DATA(ld_matnr) | = ' '. | |||
Search for further information about these or an SAP related objects