MM 获取抬头条件净价

SE24
IF_PURCHASE_ORDER_MM

IM_HEADER是个接口,由系统负责实例化。
其中GET_CONDITIONS是获取抬头条件TAB页数据,可是直接通过IM_HEADER调用方法,返回的是空值。

查看方法GET_CONDITIONS,根据行号获取指定的条件定价值。全部的条目在变量po_tkomv_hash_tabletkomv中,可以尝试指针指向这两个变量。

观察行上获取条件净价的方法,标准方法通过宏命令mmpur_dynamic_cast强转my_parent,直接通过l_header调用get_tkomv获取。查看l_header方法GET_TKOMV是继承自接口IF_PURCHASING_DOCUMENT。可以用如下代码获取抬头条件净价

    DATA: lo_po_doc TYPE REF TO if_purchasing_document .
    DATA: lt_tkomv TYPE mmpur_tkomv .
    lo_po_doc ?= ir_header.
    lo_po_doc->get_tkomv( IMPORTING  ex_tkomv = lt_tkomv ) .



SAP标准代码

抬头获取条件净价

METHOD if_purchase_order_mm~get_conditions .

  DATA: ls_cond_entry TYPE komv,
        l_kposn       TYPE komv-kposn.

  CLEAR ex_conditions.

  READ TABLE po_tkomv_hash_table WITH KEY kposn = l_kposn BINARY SEARCH
             TRANSPORTING NO FIELDS.
  IF sy-subrc IS INITIAL.
    LOOP AT po_tkomv_hash_table INTO ls_cond_entry FROM sy-tabix.
      IF ls_cond_entry-kposn NE l_kposn.
        EXIT.
      ENDIF.
      APPEND ls_cond_entry TO ex_conditions.
    ENDLOOP.
  ELSE.
    PERFORM mepo_badi_get_conditions IN PROGRAM saplmepo
                                USING    l_kposn
                                CHANGING ex_conditions.
  ENDIF.

ENDMETHOD.                    "IF_PURCHASE_ORDER_MM~GET_CONDITIONS

行获取条件净价

METHOD if_purchase_order_item_mm~get_conditions .

  DATA: l_header      TYPE REF TO cl_po_header_handle_mm,
        lt_conditions TYPE mmpur_tkomv,
        ls_cond_entry LIKE LINE OF lt_conditions,
        l_kposn       TYPE komv-kposn.

  CLEAR ex_conditions.
  mmpur_dynamic_cast l_header my_parent.
  CHECK NOT l_header IS INITIAL.

  CALL METHOD l_header->get_tkomv
    IMPORTING
      ex_tkomv = lt_conditions.

  l_kposn = po_item_number.
  READ TABLE lt_conditions WITH KEY kposn = l_kposn BINARY SEARCH
             TRANSPORTING NO FIELDS.
  IF sy-subrc IS INITIAL.
    LOOP AT lt_conditions INTO ls_cond_entry FROM sy-tabix.
      IF ls_cond_entry-kposn NE l_kposn.
        EXIT.
      ENDIF.
      APPEND ls_cond_entry TO ex_conditions.
    ENDLOOP.
  ELSE.
    PERFORM mepo_badi_get_conditions IN PROGRAM saplmepo
                                    USING    l_kposn
                                    CHANGING ex_conditions.
  ENDIF.

ENDMETHOD.

热门相关:最强狂兵   无限杀路   夫人你马甲又掉了   惊世毒妃:轻狂大小姐   重生之至尊千金