12-01-2008 12:58 PM
hi,
my bapi_po_create is working fine if its a PO contains a line item that is a service.but in cases where in a po,one line item is a service entry and other is not then BAPI is throwing error i.e.
In case of account assignment, please enter acc. assignment data for item
what can be the reason.
12-01-2008 1:16 PM
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.
*LOOP AT it_final2 INTO wa_final2.
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-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.
*ENDLOOP.
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.
12-01-2008 8:12 PM
Hi Manikant
I don`t think it`s a BAPI issue ,It is something related to Data .
Check the data you are pasing to BAPI.
Regards
Neha
12-02-2008 5:45 AM
hi,
can BAPI_PO_CREATE1 can be used to create POs that consist of one line item that is a service line item and the other is a normal line item.
12-02-2008 7:03 AM
12-02-2008 12:01 PM
hi,
can any one explain the logic when working with a PO that contains both a service line item and a normal PO item.
as my BAPI is not able to work in cases where PO contains service and normal items.it is working fine if PO is only a service line item or if PO is a normal PO.
any clue.
12-03-2008 4:44 AM
12-03-2008 4:49 AM
Hi
If the Item Category is D, in the PO, then you need to populate the Services structure also. The combinations vary. For example, the Account Assignment is N and Item Category is D, then You need to fill services. If it is only N, then you wont require services.
So, based on Item Category, the structures that are need to be filled changes. To get more clarity, I would suggest you create a PO or take the help of Functional guy and then see how the PO changes based on the combinations given in Account Assignment and Item Category.
Regards,
Vishwa.