Steps:-
- Create a structure using SE11.
- SIBFLPOR standard structure we are going to use in Class method.
- Go to Transaction code SE24 to create Class.
- Click on Interfaces Tab.
- To enable a class to trigger work flow, it has to implement interface IF_WORKFLOW. When it is implemented it also implements INTERFACE : BI_OBJECT and BI_PERSISTENT.
- Click on Attribute tab.
- In the attribute section define two attribute and one choose as key attribute.
- Click on Events tab, define an event.
- Click on Methods tab.
- Click on Constructor.
- Click on SAVE.
- Click on Back.
- Double click on Constructor and write the below code.
gs_obj-catid = 'CL'.
gs_obj-typeid = 'ZCL_WORKFLOW_TRIGGER'.
gs_obj-instid = lv_key_number.
gs_obj-typeid = 'ZCL_WORKFLOW_TRIGGER'.
gs_obj-instid = lv_key_number.
- Create a method.
- Implement the method.
- Double click on the method FIND_BY_LPOR
- Implement it.
- Double click on the method LPOR.
- Implement method.
- Activate the Class.
- Go to transaction code SBWP.
- Go to Transaction code SWDD.
- Create workflow.
- Enter the Basic Data.
- Click on Start Event tab.
- Select Object Type Category as CL.
- Enter the Object Type i.e Class name.
- Enter event of the object.
- Click on Activate.
- Click on SAVE.
- Double click on "Undefined Double-click for new step ".
- Select as Send mail.
- Enter subject and body of mail.
- Enter Abbreviation and Name.
- Looks like.
- Activate.
- Go to Transaction Code SE38.
- Enter the following code.
- Activate.
DATA : lr_wf type REF TO ZCL_WORKFLOW_TRIGGER.
CREATE OBJECT LR_WF
EXPORTING
LV_KEY_NUMBER = '0000000002'
.
CALL METHOD LR_WF->TRIGGER_START_WF
.
IF sy-subrc eq 0.
WRITE : / 'Workflow triggered successfully'.
else.
WRITE : / 'Workflow not triggered successfully'.
ENDIF.
CREATE OBJECT LR_WF
EXPORTING
LV_KEY_NUMBER = '0000000002'
.
CALL METHOD LR_WF->TRIGGER_START_WF
.
IF sy-subrc eq 0.
WRITE : / 'Workflow triggered successfully'.
else.
WRITE : / 'Workflow not triggered successfully'.
ENDIF.
thanks for the valuable information in your blog, Best SAP training centre
ReplyDeletesap fiori training in chennai
Excellent for people who are new to SAP Workflow
ReplyDeleteI must admit your youtube channnel is Excellent. I am now learning about OOPS from your channel. I wonder how lees views you have.