SAP CR02 更改工作中心 CRAP_WORKCENTER_CHANGE

SAP 创建,修改工作中心实例代码

SE24

CL_PP_WORK_CENTER_BO
Work Center API Business Object

UPDATE_CAPACITY    Update Capacity
GET_INSTANCE    Get instance of class CL_PP_WORK_CENTER_BO
CREATE_WORK_CENTER    Create Work Center
UPDATE_WORK_CENTER    Update Work Center
CREATE_WRKCTR_CAPACITY_MAPPING    Create Work Center Capacity Mapping
CREATE_COST_CENTER_ALLOCATION    Create Work Center Cost Center Allocation
UPDATE_CAPACITY_INTERVAL_SHIFT    Update Capacity, Interval or Shift
CREATE_WRKCTRCAP_INTVL_SHIFT    Create Interval or Shift
READ_WORK_CENTER_BY_ID    Read Work Center by given ID
READ_CAPACITY_BY_ID    Read Capacity by given ID
READ_WORK_CENTER_BY_NAME    Read Work Center by Work Center Name and Plant

*&---------------------------------------------------------------------*
*& Report ZCR02
*&---------------------------------------------------------------------*
*& CR02 更改工作中心 CRAP_WORKCENTER_CHANGE
*&---------------------------------------------------------------------*
REPORT ZCR02 NO STANDARD PAGE HEADING.

DATA: GT_RETURN	TYPE BAPIRET2_TAB.

SELECTION-SCREEN: BEGIN OF BLOCK SCR1 WITH FRAME TITLE TEXT-101.
  PARAMETERS: P_WERKS TYPE RC68A-WERKS OBLIGATORY DEFAULT '1001',
              P_ARBPL TYPE RC68A-ARBPL OBLIGATORY DEFAULT 'WO19'.
SELECTION-SCREEN END OF BLOCK SCR1.

SELECTION-SCREEN: BEGIN OF BLOCK SCR2 WITH FRAME TITLE TEXT-102.
  PARAMETERS: P_KTSCH TYPE P3003-KTSCH OBLIGATORY DEFAULT 'ZPP01',
              P_STEXT TYPE P1000-STEXT OBLIGATORY DEFAULT '核武器打磨车间'.
SELECTION-SCREEN END OF BLOCK SCR2.

INITIALIZATION.

START-OF-SELECTION.

  PERFORM FRM_UPDATE_WORK_CENTER USING 'X' P_WERKS P_ARBPL P_KTSCH P_STEXT CHANGING GT_RETURN.

  IF GT_RETURN IS INITIAL.
    PERFORM FRM_DISPLAY USING '修改成功'.
  ELSE.
    PERFORM FRM_DISPLAY USING GT_RETURN.
  ENDIF.

FORM FRM_DISPLAY USING DATA.
  CHECK DATA IS NOT INITIAL.
  CALL METHOD CL_DEMO_OUTPUT=>DISPLAY
    EXPORTING
      DATA = DATA.
ENDFORM.


FORM FRM_UPDATE_WORK_CENTER USING    LV_NO_COMMIT	TYPE XFELD
                                     LV_WERKS     TYPE RC68A-WERKS
                                     LV_ARBPL     TYPE RC68A-ARBPL
                                     LV_KTSCH     TYPE P3003-KTSCH
                                     LV_STEXT     TYPE P1000-STEXT
                            CHANGING LT_RETURN    TYPE BAPIRET2_TAB.

  DATA: LO_WRKCENTER_API TYPE REF TO CL_PP_WORK_CENTER_BO.

  DATA: IS_CRHD        TYPE  CRHD,
        IS_CRHD_API01  TYPE  CRHD_API01,
        IS_CRHD_API02  TYPE  CRHD_API02,
        IS_CRHD_API03  TYPE  CRHD_API03,
        IS_CRHD_API05  TYPE  CRHD_API05,
        IS_CRHD_API08  TYPE  CRHD_API08,
        IS_CRHD_API01X TYPE  CRHD_API01X,
        IS_CRHD_API02X TYPE  CRHD_API02X,
        IS_CRHD_API03X TYPE  CRHD_API03X.

  CREATE OBJECT LO_WRKCENTER_API.

  SELECT SINGLE *
  INTO CORRESPONDING FIELDS OF IS_CRHD
  FROM  CRHD
  WHERE CRHD~OBJTY  = 'A'
  AND   CRHD~BEGDA <= SY-DATUM
  AND   CRHD~ENDDA >= SY-DATUM
  AND   CRHD~ARBPL  = LV_ARBPL
  AND   CRHD~WERKS  = LV_WERKS.

  IS_CRHD_API01-ARBPL = IS_CRHD-ARBPL.
  IS_CRHD_API01-WERKS = IS_CRHD-WERKS.
  IS_CRHD_API01-VERWE = IS_CRHD-VERWE.
  IS_CRHD_API01-KTEXT = LV_STEXT.


  IS_CRHD_API03-KTSCH = LV_KTSCH.

  IS_CRHD_API03X-KTSCH      = 'X'.
  IS_CRHD_API03X-CHANGE_FLG = 'U'.

  CALL METHOD LO_WRKCENTER_API->UPDATE_WORK_CENTER
    EXPORTING
      IS_CRHD        = IS_CRHD
      IS_CRHD_API01  = IS_CRHD_API01
      IS_CRHD_API02  = IS_CRHD_API02
      IS_CRHD_API03  = IS_CRHD_API03
      IS_CRHD_API05  = IS_CRHD_API05
      IS_CRHD_API08  = IS_CRHD_API08
      IS_CRHD_API01X = IS_CRHD_API01X
      IS_CRHD_API02X = IS_CRHD_API02X
      IS_CRHD_API03X = IS_CRHD_API03X
      IV_NO_COMMIT   = LV_NO_COMMIT
      IV_LANGUAGE    = SY-LANGU
    IMPORTING
      ET_RETURN      = LT_RETURN.
ENDFORM.

相关函数 

CRAP_WORKCENTER_CHANGE         API work centers: update work center
CRAP_WORKCENTER_CREATE         API work centers: create work center
DMC_MIG_WORKCENTER             Migration of work center

  • 6
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

SAP爱好者

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值