FavoriteLoading
0

[BAPI]如何修改工单状态-BAPI_ALM_ORDER_MAINTAIN

[隐藏]

1,BAPI简介

可以通过调用BAPI BAPI_ALM_ORDER_MAINTAI来更改工单的状态,具体使用到的参数是IT_METHODS。

IT_METHODS的定义如下:

各个字段含义如下:

REFNUMBER:是objecttype参数中填入的相关对象对应的内表行数,
OBJECTTYPE:对象类型,类型如下:

  • HEADER Order header
  • PARTNER Partner data
  • USERSTATUS User status
  • OPERATION Operation data
  • RELATION Relationships
  • COMPONENT Component
  • TEXT Long texts
  • SRULE Settlement rule
  • OBJECTLIST Object list
  • OLISTRELATION Object list link
  • TASKLIST General maintenance task list
  • PRT Production resources/tools
  • SERVICEOUTLINE Service package outline
  • SERVICELINE Service package service line
  • SERVICELIMIT Service package limit
  • SERVICECONTRACTLIMIT Service package contract limit
  • ESTIMATEDCOST Estimated costs per value category
  • (empty) General BAPI functions (Save)

METHOD:方法,可以实现创建、修改、删除、保存等功能以及工单的状态-lock、unlock、TECHNICALCOMPLETE等,具体代码如下:

  • CREATE :Create objects
  • CREATETONOTIF: Create with reference to a notification
  • CHANGE : Change objects
  • DELETE :Delete objects
  • RELEASE : Release
  • ATPCHECK :Availability check
  • CALCULATE : Calculate
  • SCHEDULE :Schedule
  • DELETEDSEX : Delete the status for external scheduling at operation level
  • ADD :Add (only possible for object TASKLIST)
  • SAVE : Save all data
  • DIALOG : Dialog call
  • TRACE :Write trace file to the specified file on the front end
  • DO_NOT_EXECUTE : Do not execute
  • DO_NOT_EXEC_NOTIF_CLOSE :Do not execute and complete notifications
    Note: This also automatically completes any outstanding tasks in the notifications.
  • DO_NOT_EXEC_NOTIF_DEALLOC :Do not execute and remove assigned notifications from order
    Note: Notifications assigned to the order header are not removed, but rather automatically completed.
  • LOCK :Lock-锁定
  • UNLOCK :Unlock-解锁
  • TECHNICALCOMPLETE :Technically complete-技术完成
  • CANCEL_TECHNICAL_COMPLETION : Cancel technical completion-撤销技术完成
  • TECO_WITH_NOTIF :Technically complete with notifications
    Note: If a reference date is transferred, the notification with the reference date is also completed. The tasks of the notification are not automatically completed.
  • CANCEL_TECO_WITH_NOTIF : Reset technical completion and put assigned notifications in process again
  • COMPLETE_BUSINESS :Complete (business)-业务完成
  • CANCEL_BUSINESS_COMPLETION :Cancel business completion
  • BUS_COMPL_WITH_NOTIF :Complete (business) with notifications
  • SET_DEL_FLAG :Set deletion flag-设置删除标识
  • RESET_DEL_FLAG :Reset deletion flag
  • SET_DLFL_WITH_NOTIF : Also set deletion flag for assigned notifications
  • RESET_DLFL_WITH_NOTIF :Reset deletion flag and put assigned notifications in process again

OBJECTKEY: 外部对象码,详细如下:

  • 0-12 Order number 工单号
  • 13-16 Operation number 工序号
  • 17-20 Suboperation number 子工序号
  • 13-24 Notification number (only for method CREATETONOTIF)

注意:每个object对象只能对应特定的method,详细对应关系如下:

  • HEADER
    CREATE, CHANGE, RELEASE,  ATPCHECK, CALCUALTE, SCHEDULE, CREATETONOTIF, DO_NOT_EXECUTE, LOCK, UNLOCK, TECHNICALCOMPLETE, CANCEL_TECHNICAL_COMPLETION, COMPLETE_BUSINESS, CANCEL_BUSINESS_COMPLETION, SET_DEL_FLAG, RESET_DEL_FLAG
  • OPERATION
    CREATE, CHANGE, DELETE, DELETEDSEX
  • PARTNER, RELATION, USERSTATUS, TEXT, SRULE, OBJECTLIST, PRT
    CREATE, CHANGE, DELETE
  • OLISTRELATION
    CREATE, DELETE
  • TASKLIST
    ADD
  • COMPONENT
    CREATE, CHANGE, REASSIGN, DELETE
  • ESTIMATEDCOST
    CHANGE
  • (empty)
    SAVE, DIALOG, TRACE

2,例子代码

一个简单的例子,用来将工单的状态更新为技术完成。

3,测试

程序运行前,tcode IW33查看工单状态为释放REL

程序运行后,工单状态为技术完成TECO

其他,工单的技术完成状态可以通过IW32撤销,

以上。