Application Development 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: 

BAPI_PO_CREATE1 Service Positions and Conditions with reference to P. Req.

Former Member
0 Kudos

Hello together,

i have the following problem. I used the BAPI BAPI_PO_CREATE1 to create Purchase Orders with reference to a purchase requsition. I have 2 different types of purchase requsitions. One with normal items and one with services.

So for both the creation of the purchase order works but if i add Conditions on Serivce Item Level to the purchase requsition they are not transfered to the purchase order.

To eliminate misunderstandings in a purchase order there are 3 diffent typs of conditions possible. First on header Level of the purchase order which can easly be filled with BAPI. The second on item level of the purchase order with can also easily be filled with BAPI and the last on service level which i doesn't found in BAPI. May be someone has an idea how to fill these conditions.

Here is my code:

header-doc_date = wa_eban-erdat.

value = 10.

  • Set COMP_CODE

select single bwkey from t001w into lv_bwkey

where werks = wa_eban-werks.

select single bukrs from t001k into header-comp_code

where bwkey = lv_bwkey.

header-doc_type = wa_eban-bsart.

header-vendor = wa_eban-flief.

header-created_by = sy-uname.

header-purch_org = wa_eban-ekorg.

header-pur_group = wa_eban-ekgrp.

header-langu = sy-langu.

header-status = 'B'.

header-indx = header-indx + 1.

append header.

headerx-doc_type = 'X'.

headerx-comp_code = 'X'.

headerx-vendor = 'X'.

headerx-purch_org = 'X'.

headerx-created_by = 'X'.

headerx-pur_group = 'X'.

headerx-created_by = 'X'.

headerx-langu = 'X'.

headerx-status = 'X'.

headerx-indx = header-indx.

append headerx.

*!-- Populating the BAPI for PO Item data

poitems-po_item = value.

poitems-material = wa_eban-matnr.

poitems-stge_loc = wa_eban-lgort.

poitems-plant = wa_eban-werks.

poitems-item_cat = wa_eban-pstyp.

poitems-po_unit = wa_eban-meins.

poitems-quantity = wa_eban-menge - wa_eban-bsmng.

poitems-preq_no = wa_eban-banfn.

poitems-preq_item = wa_eban-bnfpo.

poitems-tax_code = wa_eban-yy_mwskz.

poitems-indx = header-indx.

poitemsx-po_item = value.

poitemsx-material = 'X'.

poitemsx-stge_loc = 'X'.

poitemsx-plant = 'X'.

poitemsx-item_cat = 'X'.

poitemsx-preq_no = 'X'.

poitemsx-preq_item = 'X'.

poitemsx-po_unit = 'X'.

poitemsx-quantity = 'X'.

poitemsx-tax_code = 'X'.

poitemsx-indx = header-indx.

  • Create Construction with Services

if wa_eban-bsart eq 'ZXXXX.

poitemsx-pckg_no = 'X'.

poitems-pckg_no = wa_eban-packno.

endif.

append poitems.

append poitemsx.

*!-- Populating the BAPI for PO Item Schedule data

scd-po_item = value.

scd-sched_line = value1.

scd-delivery_date = wa_eban-lfdat.

scd-quantity = wa_eban-menge - wa_eban-bsmng.

scd-indx = header-indx.

append scd.

scdx-po_item = value.

scdx-sched_line = value1.

scdx-delivery_date = 'X'.

scdx-quantity = 'X'.

scdx-indx = header-indx.

append scdx.

*!-- Populating the BAPI for PO Item data for Accounting

account-po_item = value.

account-quantity = wa_eban-menge - wa_eban-bsmng.

account-indx = header-indx.

accountx-po_item = value.

accountx-quantity = 'X'.

accountx-indx = header-indx.

  • Create Construction with Services

if wa_eban-bsart eq 'ZXXX.

account-costcenter = wa_ebkn-kostl.

account-gl_account = wa_ebkn-sakto.

account-orderid = wa_ebkn-aufnr.

select single posid from prps into account-wbs_element where pspnr = wa_ebkn-ps_psp_pnr .

account-serial_no = wa_ebkn-zebkn.

accountx-costcenter = 'X'.

accountx-gl_account = 'X'.

accountx-orderid = 'X'.

accountx-wbs_element = 'X'.

accountx-serial_no = 'X'.

endif.

append account.

append accountx.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Search for poservice structure in the code.

cheers

Aveek

4 REPLIES 4

0 Kudos

Hi,

thanks for your answer but can you please tell me where I have to look?

Thanks

Former Member
0 Kudos

Search for poservice structure in the code.

cheers

Aveek

0 Kudos

Hi

i think this doesn't solve my problem. The purchase order is created but the already maintained conditions on service level aren't copied.

Thanks.