SAP ME_CREATE_SUB_ITEM Function Module for NOTRANSL: Unterpositionen generieren für Einkaufsbeleg
ME_CREATE_SUB_ITEM is a standard me create sub item SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for NOTRANSL: Unterpositionen generieren für Einkaufsbeleg 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 me create sub item FM, simply by entering the name ME_CREATE_SUB_ITEM into the relevant SAP transaction such as SE37 or SE38.
Function Group: MESU
Program Name: SAPLMESU
Main Program: SAPLMESU
Appliation area: M
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function ME_CREATE_SUB_ITEM 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 'ME_CREATE_SUB_ITEM'"NOTRANSL: Unterpositionen generieren für Einkaufsbeleg.
EXPORTING
I_EBELN = "Purchasing Document Number
* I_EMATN = ' ' "Material
* I_INFNR = ' ' "Number of Purchasing Info Record
* I_KNTTP = ' ' "Account Assignment Category
* I_KONNR = ' ' "Number of Principal Purchase Agreement
* I_KTPNR = '0' "Item Number of Principal Purchase Agreement
* I_KUNNR = ' ' "Customer
* I_LGORT = ' ' "Storage Location
* I_MATKL = ' ' "Material Group
* I_MEINS = ' ' "Purchase Order Unit of Measure
* I_PSTYP = '0' "Item Category
* I_STAKO = "Document with time-dependent conditions
* I_TWRKZ = ' ' "Partial Invoice Indicator
* I_TXZ01 = ' ' "Short Text
* I_VRTKZ = ' ' "Distribution indicator for multiple account assignment
* I_WERKS = ' ' "Plant
* I_KANBA = ' ' "Kanban Indicator
* I_ABELN = "Allocation Table Number
* I_ABELP = "Item number of allocation table
* I_SCREEN = "
* I_BPUEB = "
* I_NETPR = "Net Price
I_UEBPO = "Higher-Level Item in Purchasing Documents
* I_PEINH = '1' "Price Unit
* I_BPRME = "Order Price Unit (Purchasing)
* I_BPUMZ = '1' "Conversion Factor Numerator
* I_BPUMN = '1' "Conversion Factor Denominator
* I_PACKNO = '0000000000' "Package number
I_BSTYP = "Purchasing Document Category
I_UPTYP = "Subitem Category, Purchasing Document
* I_EKPO = "Purchasing Document Item
* I_STEP_1 = "
* I_STEP_2 = "
* I_ADRNR = ' ' "Manual address number in purchasing document item
TABLES
XEKET = "Table of Schedule Lines
* XEKKN = "Table of Account Assignments
IMPORTING Parameters details for ME_CREATE_SUB_ITEM
I_EBELN - Purchasing Document Number
Data type: EKKO-EBELNOptional: No
Call by Reference: No ( called with pass by value option)
I_EMATN - Material
Data type: EKPO-EMATNDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_INFNR - Number of Purchasing Info Record
Data type: EINE-INFNRDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_KNTTP - Account Assignment Category
Data type: EKPO-KNTTPDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_KONNR - Number of Principal Purchase Agreement
Data type: EKKO-KONNRDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_KTPNR - Item Number of Principal Purchase Agreement
Data type: EKPO-KTPNRDefault: '0'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_KUNNR - Customer
Data type: EKPO-KUNNRDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_LGORT - Storage Location
Data type: EKPO-LGORTDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_MATKL - Material Group
Data type: EKPO-MATKLDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_MEINS - Purchase Order Unit of Measure
Data type: EKPO-MEINSDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_PSTYP - Item Category
Data type: EKPO-PSTYPDefault: '0'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_STAKO - Document with time-dependent conditions
Data type: EKKO-STAKOOptional: Yes
Call by Reference: No ( called with pass by value option)
I_TWRKZ - Partial Invoice Indicator
Data type: EKPO-TWRKZDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_TXZ01 - Short Text
Data type: EKPO-TXZ01Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_VRTKZ - Distribution indicator for multiple account assignment
Data type: EKPO-VRTKZDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_WERKS - Plant
Data type: EKPO-WERKSDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_KANBA - Kanban Indicator
Data type: EKPO-KANBADefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_ABELN - Allocation Table Number
Data type: EKPO-ABELNOptional: Yes
Call by Reference: No ( called with pass by value option)
I_ABELP - Item number of allocation table
Data type: EKPO-ABELPOptional: Yes
Call by Reference: No ( called with pass by value option)
I_SCREEN -
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
I_BPUEB -
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
I_NETPR - Net Price
Data type: EKPO-NETPROptional: Yes
Call by Reference: No ( called with pass by value option)
I_UEBPO - Higher-Level Item in Purchasing Documents
Data type: EKPO-UEBPOOptional: No
Call by Reference: No ( called with pass by value option)
I_PEINH - Price Unit
Data type: EKPO-PEINHDefault: '1'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_BPRME - Order Price Unit (Purchasing)
Data type: EKPO-BPRMEOptional: Yes
Call by Reference: No ( called with pass by value option)
I_BPUMZ - Conversion Factor Numerator
Data type: EKPO-BPUMZDefault: '1'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_BPUMN - Conversion Factor Denominator
Data type: EKPO-BPUMNDefault: '1'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_PACKNO - Package number
Data type: EKPO-PACKNODefault: '0000000000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_BSTYP - Purchasing Document Category
Data type: EKKO-BSTYPOptional: No
Call by Reference: No ( called with pass by value option)
I_UPTYP - Subitem Category, Purchasing Document
Data type: EKPO-UPTYPOptional: No
Call by Reference: No ( called with pass by value option)
I_EKPO - Purchasing Document Item
Data type: EKPOOptional: Yes
Call by Reference: No ( called with pass by value option)
I_STEP_1 -
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
I_STEP_2 -
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
I_ADRNR - Manual address number in purchasing document item
Data type: EKPO-ADRNRDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for ME_CREATE_SUB_ITEM
XEKET - Table of Schedule Lines
Data type: EKETOptional: No
Call by Reference: No ( called with pass by value option)
XEKKN - Table of Account Assignments
Data type: EKKNOptional: Yes
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for ME_CREATE_SUB_ITEM 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: | ||||
| lt_xeket | TYPE STANDARD TABLE OF EKET, " | |||
| lv_i_ebeln | TYPE EKKO-EBELN, " | |||
| lv_i_ematn | TYPE EKPO-EMATN, " SPACE | |||
| lv_i_infnr | TYPE EINE-INFNR, " SPACE | |||
| lv_i_knttp | TYPE EKPO-KNTTP, " SPACE | |||
| lv_i_konnr | TYPE EKKO-KONNR, " SPACE | |||
| lv_i_ktpnr | TYPE EKPO-KTPNR, " '0' | |||
| lv_i_kunnr | TYPE EKPO-KUNNR, " SPACE | |||
| lv_i_lgort | TYPE EKPO-LGORT, " SPACE | |||
| lv_i_matkl | TYPE EKPO-MATKL, " SPACE | |||
| lv_i_meins | TYPE EKPO-MEINS, " SPACE | |||
| lv_i_pstyp | TYPE EKPO-PSTYP, " '0' | |||
| lt_xekkn | TYPE STANDARD TABLE OF EKKN, " | |||
| lv_i_stako | TYPE EKKO-STAKO, " | |||
| lv_i_twrkz | TYPE EKPO-TWRKZ, " SPACE | |||
| lv_i_txz01 | TYPE EKPO-TXZ01, " SPACE | |||
| lv_i_vrtkz | TYPE EKPO-VRTKZ, " SPACE | |||
| lv_i_werks | TYPE EKPO-WERKS, " SPACE | |||
| lv_i_kanba | TYPE EKPO-KANBA, " SPACE | |||
| lv_i_abeln | TYPE EKPO-ABELN, " | |||
| lv_i_abelp | TYPE EKPO-ABELP, " | |||
| lv_i_screen | TYPE EKPO, " | |||
| lv_i_bpueb | TYPE EKPO, " | |||
| lv_i_netpr | TYPE EKPO-NETPR, " | |||
| lv_i_uebpo | TYPE EKPO-UEBPO, " | |||
| lv_i_peinh | TYPE EKPO-PEINH, " '1' | |||
| lv_i_bprme | TYPE EKPO-BPRME, " | |||
| lv_i_bpumz | TYPE EKPO-BPUMZ, " '1' | |||
| lv_i_bpumn | TYPE EKPO-BPUMN, " '1' | |||
| lv_i_packno | TYPE EKPO-PACKNO, " '0000000000' | |||
| lv_i_bstyp | TYPE EKKO-BSTYP, " | |||
| lv_i_uptyp | TYPE EKPO-UPTYP, " | |||
| lv_i_ekpo | TYPE EKPO, " | |||
| lv_i_step_1 | TYPE EKPO, " | |||
| lv_i_step_2 | TYPE EKPO, " | |||
| lv_i_adrnr | TYPE EKPO-ADRNR. " SPACE |
|   CALL FUNCTION 'ME_CREATE_SUB_ITEM' "NOTRANSL: Unterpositionen generieren für Einkaufsbeleg |
| EXPORTING | ||
| I_EBELN | = lv_i_ebeln | |
| I_EMATN | = lv_i_ematn | |
| I_INFNR | = lv_i_infnr | |
| I_KNTTP | = lv_i_knttp | |
| I_KONNR | = lv_i_konnr | |
| I_KTPNR | = lv_i_ktpnr | |
| I_KUNNR | = lv_i_kunnr | |
| I_LGORT | = lv_i_lgort | |
| I_MATKL | = lv_i_matkl | |
| I_MEINS | = lv_i_meins | |
| I_PSTYP | = lv_i_pstyp | |
| I_STAKO | = lv_i_stako | |
| I_TWRKZ | = lv_i_twrkz | |
| I_TXZ01 | = lv_i_txz01 | |
| I_VRTKZ | = lv_i_vrtkz | |
| I_WERKS | = lv_i_werks | |
| I_KANBA | = lv_i_kanba | |
| I_ABELN | = lv_i_abeln | |
| I_ABELP | = lv_i_abelp | |
| I_SCREEN | = lv_i_screen | |
| I_BPUEB | = lv_i_bpueb | |
| I_NETPR | = lv_i_netpr | |
| I_UEBPO | = lv_i_uebpo | |
| I_PEINH | = lv_i_peinh | |
| I_BPRME | = lv_i_bprme | |
| I_BPUMZ | = lv_i_bpumz | |
| I_BPUMN | = lv_i_bpumn | |
| I_PACKNO | = lv_i_packno | |
| I_BSTYP | = lv_i_bstyp | |
| I_UPTYP | = lv_i_uptyp | |
| I_EKPO | = lv_i_ekpo | |
| I_STEP_1 | = lv_i_step_1 | |
| I_STEP_2 | = lv_i_step_2 | |
| I_ADRNR | = lv_i_adrnr | |
| TABLES | ||
| XEKET | = lt_xeket | |
| XEKKN | = lt_xekkn | |
| . " ME_CREATE_SUB_ITEM | ||
ABAP code using 7.40 inline data declarations to call FM ME_CREATE_SUB_ITEM
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 EBELN FROM EKKO INTO @DATA(ld_i_ebeln). | ||||
| "SELECT single EMATN FROM EKPO INTO @DATA(ld_i_ematn). | ||||
| DATA(ld_i_ematn) | = ' '. | |||
| "SELECT single INFNR FROM EINE INTO @DATA(ld_i_infnr). | ||||
| DATA(ld_i_infnr) | = ' '. | |||
| "SELECT single KNTTP FROM EKPO INTO @DATA(ld_i_knttp). | ||||
| DATA(ld_i_knttp) | = ' '. | |||
| "SELECT single KONNR FROM EKKO INTO @DATA(ld_i_konnr). | ||||
| DATA(ld_i_konnr) | = ' '. | |||
| "SELECT single KTPNR FROM EKPO INTO @DATA(ld_i_ktpnr). | ||||
| DATA(ld_i_ktpnr) | = '0'. | |||
| "SELECT single KUNNR FROM EKPO INTO @DATA(ld_i_kunnr). | ||||
| DATA(ld_i_kunnr) | = ' '. | |||
| "SELECT single LGORT FROM EKPO INTO @DATA(ld_i_lgort). | ||||
| DATA(ld_i_lgort) | = ' '. | |||
| "SELECT single MATKL FROM EKPO INTO @DATA(ld_i_matkl). | ||||
| DATA(ld_i_matkl) | = ' '. | |||
| "SELECT single MEINS FROM EKPO INTO @DATA(ld_i_meins). | ||||
| DATA(ld_i_meins) | = ' '. | |||
| "SELECT single PSTYP FROM EKPO INTO @DATA(ld_i_pstyp). | ||||
| DATA(ld_i_pstyp) | = '0'. | |||
| "SELECT single STAKO FROM EKKO INTO @DATA(ld_i_stako). | ||||
| "SELECT single TWRKZ FROM EKPO INTO @DATA(ld_i_twrkz). | ||||
| DATA(ld_i_twrkz) | = ' '. | |||
| "SELECT single TXZ01 FROM EKPO INTO @DATA(ld_i_txz01). | ||||
| DATA(ld_i_txz01) | = ' '. | |||
| "SELECT single VRTKZ FROM EKPO INTO @DATA(ld_i_vrtkz). | ||||
| DATA(ld_i_vrtkz) | = ' '. | |||
| "SELECT single WERKS FROM EKPO INTO @DATA(ld_i_werks). | ||||
| DATA(ld_i_werks) | = ' '. | |||
| "SELECT single KANBA FROM EKPO INTO @DATA(ld_i_kanba). | ||||
| DATA(ld_i_kanba) | = ' '. | |||
| "SELECT single ABELN FROM EKPO INTO @DATA(ld_i_abeln). | ||||
| "SELECT single ABELP FROM EKPO INTO @DATA(ld_i_abelp). | ||||
| "SELECT single NETPR FROM EKPO INTO @DATA(ld_i_netpr). | ||||
| "SELECT single UEBPO FROM EKPO INTO @DATA(ld_i_uebpo). | ||||
| "SELECT single PEINH FROM EKPO INTO @DATA(ld_i_peinh). | ||||
| DATA(ld_i_peinh) | = '1'. | |||
| "SELECT single BPRME FROM EKPO INTO @DATA(ld_i_bprme). | ||||
| "SELECT single BPUMZ FROM EKPO INTO @DATA(ld_i_bpumz). | ||||
| DATA(ld_i_bpumz) | = '1'. | |||
| "SELECT single BPUMN FROM EKPO INTO @DATA(ld_i_bpumn). | ||||
| DATA(ld_i_bpumn) | = '1'. | |||
| "SELECT single PACKNO FROM EKPO INTO @DATA(ld_i_packno). | ||||
| DATA(ld_i_packno) | = '0000000000'. | |||
| "SELECT single BSTYP FROM EKKO INTO @DATA(ld_i_bstyp). | ||||
| "SELECT single UPTYP FROM EKPO INTO @DATA(ld_i_uptyp). | ||||
| "SELECT single ADRNR FROM EKPO INTO @DATA(ld_i_adrnr). | ||||
| DATA(ld_i_adrnr) | = ' '. | |||
Search for further information about these or an SAP related objects