2006 Jul 12 7:37 PM
Hello,
I have a need to write a program to create an assembly purchase order and update the material component screen for the item.
I have looked at BAPI_PO_CREATE and BAPI_PO_CREATE1 but cannot see a way to update the component screen in these.
Does anyone have any ideas?
Thanks!
Susanna
Hello,
I have a need to write a program to create an assembly purchase order and update the material component screen for the item.
I have looked at BAPI_PO_CREATE and BAPI_PO_CREATE1 but cannot see a way to update the component screen in these.
Does anyone have any ideas?
Thanks!
Susanna
2006 Jul 13 6:52 AM
Hi Susanna ,
u have to make use of
PO_ITEMS STRUCTURE BAPIEKPOC
PO_ITEM_ADD_DATA STRUCTURE BAPIEKPOA OPTIONAL
PO_ITEM_SCHEDULES STRUCTURE BAPIEKET
PO_ITEM_ACCOUNT_ASSIGNMENT STRUCTURE BAPIEKKN OPTIONAL
PO_ITEM_TEXT STRUCTURE BAPIEKPOTX OPTIONAL
regards
Prabhu
2006 Jul 13 4:07 PM
Thanks, but where would I put the component data? I still don't see a place for it in any of those structures.
Also I forgot to mention that as I create the PO I need to generate the batch for the line item ('Create batch' button on the item's material tab). Is there a way to do this through the bapi?
Thanks,
Susanna
2008 Nov 04 8:36 AM
Hi Susanna
You properly found a work around on this issue but I had the same challenge as you and I like to share my experience with you and others.
According to the documentation of the BAPI_PO_CREATE1 it is not possible to create subcontracting components (you can only use existing ones). This means that the material you are using has to be assigned to an existing BOM (Bill of Material), fill the ITEM-CAT of structure POITEM with u2018Lu2019 and leave the structure POCOMPONENTS empty. This will fill the component list. If the ITEM-CAT of structure POITEM is not filled with u2018Lu2019 the component list is not filled. Use transaction CS01/CS02 to create or maintain material BOM. To allow the material it self to be part of the BOM set recursiveness allowed. Following sample code will create a purchase order with a component list:
DATA:
meit_poitem TYPE STANDARD TABLE OF bapimepoitem,
meit_poitemx TYPE STANDARD TABLE OF bapimepoitemx,
meit_bapimeposchedule TYPE STANDARD TABLE OF bapimeposchedule,
meit_bapimeposchedulx TYPE STANDARD TABLE OF bapimeposchedulx,
meit_return TYPE bapiret2_tab,
mest_poheader TYPE bapimepoheader,
mest_poheaderx TYPE bapimepoheaderx,
mest_poitem LIKE LINE OF meit_poitem,
mest_poitemx LIKE LINE OF meit_poitemx,
mest_bapimeposchedule LIKE LINE OF meit_bapimeposchedule,
mest_bapimeposchedulx LIKE LINE OF meit_bapimeposchedulx,
mewf_ebeln_no TYPE ebeln.
Fill header
mest_poheader-doc_type = 'ZKDR'.
mest_poheaderx-doc_type = 'X'.
mest_poheader-vendor = '1234567890'.
mest_poheaderx-vendor = 'X'
mest_poheader-purch_org = 'EG99'.
mest_poheaderx-purch_org = 'X'.
mest_poheader-pur_group = 'E99'.
mest_poheaderx-pur_group = 'X'.
Fill items
mest_poitem-po_item = '000010'.
mest_poitemx-po_item = '000010'.
mest_poitem-material = '123456789012345678'
mest_poitemx-material = 'X'.
mest_poitem-short_text = 'Material description'.
mest_poitemx-short_text = 'X'.
mest_poitem-plant = '0099'.
mest_poitemx-plant = 'X'.
mest_poitem-quantity = '1.000'.
mest_poitemx-quantity = 'X'.
mest_poitem-po_unit = 'PCS'.
mest_poitemx-po_unit = 'X'.
mest_poitem-net_price = '0.01'.
mest_poitemx-net_price = 'X'.
mest_poitem-item_cat = ' L'.
mest_poitemx-item_cat = 'X'.
mest_poitem-ret_item = 'X'.
mest_poitemx-ret_item = 'X'.
append mest_poitem to meit_poitem.
append mest_poitemx to meit_poitemx.
Fill delivery
mest_bapimeposchedule-po_item = '000010'.
mest_bapimeposchedulx-po_item = '000010'.
mest_bapimeposchedulx-po_itemx = 'X'.
mest_bapimeposchedule-sched_line = 1.
mest_bapimeposchedulx-sched_line = 1.
mest_bapimeposchedulx-sched_linex = 'X'.
mest_bapimeposchedule-del_datcat_ext = ' '.
mest_bapimeposchedulx-del_datcat_ext = 'X'.
mest_bapimeposchedul-delivery_date = '01.1.2008'.
mest_bapimeposchedulx-delivery_date = 'X'.
mest_bapimeposchedule-quantity = '1.000'.
mest_bapimeposchedulx-quantity = 'X'.
append mest_bapimeposchedule to meit_bapimeposchedule.
append mest_bapimeposchedulx to meit_bapimeposchedulx.
call function 'BAPI_PO_CREATE1'
exporting
poheader = mest_poheader
poheaderx = mest_poheaderx
importing
exppurchaseorder = mewf_ebeln_no
tables
return = bapireturn
poitem = meit_poitem
poitemx = meit_poitemx
poschedule = meit_bapimeposchedule
poschedulex = meit_bapimeposchedulx.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |