Now go to Methods tab of Main View and Double click on ONACTIONREGISTER Method.
Enter below Code in OnActionRegister Event.
method ONACTIONREGISTER .
* Data Declaration for Employee Node
* Data Declaration for Class
DATA lr_wf_demo TYPE REF TO ZCL_WF_DEMO.
* navigate from <CONTEXT> to <EMPLOYEE> via lead selection
* get element via lead selection
* getting Employee ID
* Trigger Workflow
CREATE OBJECT lr_wf_demo.
lr_wf_demo->register_employee( exporting i_empid = lv_emp_id ).
IF sy-subrc = 0.
* report message
( Refer How to create and trigger class based workflow – part 1 for quick code reference of class zcl_wf_demo )
Step 3: Create Application.
Save and Activate the Web Dynpro Component. Create the Web Dynpro Application and Save it.
Enter description and Click on Ok.
Save the Web Dynpro ABAP Application.
Right Click on the Web Dynpro ABAP Application and click on Test.
Enter Employee ID and Click on Register.
Now we can see the success message.
Now go to SBWP Transaction and Click on Inbox.
Here I demonstrated a simple Web Dynpro ABAP Application which triggers Workflow. This helps to create ABAP Class, Workflow and Triggering Workflow from Web Dynpro ABAP as per Our Requirements.