Configuration for User status profile for Process Order
• A shop floor system can be integrated/Connected with system like SAP ME, MII etc. So Once actual execution of the process order starts in Shop floor system. A specific user status would be set in ERP through a BAPI.
•The user status “Execution Started” would block that process orders can be changed with dialog transactions in ERP.
Example: In SAP ERP process order created and passed to SAP MII or MES system, thereafter the respected shop floor system will start the actual production with the reference of process order. So now, once the execution start in Shop floor system. In SAP ERP should not allowed any further changes of executing process order.
So, to restrict the user to change the order in SAP ERP. Need to set user status for the executing order with saying order execution has been started? By this way we can identify the process order changes should allow or not.
To achieve this above requirement need to follow some steps of configuration and BADI implementation.
- Configure/Maintain User status profile.
- Assign newly created User status Profile to the Process order or Process Order status Management.
- Implement the BADI to block activity of the Process Order.
- Implement the BADI method and put some logic based on the user status to restrict the process order activity.
- Use the BAPI that is dedicated for changing user status of a process order.
This can be configured in standard configuration where as it will impact in orders as these changes are at client level hence inclined towards the user status configurations and please follow to configure the same.
1. Configure/Maintain User status profile.
Go to BS02, click new & specify the user status name, brief text & language.
Double click on created profile
Click on object types & tick Process order
Come back to user status screen and maintain as below.
Double click the status for example CLSD and click New and existing
Technically Complete maintained as No Action.
Altered to Set which specifies that the status is to be activated when this business transaction is carried out.
2. Assign newly created User status Profile to the Process order or Process Order status Management.
Go to CORN – Maintain Process Order, add newly created Status profile Z***_ST to required order type and save.
3. Implement the BADI to block activity of the Process Order.
In the IMG you can also find the BAdI that is processed during process order processing and that might be suitable to block activities for process orders once they have the user status indicating execution start.
The BAdI is named WORKORDER_UPDATE, and in method AT_SAVE you may implement logic that reacts on the user status. When sending an error message from this method, saving of the order would be blocked. for example, check for the transaction code SY-TCODE to block changes through dialog transactions only. I think that you can use function module STATUS_CHECK to check whether a particular status is active or not. If you want to check for particular changes of the order and block changes of particular attributes like dates and quantities only, you may have a look at the example implementation in class CL_EX_CO_MES_INT_REDISTRIB. It provides some hints how you can check which changes have been made for a particular order.
4. Implement the BADI method and put some logic based on the user status to restrict the process order activity.
5. Use the BAPI that is dedicated for changing user status of a process order.
The BAPI that is dedicated for changing user status of a process order is named BAPI_PROCORD_SETUSERSTATUS. You can define user status in the IMG of the ERP system (check the assigned documentation for details):
Process order created for order type PI01
On creation User Status updated CRDT as below
CRDT – Process Order Create
Now go to change TCODE – COR2 of the Process order, release the process order, and save.
Optional - Once this process order is release based on the corresponding system if it is available send to then like MII, MES etc. and from there stared the actual start process order.
Now by using the BAPI "BAPI_PROCORD_SETUSERSTATUS"to change the user status from CRDT to REL
(As we have configured the User status sequence in this manner so first need to change from CRDT to REL).
As you can see this status of order got change to REL, same way when order is start execution, so again this status need to change from REL to ESTR.
Now the process order status is “ESTR-Process Order Execution Start”, so now the backend user should not allow to change the Order because the actual process has been started.
Now let’s try to change the quantity of the order and then try to save.
As you can see the error message saying the “Order Status ESTR is not allowed” any change for Order.
Sandeep Kumar Yadav