Tuesday, 28 November 2017

Triggering wok flow with business object event

Steps:-

  • Go to SE11.
  • Create a structure with a field which we will use in the creation of key field of a business object.
  • To create business object go to Transaction code  SWO1.
  • Provide a new business object name and click on create button.
  • Provide Object Name , Name . Description , Program and Application.
  • Click on Continue.
  • Enter the Package and Click on SAVE.
  • Enter the Transport Request and click on continue.
  • So we have created a business object. Now let’s create a key field.
  • Put the cursor on the Key Fields and select create button.
  • Pop-up will appear.
  • Click on NO.
  • Provide key field name and its text and as technical data type refer to the structure field that we created in the previous step.
  • So we are done with the creation of the key field of the BO. Lets create an event in the business object(BO). Select events and click on create. 
  • Provide the event name and its text and continue.
  • Looks like,
  • Select the Event.
  • Click on Edit -> Object Type ->  To modeled.
  • Select the Event.
  • Click on Edit -> Object Type ->  To implemented.
  • Check the Status bar.
  • Select the Event.
  • Click on Edit -> Object Type ->  To Released.

  • Check the Status bar.
  • Tick mark appear.

  • Click on Generate.

  • Go to Transaction Code SWDD.
  • Click on Create.
  • Click on Basic Data.
  • Enter the Abbreviation and Description.


  • Click on Start Event Tab.
  • From Category drop down list select BO ( Business Object ).
  • Enter the Object Type and Enter the Event of the Object.
  • Click on Activate.

  • Click on Save.
  • Its turns green. Save and go back.
  • Looks like,
  • Double click on "Undefined Double-click for new step ".
  • Pop-up will appear.
  • Select " Send mail".

  • Enter the Mail subject and Description.
  • Click on Transfer and to graphic button.
 

  •  Enter the Abbreviation and Name .
  • Click on Continue.
  • Activate.
  • Looks like.
  • Go to SE38.
  • Create a Executable program and enter following code.
DATA rc TYPE sy-subrc.

CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
  EXPORTING
    OBJECT_TYPE             'ZWFTEST_BO'
    OBJECT_KEY              '0000000001'
    EVENT                   'WF_START'
   COMMIT_WORK             'X'
*   EVENT_LANGUAGE          = SY-LANGU
*   LANGUAGE                = SY-LANGU
*   USER                    = SY-UNAME
*   IFS_XML_CONTAINER       =
 IMPORTING
   RETURN_CODE             =  rc
*   EVENT_ID                =
* TABLES
*   INPUT_CONTAINER         =
*   MESSAGE_LINES           =
*   MESSAGE_STRUCT          =
          .

IF rc eq 0.

  WRITE 'Workflow triggered successfully'.

  else.

   WRITE 'Workflow not triggered  successfully'.

ENDIF.


  • Execute.
  • Go to SBWP transaction code to check mail.
  • Expand Inbox -> Click on Unread Documents.
  • Double click on mail.
  • Here some additional steps the developer might check about the workflow that has been executed. 
  • Go to Transaction code SWI1.
  • Execute.
  • Looks like.
  • Select the Line and Click on "Display workflow log".
  • Click on Graphic.
  • So here green line is the execution path.


3 comments:

  1. good tutorial. thank you very much

    ReplyDelete
  2. Creating experts, A leading career development organization provides Real time training in Sap fiori SAP Success Factors,SAP MM, SAP SD, SAP ABAP, SAP BASIS,SAP BASIS,SAP FICO,with live examples by corporate Experts.
    www.thecreatingexperts.com (Best SAP training institute in chennai with placement assistance)
    SAP Success Factor,SAP MM Training in chennai Call @ 8122241286

    sap fiori training in chennai

    ReplyDelete
  3. I found that site very usefull and this survey is very cirious, I ' ve never seen a blog that demand a survey for this actions, very curious... mapsjar.com

    ReplyDelete