Skip to Content
author's profile photo Former Member
Former Member

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

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 14, 2009 at 08:30 AM

    Search for poservice structure in the code.

    cheers

    Aveek

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 14, 2009 at 05:23 AM
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.