SAP Function Modules

ME_CREATE_PO SAP Function module - Create Purchase Order







ME_CREATE_PO is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name ME_CREATE_PO into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: OIAL
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM ME_CREATE_PO - ME CREATE PO





CALL FUNCTION 'ME_CREATE_PO' "Create Purchase Order
  EXPORTING
*   i_bedat = SY-DATUM          " ekko-bedat
    i_bsart =                   " ekko-bsart
*   i_bukrs =                   " ekko-bukrs
*   i_ekgrp =                   " ekko-ekgrp
    i_ekorg =                   " ekko-ekorg
*   i_konnr = SPACE             " ekko-konnr
*   i_lifnr = SPACE             " ekko-lifnr
*   i_reswk = SPACE             " ekko-reswk
*   i_new_item_number = 'X'     "
*   i_no_commit = ' '           " ekpo-statu
*   i_ticket_header =           " oij_el_ticket_h  Universal Ticket Table
*   i_ticket_item =             " oij_el_ticket_i  Universal Ticket Item Table
*   i_oijnomh =                 " oijnomh       OIL-TSW: Nomination Header Table
*   i_oijnomi =                 " oijnomi       OIL-TSW: Nomination Item
*   i_oijimport =               " roij_el_import  TSW: Parameter Imported to CIP Functions
  IMPORTING
    e_ebeln =                   " ekko-ebeln
    e_ebelp =                   " ekpo-ebelp
  TABLES
    xeket =                     " eket
    xekkn =                     " ekkn
    xekpo =                     " iekpo
    xemsg =                     " emsg
  EXCEPTIONS
    ERROR_HEADER = 1            "
    NO_ITEMS = 2                "
    .  "  ME_CREATE_PO

ABAP code example for Function Module ME_CREATE_PO





The ABAP code below is a full code listing to execute function module ME_CREATE_PO including all data declarations. The code uses 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 original method of declaring data variables up front. 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).

DATA:
ld_e_ebeln  TYPE EKKO-EBELN ,
ld_e_ebelp  TYPE EKPO-EBELP ,
it_xeket  TYPE STANDARD TABLE OF EKET,"TABLES PARAM
wa_xeket  LIKE LINE OF it_xeket ,
it_xekkn  TYPE STANDARD TABLE OF EKKN,"TABLES PARAM
wa_xekkn  LIKE LINE OF it_xekkn ,
it_xekpo  TYPE STANDARD TABLE OF IEKPO,"TABLES PARAM
wa_xekpo  LIKE LINE OF it_xekpo ,
it_xemsg  TYPE STANDARD TABLE OF EMSG,"TABLES PARAM
wa_xemsg  LIKE LINE OF it_xemsg .


SELECT single BEDAT
FROM EKKO
INTO @DATA(ld_i_bedat).


SELECT single BSART
FROM EKKO
INTO @DATA(ld_i_bsart).


SELECT single BUKRS
FROM EKKO
INTO @DATA(ld_i_bukrs).


SELECT single EKGRP
FROM EKKO
INTO @DATA(ld_i_ekgrp).


SELECT single EKORG
FROM EKKO
INTO @DATA(ld_i_ekorg).


SELECT single KONNR
FROM EKKO
INTO @DATA(ld_i_konnr).


SELECT single LIFNR
FROM EKKO
INTO @DATA(ld_i_lifnr).


SELECT single RESWK
FROM EKKO
INTO @DATA(ld_i_reswk).

DATA(ld_i_new_item_number) = 'some text here'.

SELECT single STATU
FROM EKPO
INTO @DATA(ld_i_no_commit).

DATA(ld_i_ticket_header) = 'Check type of data required'.
DATA(ld_i_ticket_item) = 'Check type of data required'.
DATA(ld_i_oijnomh) = 'Check type of data required'.
DATA(ld_i_oijnomi) = 'Check type of data required'.
DATA(ld_i_oijimport) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_xeket to it_xeket.

"populate fields of struture and append to itab
append wa_xekkn to it_xekkn.

"populate fields of struture and append to itab
append wa_xekpo to it_xekpo.

"populate fields of struture and append to itab
append wa_xemsg to it_xemsg. . CALL FUNCTION 'ME_CREATE_PO' EXPORTING * i_bedat = ld_i_bedat i_bsart = ld_i_bsart * i_bukrs = ld_i_bukrs * i_ekgrp = ld_i_ekgrp i_ekorg = ld_i_ekorg * i_konnr = ld_i_konnr * i_lifnr = ld_i_lifnr * i_reswk = ld_i_reswk * i_new_item_number = ld_i_new_item_number * i_no_commit = ld_i_no_commit * i_ticket_header = ld_i_ticket_header * i_ticket_item = ld_i_ticket_item * i_oijnomh = ld_i_oijnomh * i_oijnomi = ld_i_oijnomi * i_oijimport = ld_i_oijimport IMPORTING e_ebeln = ld_e_ebeln e_ebelp = ld_e_ebelp TABLES xeket = it_xeket xekkn = it_xekkn xekpo = it_xekpo xemsg = it_xemsg EXCEPTIONS ERROR_HEADER = 1 NO_ITEMS = 2 . " ME_CREATE_PO
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_e_ebeln  TYPE EKKO-EBELN ,
ld_i_bedat  TYPE EKKO-BEDAT ,
it_xeket  TYPE STANDARD TABLE OF EKET ,
wa_xeket  LIKE LINE OF it_xeket,
ld_e_ebelp  TYPE EKPO-EBELP ,
ld_i_bsart  TYPE EKKO-BSART ,
it_xekkn  TYPE STANDARD TABLE OF EKKN ,
wa_xekkn  LIKE LINE OF it_xekkn,
ld_i_bukrs  TYPE EKKO-BUKRS ,
it_xekpo  TYPE STANDARD TABLE OF IEKPO ,
wa_xekpo  LIKE LINE OF it_xekpo,
ld_i_ekgrp  TYPE EKKO-EKGRP ,
it_xemsg  TYPE STANDARD TABLE OF EMSG ,
wa_xemsg  LIKE LINE OF it_xemsg,
ld_i_ekorg  TYPE EKKO-EKORG ,
ld_i_konnr  TYPE EKKO-KONNR ,
ld_i_lifnr  TYPE EKKO-LIFNR ,
ld_i_reswk  TYPE EKKO-RESWK ,
ld_i_new_item_number  TYPE STRING ,
ld_i_no_commit  TYPE EKPO-STATU ,
ld_i_ticket_header  TYPE OIJ_EL_TICKET_H ,
ld_i_ticket_item  TYPE OIJ_EL_TICKET_I ,
ld_i_oijnomh  TYPE OIJNOMH ,
ld_i_oijnomi  TYPE OIJNOMI ,
ld_i_oijimport  TYPE ROIJ_EL_IMPORT .


SELECT single BEDAT
FROM EKKO
INTO ld_i_bedat.


"populate fields of struture and append to itab
append wa_xeket to it_xeket.

SELECT single BSART
FROM EKKO
INTO ld_i_bsart.


"populate fields of struture and append to itab
append wa_xekkn to it_xekkn.

SELECT single BUKRS
FROM EKKO
INTO ld_i_bukrs.


"populate fields of struture and append to itab
append wa_xekpo to it_xekpo.

SELECT single EKGRP
FROM EKKO
INTO ld_i_ekgrp.


"populate fields of struture and append to itab
append wa_xemsg to it_xemsg.

SELECT single EKORG
FROM EKKO
INTO ld_i_ekorg.


SELECT single KONNR
FROM EKKO
INTO ld_i_konnr.


SELECT single LIFNR
FROM EKKO
INTO ld_i_lifnr.


SELECT single RESWK
FROM EKKO
INTO ld_i_reswk.

ld_i_new_item_number = 'some text here'.

SELECT single STATU
FROM EKPO
INTO ld_i_no_commit.

ld_i_ticket_header = 'Check type of data required'.
ld_i_ticket_item = 'Check type of data required'.
ld_i_oijnomh = 'Check type of data required'.
ld_i_oijnomi = 'Check type of data required'.
ld_i_oijimport = 'Check type of data required'.

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name ME_CREATE_PO or its description.