‎2009 Jul 27 2:16 PM
Hi Experts,
I need to create Purchase Requisiton for ME51N using the BAPI - BAPI_PR_CREATE. I used this BAPI and unable to create PR. Did any one used this BAPI to create PR. If created please let me know the input parameters for this BAPI.
Appreciate your input.. Thanks
Regards,
Kesav
‎2009 Jul 27 2:30 PM
call function 'BAPI_PR_CREATE'
exporting
prheader = it_header
prheaderx = it_headerx
importing
number = prnumber
tables
return = it_return
pritem = it_pritem
pritemx = it_pritemx
praccount = it_account
praccountx = it_accountx.
‎2009 Jul 27 2:36 PM
Hi,
I have used the bapi 'BAPI_REQUISITION_CREATE'. See if the code below helps:
Fill items table to place as input in Bapi
LOOP AT it_plaf1.
items-preq_item = preq_item.
items-doc_type = 'STPR'.
items-pur_group = it_plaf1-ekgrp.
items-created_by = sy-uname.
items-preq_name = it_plaf1-dispo.
items-material = it_plaf1-matnr.
items-plant = it_plaf1-plwrk.
items-mat_grp = it_plaf1-matkl.
items-quantity = it_plaf1-gsmng.
items-unit = it_plaf1-meins.
items-trackingno = it_plaf1-dispo.
items-deliv_date = sy-datum + 2.
items-gr_ind = 'X'.
items-ir_ind = 'X'.
APPEND items. CLEAR items.
ENDLOOP.
Bapi to create Purchase Requisition.
CALL FUNCTION 'BAPI_REQUISITION_CREATE'
IMPORTING
number = number
TABLES
requisition_items = items
return = return
.
‎2009 Jul 28 5:10 AM
Hi Balu,
Thanks for your reply. I can from the FM parameters you mentioned that header and headerx are Export parameters and those parameters are table parameters ??..
But I can see from the BAPI that those parameters are under changing param and can pass only one records. Can you please clarify this.
Thanks.
Regards,
Kesav
‎2009 Jul 28 5:14 AM
Hi,
You can pass only one record at a time while calling the BAPI, for the header and headerx parameters. Only the item level records can be more than one.
‎2009 Jul 28 7:12 AM