Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ME_PROCESS_PO_CUST - Post method - Change item data

0 Likes
6,407

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

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

8 REPLIES 8
Read only

Former Member
0 Likes
3,501

Hi,

I am facing the same problem. If you find a solution please share it.

Thanks

Read only

deepak_dhamat
Active Contributor
0 Likes
3,501

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

Read only

0 Likes
3,501

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?

Read only

0 Likes
3,501

Hi Alata,

use PROCESS_ITEM in BADI ME_PROCESS_PO_CUST to apply your changes.

Regards,

Clemens

Read only

0 Likes
3,501

But I only want to chage the items after the release of the purchase document. So method PROCESS_ITEM does not fit my requirement.

Read only

0 Likes
3,501

... then use BAPI_PO_CHANGE.

Regards,

Clemens

Read only

0 Likes
3,501

But the commit is not yet made. Therefore I cannot use BAPI_PO_CHANGE.

Maybe I will try to enhance after the commit.

Read only

0 Likes
3,501

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