Under this section we are going to see the Creation of Subtype of a standard BO.
For doing this we have considered the BO “BUS2000131”. This is standard BO of Order Item.
Purpose of creating a new subtype :-
We are doing this because we need a method of Dialog type. We are going to use this method in the workflow task. If the method is not of Dialog type then the Workitem which is going to be created from workflow will never be processed while sending the mails from SAP Inbox to our Outlook.
At the same time you can also do some additional work if required. For example if you want to fetch some data which is not present in the object.
Go to TCODE :- SWO1.
Once you click on it you will get an pop-up screen under which you have to give the details of the subtype and press Enter Key.
Get inside the subtype in change mode and place the cursor on the Object type and release it.
Path to release :- Edit -> Change Release Status -> Object Type Component -> To implemented. As shown in the below screen shot. After this Generate Subtype once. Generate is almost like activating the BO.
Create the new method which we will be using in our workflow task.
Expand the Node Methods and then click on the create button. You will get a Pop-Up asking for creating the method as a FM. We are going to select ‘NO’ in this case. If you select ‘YES’ then you have to give the FM name which is going to be called whenever this is triggered.
Once you click on ‘NO’ another Pop-Up will come. Give the method name and other details as per you wish and Press Enter. Before pressing enter check the general tab. You will have 4 check boxes out which don’t forget to Check the ‘Dialog’ and ‘Synchronous’. As shown in the below screen shot. Initial its status will remain as Modeled make it Implemented same as you have done for initially for BO in step2.
Now we are going to right the code under this so that it should fetch all the data and to instantiate its parent Object. Place the cursor on the method and click on the program. A Pop-Up will appear press ‘Yes’. As shown in the below screen shot.
Now generate the BO once. And then write the below code. In the given space.
data: return type table of BAPIRET2,
l_item_guid type CRMT_OBJECT_GUID,
l_header_guid type CRMT_OBJECT_GUID,
l_guid_32 type GUID_32.
l_item_guid = object-key-businessprocessitem.
CALL FUNCTION ‘CRM_ORDER_GET_HEADER_GUID’
iv_ref_guid = l_item_guid
iv_ref_kind = ‘B’
* IV_INCLUDE_DELETED = FALSE
EV_HEADER_GUID = l_header_guid
* EV_REF_KIND =
NOT_FOUND = 1
PARAMETER_ERROR = 2
OTHERS = 3.
IF sy-subrc eq 0.
l_guid_32 = l_header_guid.
with guid eq l_header_guid
with objtype eq ‘BUS2000120’
with mode eq ‘A’
Once done generate the BO come back to the initial screen of SWO1.
Delegate the Subtype.
Go to Settings -> Delegate
Click on Edit Icon and give the object type as the parent BO. In this case it is BUS2000131 and Delegation type as the subtype name. In this case it is YBUS200131.
Thus we have completed the first phase of our discussion. Creation of Subtype for a Business object.