on 2021 Jan 07 2:45 AM
HI All
Please can you help to confirm why the standard FM BBP_PROCDOC_UPDATE Do not work when trying to update line item in SAP?
Below is the code I am using
it does not return any error message SY-SUBRC Is 0 but does not update the line item value
and If I Update the line item value I believe the header would automatically be updated?
Any help would be appreciated
CALL FUNCTION 'BBP_PROCDOC_RESET_BUFFER'.
CALL FUNCTION 'BBP_PROCDOC_GETDETAIL'
EXPORTING
i_guid = p_guid
i_with_itemdata = 'X'
i_without_header_totals = 'X'
IMPORTING
e_header = ls_header1
TABLES
e_item = lt_item
* e_partner = lt_partner
e_messages = lt_messages.
" DATA: lv_error type xfeld.
read table lt_messages INTO ls_messages with key msgty = 'E'.
if sy-subrc EQ 0.
lv_error = abap_true.
ENDIF.
.
clear ls_messages.
if lv_error is initial .
Loop at lt_item ASSIGNING <fs_item>.
if <fs_item>-VAL_CF is not INITIAL.
<fs_item>-GROSS_PRICE = <fs_item>-VAL_CF.
<fs_item>-PRICE = <fs_item>-VAL_CF.
<fs_item>-VALUE = <fs_item>-VAL_CF.
endif.
endloop .
CALL FUNCTION 'BBP_PROCDOC_UPDATE'
EXPORTING
i_bapimode = abap_false
* IV_CREATE_CHANGE_VERSION =
* I_PARK = 'X'
* I_SAVE = 'X'
i_header = ls_header1
iv_with_change_approval = space
IMPORTING
es_header = ls_header_new
TABLES
i_item = lt_item
* i_partner = lt_partner
e_messages = lt_messages
CHANGING
e_changed = lv_changed.
endif.
WAIT UP TO 5 SECONDS.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
.
Regards
Vinita
Request clarification before answering.
Hi Imre
This is a standalone program I have created for updating PO
The business requirement is that if the PO is being transaction completed it should also reduce the PO amount = GR amount
BBP_PROCDOC_UPDATE does not work I have tried it with a couple of options so I now used BBP_PD_PO_UPDATE and it automatically updates the header total as well after I modified the line item price in my program. So I have neither used a commit in BADI as this is a standalone report and nor did I do anything on those includes
Thanks for your help anyway might be worth to find out why that FM does not work though as I have seen the same issue being reported in multiple other threads as well
https://answers.sap.com/questions/2984798/po-their-line-items-and-invoice-indicator-to-be-up.html
Regards
Vinita
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Vinita,
Here is Imre from SAP SRM team. I understand you are using the above code to update the line item's price (What document? When is the above code triggered?) with the Confirmation value.
Do you correctly have the updated price copied in the <fs_item>-GROSS_PRICE ? If yes, have you tried to debug where the price gets lost then within the Function BBP_PROCDOC_UPDATE? That has a complex logic...
Also in case of price changes, a new Pricing might be triggered (see include LBBP_PDPRCF21, FORM FILL_OUTPUT_PARAMETERS).
COMMIT: We do not recommend to place any commit into the BAdi-implementations.
(At last, I do not see the clear business reason behind the above code as it will use the Confirmation value to update your document , that is, whatever Confirmation value is received it will update your valid price.)
Hope you manage to deal with the above issue.
Best regards,
Imre
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.