2012 Apr 25 8:55 AM
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.
.
2012 Apr 26 12:46 PM
see the following example
REPORT ZPURCHASEORDER.
data:
header like BAPIMEPOHEADER,
headerx like BAPIMEPOHEADERX,
it_item like standard table of BAPIMEPOITEM,
it_itemx like standard table of BAPIMEPOITEMX,
return like standard table of BAPIRET2,
wa_item like BAPIMEPOITEM,
wa_itemx like BAPIMEPOITEMX,
p_int type i,
p_matnr like mara-matnr,
p_pono like ekko-ebeln.
DATA: BEGIN OF BAPIRETURN OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA: END OF BAPIRETURN.
constants:
c_x type c value 'X'.
header-comp_code = '3000'.
header-doc_type = 'DP25'.
header-creat_date = sy-datum.
header-item_intvl = '10'.
header-vendor = 'ARAMI-00'.
header-langu = sy-langu.
header-pmnttrms = '0001'.
header-purch_org = '3000'.
header-pur_group = '010'.
header-currency = 'USD'.
headerx-comp_code = c_x.
headerx-doc_type = c_x.
headerx-creat_date = c_x.
headerx-item_intvl = c_x .
headerx-vendor = c_x.
headerx-langu = c_x.
headerx-pmnttrms = c_x .
headerx-purch_org = c_x.
headerx-pur_group = c_x.
p_int = p_int + 10.
wa_item-po_item = p_int.
p_matnr = 'T-SRM01'.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = p_matnr
IMPORTING
output = p_matnr
EXCEPTIONS
length_error = 1
OTHERS = 2.
*IF sy-subrc = 0.
*MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
*ENDIF.
wa_item-material = p_matnr.
wa_item-plant = '3200'.
wa_item-quantity = 100.
wa_item-conf_ctrl = 'Z01'.
wa_item-ACKN_REQD = 'X'.
wa_item-ACCTASSCAT = 'K'.
WA_ITEM-ERS = ''.
APPEND wa_item TO it_item.
wa_itemx-po_item = p_int.
wa_itemx-material = c_x.
wa_itemx-plant = c_x .
wa_itemx-stge_loc = c_x .
wa_itemx-quantity = c_x .
wa_itemx-item_cat = c_x .
wa_itemx-acctasscat = c_x .
wa_itemx-conf_ctrl = 'X'.
wa_itemx-ACKN_REQD = 'X'.
WA_ITEMX-ERS = 'X'.
APPEND wa_itemx TO it_itemx.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = header
poheaderx = headerx
IMPORTING
exppurchaseorder = p_pono
TABLES
return = return
poitem = it_item
poitemx = it_itemx.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = BAPIRETURN.
write:/ p_pono.
2012 Apr 29 4:55 AM
HI Krupa,
I my question i said that i can create Service task order(type of PO) but its creating without Invoice Plan.
I am looking for the solution where STO(PO) to be created using this BAPI with Invoice plan.
Atul
2012 Sep 19 10:28 PM
Hello, I'm facing the same problem. SAP Note 197958 says it is not possible to create invoicing plans through this BAPI. The thing is, this Note also says the solution will be available as of release 6.04 of SAP ERP. The system I'm working on is exactly this level, but despite that the BAPI doesn't work. Purchase order is created, but the invoicing plan is lacking.
Has anyone else got this problem?. Thanks in advance.