Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

PR Creation using BAPI_PR_CREATE

Former Member
0 Likes
2,186

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

5 REPLIES 5
Read only

Former Member
0 Likes
1,342

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.

Read only

Former Member
0 Likes
1,342

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

.

Read only

Former Member
0 Likes
1,342

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

Read only

0 Likes
1,342

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.

Read only

Former Member
0 Likes
1,342

This message was moderated.