Skip to Content

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Sep 03, 2008 at 07:21 PM

    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

    Add comment
    10|10000 characters needed characters exceeded