06-24-2011 8:37 PM
Hello everyone,
I'm using method POST of Badi ME_PROCESS_PO_CUST. I'm trying to change some data at item level (Z field where I store some calculus). The problem is my PO item info doesn't get updated. Here's a sample of my code:
DATA : lo_po_header_handle_mm TYPE REF TO cl_po_header_handle_mm.
lo_po_header_handle_mm ?= im_header.
lo_po_header_handle_mm->my_ibs_firewall_on = 'X'.
LOOP AT lt_items INTO ls_items.
CALL METHOD ls_items-item->get_data
RECEIVING
re_data = ls_item_data.
READ TABLE lt_ebelp TRANSPORTING NO FIELDS WITH KEY ebelp = ls_item_data-ebelp.
IF sy-subrc = 0.
ls_item_data-zz_rc = lv_calc.
CALL METHOD ls_items-item->set_data
EXPORTING
im_data = ls_item_data.
ENDIF.
ENDLOOP.
What is wrong in my code?
Thank you in advance
06-25-2011 10:20 AM
Hi,
I am facing the same problem. If you find a solution please share it.
Thanks
06-25-2011 12:04 PM
hi ,
use below code
DATA : lo_po_header_handle_mm TYPE REF TO cl_po_header_handle_mm.
lo_po_header_handle_mm ?= im_header.
lo_po_header_handle_mm->my_ibs_firewall_on = 'X'.
data : ls_item type mepoitem .
ls_item = im_item->get_data( ) .
READ TABLE lt_ebelp TRANSPORTING NO FIELDS WITH KEY ebelp = ls_item-ebelp.
IF sy-subrc = 0.
ls_item-zz_rc = lv_calc.
CALL METHOD ls_items-item->set_data
EXPORTING
im_data = ls_item.
ENDIF.
ENDLOOP.
where is your field lv_calc coming from ? or it should be lt_ebelp-lv_calc ?
regards
Deepak.
Edited by: Deepak Dhamat on Jun 25, 2011 1:05 PM
Edited by: Deepak Dhamat on Jun 25, 2011 1:06 PM
06-25-2011 1:07 PM
Thank you for your reply Deepack.
My Z field is assigned before the loop at table LT_EBELP. The calculus is this:
ls_item_data-zz_rc = ls_mard-labst - ls_item_data-zz_rc.
Your code does the same as mine, the item data remains unchanged.
Maybe in POST method only header data can be changed?
06-25-2011 1:32 PM
Hi Alata,
use PROCESS_ITEM in BADI ME_PROCESS_PO_CUST to apply your changes.
Regards,
Clemens
06-25-2011 2:13 PM
But I only want to chage the items after the release of the purchase document. So method PROCESS_ITEM does not fit my requirement.
06-25-2011 2:19 PM
06-27-2011 8:28 AM
But the commit is not yet made. Therefore I cannot use BAPI_PO_CHANGE.
Maybe I will try to enhance after the commit.
06-28-2011 11:28 AM
Hi AlatacontigU ,
did you try to use "BAPI_PO_CHANGE" in BADI "ME_PROCESS_PO_CUST" Method "CLOSE"?
Method "CLOSE" is triggerd after posting the PO and processing the next PO.
Regards
REA