Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ME_PROCESS_PO_CUST - Process Item assignments

I need some help with ME_PROCESS_PO_CUST. I am trying to use the POST method but I need a bit of help. My end goal is to loop at the account assignment items (the EKKN values) on the save. I was planning on doing something like the following:

DATA: it_items TYPE PURCHASE_ORDER_ITEMS,
          wa_items TYPE PURCHASE_ORDER_ITEM,
          it_accountings type PURCHASE_ORDER_ACCOUNTINGS,
          wa_accountings type PURCHASE_ORDER_ACCOUNTING.


CALL METHOD im_header->get_items
    RECEIVING
      re_items = it_items.

  loop at it_items into wa_items.

    CALL METHOD wa_items->get_accountings
      receiving
        re_accountings = it_accountings.


  endloop.

It looks to me like I need to continue in that manner until I get to the account assignment level. However, I get a syntax error on the second call. Can somebody help me get to the account assignment level?

Regards,

Davis

Tags:
Former Member replied

Hello Davis

There is just a minor error in your coding. The coding shown elow works.

METHOD if_ex_me_process_po_cust~post.
  DATA: lt_items TYPE purchase_order_items,
        ls_item  TYPE purchase_order_item,
        lt_accountings TYPE purchase_order_accountings,
        ls_accounting  TYPE purchase_order_accounting,
        ls_accdata     TYPE mepoaccounting.


  lt_items = im_header->get_items( ).

  LOOP AT lt_items INTO ls_item.
    REFRESH: lt_accountings.

    lt_accountings = ls_item-item->get_accountings( ).  " You wrote: CALL METHOD wa_items->get_accountings => wrong
    LOOP AT lt_accountings INTO ls_accounting.
      CLEAR: ls_accdata.
      ls_accdata = ls_accounting-accounting->get_data( ).

"     If condition is not met then inactivate accouting
      IF ( 1 = 2 ).
      ELSE.
        ls_accounting-accounting->invalidate( ).
      ENDIF.

    ENDLOOP.

  ENDLOOP.

ENDMETHOD.

Regards

Uwe

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question