Hi Guys,
I am trying to create Service Task Order with invoice plan, reference to contract using BAPI_PO_CREATE1, i am able to create STO but the invoice plan details are not getting passed to STO.
Below is part of my code. Can any one suggest me why invoice plan details are not coming in STO.
**Invoice
*Date
invoiceplanheader-doc_item = '00001'.
invoiceplanheaderx-doc_item = '00001'.
*CATEGORY
invoiceplanheader-category = '2'.
invoiceplanheaderx-category = 'X'.
*Inv type
invoiceplanheader-ip_type = '20'.
invoiceplanheaderx-ip_type = 'X'.
*Inv date
invoiceplanheader-start_date = sy-datum.
invoiceplanheaderx-start_date = 'X'.
*Billing plan
invoiceplanheader-period = '01'.
invoiceplanheaderx-period = 'X'.
*Sort field
READ TABLE it_field INTO wa_field INDEX 3.
invoiceplanheader-sort_fld = wa_field-value.
invoiceplanheaderx-sort_fld = 'X'.
*Inv Item
*Item
invoiceplanitem-doc_item = '00001'.
invoiceplanitemx-doc_item = '00001'.
*Inv value
invoiceplanitem-bill_value = wa_po_amt.
invoiceplanitemx-bill_value = 'X'.
*Date desp
invoiceplanitem-date_desc = '0001'.
invoiceplanitemx-date_desc = 'X'.
APPEND : invoiceplanitemx, invoiceplanitem,
invoiceplanheader, invoiceplanheaderx.
ENDAT.
ENDLOOP.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheaderx = poheaderx
poheader = poheader
IMPORTING
expheader = expheader
exppurchaseorder = exppurchaseorder
TABLES
poservices = poservices
posrvaccessvalues = posrvaccessvalues
return = return
poitem = poitem
poitemx = poitemx
poaccount = poaccount
poaccountx = poaccountx
invplanheader = invoiceplanheader
invplanheaderx = invoiceplanheaderx
invplanitem = invoiceplanitem
invplanitemx = invoiceplanitemx
EXCEPTIONS
OTHERS = 01.
.