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

Subcontract components BAPI_PO_CREATE1

Former Member
0 Likes
1,534

Hello,

i'm trying to use BAPI_PO_CREATE1 to create purchase orders with subcontracting components. I've been reading through many threads and everyone says that i need to load POCOMPONENT and POCOMPONENTX tables.

the problem is that i don't have those structures in my SAP system. I'm using sap r/3 4.7 (Release 470 patch level 0020)

should I upgrade patch level in order to be able to use them? I need to load components in the PO but i don't know how to handle it.

thanks in advance

3 REPLIES 3
Read only

Former Member
0 Likes
965

Hi,

pass the values this way :

DATA : C_IND TYPE C VALUE 'X',

L_PURCHASE TYPE BAPIMEPOHEADER-PO_NUMBER .

*Populating Item table

WA_ITEM-PREQ_NO = WA_EBAN-BANFN.

WA_ITEM-PREQ_ITEM = WA_EBAN-BNFPO.

WA_ITEM-PO_ITEM = WA_EBAN-BNFPO.

WA_ITEM-SHORT_TEXT = WA_EBAN-TXZ01.

WA_ITEM-MATERIAL = WA_EBAN-MATNR.

WA_ITEM-PLANT = WA_EBAN-WERKS.

WA_ITEM-STGE_LOC = WA_EBAN-LGORT.

WA_ITEM-QUANTITY = WA_EBAN-MENGE.

WA_ITEM-MATL_GROUP = WA_EBAN-MATKL.

WA_ITEM-NET_PRICE = WA_EBAN-PREIS.

APPEND WA_ITEM TO LT_ITEM.

WA_ITEMX-PREQ_NO = C_IND.

WA_ITEMX-PREQ_ITEM = C_IND.

WA_ITEMX-PO_ITEM = WA_EBAN-BNFPO.

WA_ITEMX-PO_ITEMX = C_IND.

WA_ITEMX-SHORT_TEXT = C_IND.

WA_ITEMX-MATERIAL = C_IND.

WA_ITEMX-PLANT = C_IND.

WA_ITEMX-STGE_LOC = C_IND.

WA_ITEMX-QUANTITY = C_IND.

WA_ITEMX-MATL_GROUP = C_IND.

WA_ITEMX-NET_PRICE = C_IND.

APPEND WA_ITEMX TO LT_ITEMX.

WA_HEADER-VENDOR = WA_EBAN-LIFNR.

WA_HEADER-PURCH_ORG = 'BMS'.

WA_HEADER-PUR_GROUP = WA_EBAN-EKGRP.

WA_HEADER-DOC_TYPE = WA_EBAN-BSART.

WA_HEADERX-VENDOR = C_IND.

WA_HEADERX-PURCH_ORG = C_IND.

WA_HEADERX-PUR_GROUP = C_IND.

WA_HEADERX-DOC_TYPE = C_IND.

CLEAR:L_PURCHASE.

REFRESH:LT_RETURN1.

CALL FUNCTION 'BAPI_PO_CREATE1'

EXPORTING

POHEADER = WA_HEADER

POHEADERX = WA_HEADERX

IMPORTING

EXPPURCHASEORDER = L_PURCHASE

TABLES

RETURN = LT_RETURN1

POITEM = LT_ITEM

POITEMX = LT_ITEMX.

MAY SOLVE UR PROBLEM...

Thanks & regards.

Read only

Former Member
0 Likes
965

Anusha, i can't see in your code where I can fill the components. what i want to create is a subcontract purchase order. so I need to set item_category = 'L' and i need to fill in components for materials, but i can't find structures to fill these components.

what i can see in your code is how to create a normal purchase order, but that's not my doubt.

regards, Fabian.

Read only

0 Likes
965

Hi Fabian,

see note 197958:

"3. You can only create subcontracting items if the components (bill of material) already exist. As of ERP 2005, you can transfer subcontracting components to BAPI_PO_CREATE1 and BAPI_PO_CHANGE. By doing this, you can create completely new BOMs."

Regards,

Martina