‎2010 Jul 13 11:12 AM
Hi guys i want to update the purchase requisition GL account field,
i'm using bapi_pr_change to do it but i'm havingo these errors:
- Sum of quantities >4.000< larger than total quantity
- With non-valuated GR, please also enter GR indicator
I think i'm missing one field to the bapi here is my code:
se obtiene la solicitud de pedido y la posicion
SELECT c~banfn c~bnfpo c~wepos
d~menge d~vproz d~erdat d~ps_psp_pnr d~ablad
INTO CORRESPONDING FIELDS OF TABLE ti_eban
FROM ( eban AS c
INNER JOIN ebkn AS d ON c~banfn = d~banfn
AND c~bnfpo = d~bnfpo ).
* por cada posicion se pasa a actualizar el campo gl_account
LOOP AT ti_eban ASSIGNING <fs_eban>.
BREAK-POINT.
CALL FUNCTION 'CONVERSION_EXIT_ABPSP_OUTPUT'
EXPORTING
input = <fs_eban>-ps_psp_pnr
IMPORTING
output = v_pspid
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
v_item-PREQ_ITEM = <fs_eban>-bnfpo.
v_item-GR_IND = <fs_eban>-wepos.
v_itemx-GR_IND = 'X'.
v_account-preq_item = <fs_eban>-bnfpo.
v_account-quantity = <fs_eban>-menge.
v_account-distr_perc = <fs_eban>-vproz.
v_account-ref_date = <fs_eban>-erdat.
v_account-creat_date = <fs_eban>-erdat.
v_account-wbs_element = v_pspid.
v_accountx-preq_item = <fs_eban>-bnfpo.
v_accountx-quantity = 'X'.
v_accountx-unload_pt = 'X'.
v_accountx-distr_perc = 'X'.
v_accountx-gl_account = 'X'.
v_accountx-ref_date = 'X'.
v_accountx-creat_date = 'X'.
v_accountx-wbs_element = 'X'.
APPEND v_item to ti_item.
APPEND v_itemx to ti_itemx.
CLEAR v_account-gl_account.
APPEND v_account TO ti_account.
APPEND v_accountx TO ti_accountx.
CALL FUNCTION 'BAPI_PR_CHANGE'
EXPORTING
number = <fs_eban>-banfn
TABLES
return = ti_return
pritem = ti_item
pritemx = ti_itemx
praccount = ti_account
praccountx = ti_accountx.
* si la bapi se ha ejecutado ok se hace commit y sino rollback
READ TABLE ti_return ASSIGNING <fs_ret> WITH KEY type = 'E'.
IF sy-subrc EQ 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
v_eban-banfn = <fs_eban>-banfn.
v_eban-bnfpo = <fs_eban>-bnfpo.
APPEND v_eban TO ti_eban2.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
CLEAR v_account.
REFRESH ti_account.
CLEAR v_accountx.
REFRESH ti_accountx.
CLEAR v_item.
CLEAR v_itemx.
REFRESH ti_item.
REFRESH ti_itemx.
REFRESH ti_return.amy idea?
Best regards
Jon
‎2010 Jul 14 8:05 AM
‎2010 Oct 21 9:06 AM
Hi Jon,
I'm having the same problem details, please can you explain how we solve
Thank you very much