2014 Dec 04 5:04 PM
Hello guys,
I am trying to change WBS Element
on Account Assignment of Purchase Requisition
by BAPI_PR_CHANGE and i am facing some errors,
while by transaction ME52N I have no problem changing this data.
These are the errors faced by the bapi..
E | MEPO | 82 |
E | BAPI | 3 |
E | ME | 83 |
E | 6 | 70 |
E | MEPO | 80 |
and this is the code I wrote..
LOOP AT t_poitem INTO ls_poitem.
CLEAR: lv_number, ls_out, lt_account[], lt_accountx[].
READ TABLE t_out INTO ls_out
WITH KEY ebelp = ls_poitem-po_item.
lv_number = ls_poitem-preq_no. "Purchase Request Number
CALL FUNCTION 'BAPI_PR_GETDETAIL'
EXPORTING
number = lv_number
account_assignment = 'X'
* ITEM_TEXT = ' '
* HEADER_TEXT = ' '
* DELIVERY_ADDRESS = ' '
* VERSION = ' '
* SC_COMPONENTS = ' '
* SERIAL_NUMBERS = ' '
* SERVICES = ' '
* IMPORTING
* PRHEADER =
TABLES
* RETURN =
* PRITEM =
praccount = lt_praccount
* PRADDRDELIVERY =
* PRITEMTEXT =
* PRHEADERTEXT =
* EXTENSIONOUT =
* ALLVERSIONS =
* PRCOMPONENTS =
* SERIALNUMBERS =
* SERVICEOUTLINE =
* SERVICELINES =
* SERVICELIMIT =
* SERVICECONTRACTLIMITS =
* SERVICEACCOUNT =
* SERVICELONGTEXTS =
.
LOOP AT lt_praccount INTO ls_praccount.
CLEAR: ls_accountx, ls_account.
ls_account-preq_item = ls_praccount-preq_item.
ls_account-serial_no = ls_praccount-serial_no.
PERFORM get_wbs_posid USING ls_out-zcommessam
CHANGING ls_account-wbs_element.
APPEND ls_account TO lt_account.
ls_accountx-preq_item = ls_praccount-preq_item.
ls_accountx-serial_no = ls_praccount-serial_no.
ls_accountx-preq_itemx = 'X'.
ls_accountx-wbs_element = 'X'.
APPEND ls_accountx TO lt_accountx.
ENDLOOP.
CALL FUNCTION 'BAPI_PR_CHANGE'
EXPORTING
number = lv_number
* PRHEADER =
* PRHEADERX =
testrun = lv_test
* IMPORTING
* PRHEADEREXP =
TABLES
return = lt_return
* PRITEM =
* PRITEMX =
* PRITEMEXP =
* PRITEMSOURCE =
praccount = lt_account
* PRACCOUNTPROITSEGMENT =
praccountx = lt_accountx
* PRADDRDELIVERY =
* PRITEMTEXT =
* PRHEADERTEXT =
* EXTENSIONIN =
* EXTENSIONOUT =
* PRVERSION =
* PRVERSIONX =
* ALLVERSIONS =
* PRCOMPONENTS =
* PRCOMPONENTSX =
* SERVICEOUTLINE =
* SERVICEOUTLINEX =
* SERVICELINES =
* SERVICELINESX =
* SERVICELIMIT =
* SERVICELIMITX =
* SERVICECONTRACTLIMITS =
* SERVICECONTRACTLIMITSX =
* SERVICEACCOUNT =
* SERVICEACCOUNTX =
* SERVICELONGTEXTS =
* SERIALNUMBER =
* SERIALNUMBERX =
.
READ TABLE lt_return INTO ls_return WITH KEY type = 'E'.
IF sy-subrc NE 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ELSE.
e = 'X'.
EXIT.
ENDIF.
ENDLOOP.
2014 Dec 09 8:14 AM
Hi guys,
in the end we changed the flow of the report, setting status Cancelled on the Purchase Request using BAPI_REQUISITION_DELETE...in this way we were able after to modify Purchase Order via BAPI_PO_CHANGE.
Thanks anyway to everybody who answered..
2014 Dec 04 6:54 PM
Hi
Your error message is not clear.
But however just a remainder - make sure you use conversion exits for sending the WBS in that appropriate field and try.
CONVERSION_EXIT_ABPSP_INPUT Conversion External > Internal WBS Element Number
CONVERSION_EXIT_ABPSP_OUTPUT Conversion Internal > External WBS Element Number
Thanks & Regards
Eswar
2014 Dec 05 7:33 AM
Can you give more information on those received errors or analyze those yourself : e.g. for E083(ME) give the two first variables (missing data ?) and E080(MEPO) give a wrong status code.
Also if this form/method is called multiple times, don't forget to use BAPI_TRANSACTION_ROLLBACK to refresh buffers before trying next call of the BAPI.
Regards,
Raymond
2014 Dec 05 8:13 AM
But however just a remainder - make sure you use conversion exits for sending the WBS in that appropriate field and try.
I'll check this as soon as possible..
Can you give more information on those received errors or analyze those yourself : e.g. for E083(ME) give the two first variables (missing data ?) and E080(MEPO) give a wrong status code.
E ME 083: Insert Plant
E 06 070: Insert quantity
E MEPO 080: Elaboration status not valid
The strange thing for me is that I'm passing just the WBS, not any other data requested by return table..
Also if this form/method is called multiple times, don't forget to use BAPI_TRANSACTION_ROLLBACK to refresh buffers before trying next call of the BAPI.
Yes, by now i was debugging and trying to understand these errors...next step I'll put bapi_rollback after bapi if it faces some errors..
By now, thanks everyone for your suggestions..I'll let you know..
2014 Dec 05 10:25 AM
Did you look for OSS notes for your version, e.g. 1490525 - BAPI Err ME083 etc; MEREQX not clearing when held PReq saved and correction 1542925 for held PR ?
Regards,
Raymond
2014 Dec 09 8:14 AM
Hi guys,
in the end we changed the flow of the report, setting status Cancelled on the Purchase Request using BAPI_REQUISITION_DELETE...in this way we were able after to modify Purchase Order via BAPI_PO_CHANGE.
Thanks anyway to everybody who answered..
2016 Apr 27 4:13 PM
I recently encountered similar errors returned from BAPI_PR_CHANGE (i.e. errors MEPO 080 Processing status invalid and MEPO 082 Purchase requisition still contains items with errors). To fix the issue I applied OSS notes 1705810 and 1748182.
Regards,
JB