In many projects, we have had the need to have status management for our application. Many a times, we end up creating a new framework or functionality for the same, not knowing there is a standard feature for the same. Here is what you will need to do to configure and set up a new one.
- Define a new Object type (Tcode BS12)
Create a new object type which identifies a status object.
2. Maintain status profile (BS02)
Create a new status profile, which can be made up of one or more statuses. Each status has a number and you shall also specify the lowest and the highest status you can navigate to from here. It is not possible to specify minor status transitions like from A you can move to C and not D, but if you place the statuses in the right order, it should be possible to carefully define such transitions.
3. Maintain Business transactions (BS32)
The business transactions are like actions in the system. Some of the actions are possible only in certain statuses, and some of them can also cause a status change.
4. Business transactions valid for Object type
In TcodeBS12, double click on the object type, select all the business transactions that are eligible for this object type.
5. Transaction Control
In BS02, double click on each of the status configured to define the transaction control
It is possible to specify which business transactions are possible in a given status and which are not.
As a second step, it is also possible to specify that a certain transaction sets a certain status.
ABAP Code for status transition:
**Run business transction in simulation/update mode
CALL FUNCTION 'STATUS_CHANGE_FOR_ACTIVITY'
check_only = iv_simulation_flag
objnr = lv_objnr
vrgng = lv_biz_transaction
activity_not_allowed = 1
object_not_found = 2
status_inconsistent = 3
status_not_allowed = 4
wrong_input = 5
warning_occured = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE e075(zawct_msg) WITH lv_biz_transaction INTO lv_message.
PERFORM bapi_message_collect CHANGING et_messages.