METHOD IF_EX_ME_PROCESS_PO_CUST~CHECK.
DATA: CL_HEADER TYPE MEPOHEADER.
DATA: WA_ITEMS TYPE MEPOITEM.
DATA: LT_ITEMS TYPE PURCHASE_ORDER_ITEMS.
DATA: LS_ITEMS TYPE PURCHASE_ORDER_ITEM.
DATA: CL_ITEM TYPE REF TO IF_PURCHASE_ORDER_ITEM_MM.
DATA: GT_PRCD_ELEMENTS TYPE TABLE OF PRCD_ELEMENTS .
DATA: GS_PRCD_ELEMENTS TYPE PRCD_ELEMENTS .
DATA: GS_ZTMM_ST03 TYPE ZTMM_ST03 .
DATA: GS_WAERS TYPE WAERS .
DATA: FLAG TYPE C .
CALL METHOD IM_HEADER->GET_DATA
RECEIVING
RE_DATA = CL_HEADER.
CALL METHOD IM_HEADER->GET_ITEMS
RECEIVING
RE_ITEMS = LT_ITEMS.
* LT_ITEMS = IM_HEADER->GET_ITEMS( ).
LOOP AT LT_ITEMS INTO LS_ITEMS .
CL_ITEM ?= LS_ITEMS-ITEM. "类、接口等类型的向下类型转换(参照其它类的对象创建新对象)
CALL METHOD CL_ITEM->GET_DATA
RECEIVING
RE_DATA = WA_ITEMS.
ENDLOOP.
* CLEAR GT_PRCD_ELEMENTS[].
* SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_PRCD_ELEMENTS[] FROM PRCD_ELEMENTS
* WHERE KNUMV = CL_HEADER-KNUMV
* AND KSCHL IN ( 'PB00', 'PBXX' )
* AND KINAK = ''
* AND KBETR > 0
* .
*
* LOOP AT GT_PRCD_ELEMENTS INTO GS_PRCD_ELEMENTS WHERE KSCHL = 'PBXX'.
* ENDLOOP.
* IF SY-SUBRC = 0 .
* SELECT SINGLE * INTO CORRESPONDING FIELDS OF GS_ZTMM_ST03 FROM ZTMM_ST03
* WHERE BSART = CL_HEADER-BSART
* .
* IF SY-SUBRC <> 0 .
* MESSAGE '不允许手工输入价格,请通知采购部维护信息记录!' TYPE 'E'.
* ENDIF.
* ENDIF.
*
* READ TABLE GT_PRCD_ELEMENTS INTO GS_PRCD_ELEMENTS INDEX 1 .
* IF SY-SUBRC = 0 .
* GS_WAERS = GS_PRCD_ELEMENTS-WAERS.
* ENDIF.
*
* CLEAR FLAG .
* LOOP AT GT_PRCD_ELEMENTS INTO GS_PRCD_ELEMENTS.
* IF GS_PRCD_ELEMENTS-WAERS <> GS_WAERS.
* FLAG = 'X'.
* EXIT.
* ENDIF.
* ENDLOOP.
*
* IF FLAG = 'X'.
* MESSAGE '采购单项目有多个结算币别,不能创建在一张采购单中!' TYPE 'E'.
* ENDIF.
ENDMETHOD.
PO保存时检查项目内容(?= 用法实例)
最新推荐文章于 2023-10-17 10:19:26 发布