Demo on Workflow using ClassesWord下载.docx
《Demo on Workflow using ClassesWord下载.docx》由会员分享,可在线阅读,更多相关《Demo on Workflow using ClassesWord下载.docx(14页珍藏版)》请在冰豆网上搜索。
Beforefollowingthisdocument,onemusthaveabasicknowledgeofOOPSConcepts.
StepstofollowtouseClassesinWorkflow
HowtoCreateCustomClass
HerewewillbecreatingacustomclassforMATERIAL.
Gototransaction
SE24
andcreateacustomizedclass.
Nextthepopupappearswhereweneedtomentionthedetailasfollows:
Saveitandtheclassiscreated.
NowtheclassistoimplementIF_WORKFLOWinterface.Forthisgotothe
tabanddeclaretheIF_WORKFLOWastheinterfacethereandpressEnter;
twosub-interfacesappear:
BI_OBJECT
and
BI_PERSISTENT.SavetheClass.
TheZCL_TESTclassnowcontainstheexistingmethodsofIF_WORKFLOWinterface.
Also,2newinterfaceswillbeautomaticallyaddedonceyouaddIF_WORKFLOWinterfaceintheclassasshownbelow:
EachmethodoftheIF_WORKFLOWInterfacehasitsdistinctfunctionality,whichisdiscussedbelow.
BI_PERSISTENT~FIND_BY_LPORMethod:
Here,tocreateobject,constructorofclassneedstobeimplementedasfollows:
Here,SET_ATTRIBUTESmethodiscalledwhichwillbeimplementedasfollows:
BI_PERSISTENT~LPORMethod:
BI_PERSISTENT~REFRESHMethod:
Ifwedonotneedthemethodinourclass,thenweneedonlytocarryouta“dummy”implementation(withoutfurthercoding)toavoidprogramerrorswhenthesystemcallsthemethod.
BI_OBJECT~DEFAULT_ATTRIBUTE_VALUEMethod:
BI_OBJECT~EXECUTE_DEFAULT_METHODMethod:
BI_OBJECT~RELEASEMethod:
Now,theattributesneedtobedevelopedtoimplementabovemethodsareasfollows:
Totriggertheworkflowusingeventofclass,wemustalsocreateaneventoftheclass.Todothis,gotoEVENTStab,andtherecreateaneweventCREATEDasshownbelow:
Beforeimplementingabovemethods,alocaltypeneedstobecreated.Todothis,clickonLOCALTYPESasshownbelow:
Nowwritethebelowcode:
HowtouseClassinaWorkflow
Here,theworkflowneedstobetriggeredassoonasamaterialiscreated.Andthenaworkitemshouldgotoinitiatortoeditthesamematerial.
GotoSWDDtocreateanewworkflow.
ClickonBasicDataTab:
GiveanabbreviationandShortDescriptiontoworkflowasfollows:
NowclickonSTARTEVENTStabandspecifythefollowingstandardeventofthestandardclass:
NowgobackandrightclickinbetweentheWORKFLOWSTARTEDandWORKFLOWCOMPLETED.
SelectCREATE.Alistofavailablesteptypeswillbedisplayedasfollows:
SelectACTIVITYfromthislist.Thefollowingscreenwillappear:
Specifythefollowingdetailshere:
ClickonBindingtab.Bindingwillbeasfollows:
Clickontaskdescription.Automaticallyfollowingdetailswillshow:
Clickonthegreenbuttonforbindingaboveandconfirmthebindingsmustbeasfollows:
SETAGENTASSIGNMENT:
ClickonyellowbuttoncomingbesidesAgentAssignment:
ClickonATTRIBUTES:
SelectGeneralTaskandclickonTRANSFER
HowtotriggereventofClass
Totriggereventofaclass,weneedtocallmethodRAISEofstandardclassCL_SWF_EVT_EVENT.Thismethodcanbecalledinauserexit,BAdi,oracustomreportdependingontherequirement.
Inourcase,wearecallingthemethodinaBAdi‘BADI_MATERIAL_CHECK’.
ThemethodinwhicheventwillberaisedisCHECK_DATA.
CreateanewcustommethodRAISE_EVENTintheclassimplementedforBAdi.
Followingmethodwillbecalledtoraiseevent:
Activateclassandgoback.
NowgoinCHECK_DATEmethodandwritethebelowcode:
Output
Createanewmaterial.Todothis,gotoMM01.
PressEnterandthefollowingscreenwillappear:
SpecifytheabovedetailsandpressEnter.Onthenextscreen,enterthefollowingdetails:
ClickonSAVE
button.
Assoonasthematerialgetscreated,theworkflowwilltriggerasshownbelowintheworkflowlog: