Вы находитесь на странице: 1из 18

LogIn Register AboutUs HowtoContribute

WelcomeGuest
SDNCommunity BPXCommunity BusinessAnalytics UniversityAlliances SAPEcoHub
Home Forums Wiki Blogs Articles eLearning Downloads CodeExchange CareerCenter Events InnoCentive IdeaPlace
AddedbyKanikaChopra,lasteditedbyKanikaChopraonMar19,2009
BriefOverviewofWorkflowStep-Types
BriefOverviewofWorkflowStep-Types
ThisWIKIwillhelpthereaderstoknowmoreabouttheStep-TypesthatareusedinWorkflowsandawideImplementationoftheseStep-Types.Apartfromsendingmails,Workflowscanhandlealot
manyaffairs.ThiswillcleartheairthatWorkflowsaregenerallyusedforsendingmails.
WorkflowscanworklikeAlgorithmsinthebackgroundaswellasForegroundtomakethetaskappearinaFlow,BasicallyliketheFlowofWork.VariousFunctionalitiescanbeImplementedlike,Flow
basedoncalculations,FlowbasedonConditions,FlowbasedonConditionalEvents,UploadingDocuments,FillingupFormsetc.
ContainerOperation
ContainerOperationisaStep-TypethatisusedforcalculationswiththehelpofWorkflowContainers.

ThisStep-TypeisusedtoderivevariousArithmeticcalculationsfromtheWorkflowElements.ToimplementthisStep-Type,weshouldgiveanArithmeticCondition,basedonwhoseresulttheWF
movesfurther.

ThevariousArithmeticfunctionsavailableare:
Multiplication
Addition
Subtraction
Page 1 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow Ste...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types
Division
Oneshouldcreate3WFContainers,forexample:-
C=A+B(whereallthese3shouldbeWFContainers)
ResultElement=Source1[(Operator)]Source2

Note:
HeretheSourceandtheTargetElementsshouldbetheWorkflowContainers.
TheOutcomeofthisStep-TypewouldbeNumeric/Decimalalwayswith1value.
ThisArithmeticOperationstakeplacebetweenthevaluesoftheWorkflowContainers.
TheseWFContainerscanhaveDynamicvaluesaswellasHard-CodedvaluesfromtheWFContainer.
MultipleConditions
MultipleConditionsisacasethatisimplementedwherewehavetochecksomanyconditionsat1time.
MultipleConditionscanbeimplementedin2ways:-
Case
Switch

Iftheconditionislikethis:-

Ifname='ABC'
Dothis.
**Elseifname='XYZ'
Dothis.
**Elseifname='PQR'
Dothis.
**Else
Dothis
Inthisexample()nameshouldalwaysbedefinedastheWorkflowContainerElement.ThevaluesthatwepasstothisWFContainerElementusingBindingaretheActualValuesthatwelookfor
Comparison.
Page 2 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow Ste...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types

NumberofValuesforComparison=NumberofBranchesfromtheMultipleConditionStep-Type

Thereare3conditionstocheckthename,sonowwehave3branchesthatwillseparatelyprocesseachoftheConditionbeingimplemented.
Loop
LoopisaconditionthatisusedwhenonehastocheckforaparticularConditionbeingFALSEorTRUE.HerewecanputanyConditioninvolving1ormorethan1ContainerElements.

IftheConditiongetssatisfied,theLoopContinuesorelseiftheConditiongoesFalse,TheLoopTerminatesandMovesontotheNextElementintheWF's.

Page 3 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow Ste...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types
ProcessControl
ProcessControlisaveryimportantStep-Type,sinceitperformsalotofFunctions.

NowletuslookateachoftheFunctionsindividually.

CancelWorkitem
Theprocesscontrolstepshouldbelocatedinthebranchofaparallelsection.Touniquelyidentifytheworkitemtobecanceled,wemustenteritsnodenumberinthe'workflowstep'field.PressF4
tofindallpossibleentriesforthenodenumbers.

Theworkitemselectedissettothestatuslogicallydeletedatthetimeofstepexecution.Theworkflowisnotcontinuedafterthiswork-item.Itterminates.
CancelWork-Flow
Usingthisfunction,allworkitemsoftheworkflowaresettothestatuslogicallydeleted.IfthestepProcesscontrolislocatedinaworkflowthatisusedasasubworkflow,thebranchofthecalling
workflowthatcontainsthesubworkflowisstopped.

Page 4 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow Ste...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types
SetWork-ItemtoObsolete
UsethisFunction,whenprocesscontrolislocatedinthebranchofamodeleddeadlinemonitoring.Wecanthensettheworkitemthathasexceededitsdeadline,tothestatuscompletedand
continueprocessinginthebranchprocessingobsolete.Inordertouniquelyidentifytheworkitemtobecancelled,wemustenteritsnodenumberinthefieldworkflowstep.PressF4tofindall
possibleentriesforthenodenumbers.

Theworkitemselectedissettothestatuscompletedatthetimeofstepexecution.
CompleteWorkflow
Usingthisfunction,workflowworkitemsaresettothestatuscompleted.Ifthestepprocesscontrolislocatedinaworkflowthatisusedasasubworkflow,thecallingworkflowiscontinued.For
DetailsofSub-WorkfloworLocalWorkflow.

CancelWorkflow(IncludingallCallers)
Usingthisfunction,allworkitemsoftheworkflowaresettothestatuslogicallydeleted.IfthestepProcesscontrolisinaworkflowthatistobeusedasasubworkflow,thecallingworkflowaswellas
alltheworkitemsinitissettothestatuslogicallydeleted.Thewholeworkflowisstoppedusingthisfunction.

ActivateCorrelation
Acorrelationenablesustoidentifyobjectsthatbelongtogether.Ifwehavedefinedacorrelationbyusingthecorrelationeditor(Environment->Development->CorrelationEditor),wecanactivateit
here.Itcanthenbeusedinawaitstep.Choosetheeventthatthecorrelationistobeactivatedfor,andthecorrelationtobeactivated.Specifyhowthevalueofthecorrelationistobedetermined:
BasisElement:Ifwehavedefinedthebindinginthedefinitionofthecorrelation,wecanspecifyacontainerelementthatreferencesthecorrespondingbasiselementfromthecorrelation
definition.

Page 5 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow Ste...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types
Binding:ChoosethisentryifwewanttodefineabindingbetweentheWorkflowcontainerandthecorrelationcontainer.

InthefieldCorrelationInstance,choosethecontainerelementforthecorrelationobject.
Thecorrelationobjectshowsthevalueofthecorrelation.ThecontainerelementforthecorrelationobjectmusthavethepredefineddatatypeCL_SWF_MOD_CORRELATION.
ThrowException
HerewecantriggerlocaleventsoftypeException.

Wecandefinealocaleventoranexceptionintheversion-specificbasicdataoftheWorkflow.Wedefinetheexceptionhandlerintheblock.
Wedefinelocaleventsintheversion-dependentbasicdataoftheWorkflow.
LocalEvent

GiveanametotheLocalEventcreated;herethenameis'NewLocalEvent'.
Alocaleventcanbethefollowing:
AnexceptionthatistriggeredbyastepoftypeProcessControl.Youdefinetheexceptionhandlerintheblock.
Alocaleventthatistriggeredbyaneventcontrolleroranevent.YoucanusealocaleventtostartalocalWorkflow.Furthermore,astepoftypeWaitforEventcanwaitforalocalevent.
Wait
WaitStep-TypeisusedwhenweneedtowaitforeitheranEventtohappenoraConditiontogetsatisfied,sothatwecanproceedfurtherwiththeWorkflow.
Thereare4conditionsonwhichWAITworks:-
Page 6 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow Ste...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types

C:WaitforCondition
L:WaitforLocalEvent
W:WaitforEventbyUsingWorkflow
WaitforEvent.
Letusseetheseindividually.
C:WaitforCondition
Thewaitstepiscompleteoncethespecifiedconditionhasbeenfulfilled.

L:WaitforLocalEvent
ThisstepenablesustostoptheexecutionofthisbranchofourWorkflowuntilalocaleventhasarrived.

Page 7 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow Ste...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types
WaitforEvent
Withthisstep,westoptheexecutionofthisbranchofourworkflowuntiladefinedeventforaparticularobjectoccurs.Theobjectforwhichaneventmustoccurmustbeinacontainerelementof
theworkflowcontainer.Enterthedesiredcontainerelementandselectanassociatedevent.Weonlyhavetodefineabindingifwewanttousethedataoftheeventintheworkflow.

Weshouldnotusethissteptypeinaforktowaitforaneventthatistriggeredinanotherbranchofthesamefork.Iftheeventarrives,itcompletesallwaitstepsthatarewaitingforthisevent.
W:WaitforEventbyUsingWorkflow
WhenwaitingforaneventusingWorkflow,theeventisinitiallyreceivedbytheWorkflowandtransferredtothenextstep,assoonasitisactive.

WhenwaitingusingWorkflow,aneventcancompleteamaximumofonewaitstep.Ifmorethanonewaitstepisactive,theeventcompletestheoldestwaitstep.

Fork
ThisStep-Typeisgenerallyusedwhenweneedparallelprocessingwhichmayormaynotbebasedonanycondition.SpecifyingaConditionisnotmandatoryforaFORKtowork.
Page 8 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow Ste...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types

ThenumberofParallelBranchesspecifiesthatthesemanyarethewaysforparallelprocessing.

EventCreator
ThisEventCreatorsteptypeisusedwhenwehavetoimplementaBOEventoralocalEventaftertheWFhasstarted.
ForthiseventCreatorStep,theeventmustbedefinedfortheBORobjecttypeorclassandacontainerelementmustexistintheworkflowcontainer,whichreferstothisBORobjecttypeorclass.
Entertherequiredcontainerelementandchooseanevent.DothenecessaryBinding.
Wecanusethiseventto,startorcontinueanotherworkflow.

AfterthisEventCreator,youcanimplementaLocalWorkflowtoStartbasedonthisEventTriggeringCondition.

AfterImplementingThisStep-Type,thenextstepwouldcontinueonlywhenthisEventiscreatedintheApplication.Untilandunless,thisEventissatisfied,WFwon'tcontinuefromhere.
Page 9 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow Ste...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types
DocumentfromTemplate
Thesteptype'DocumentfromTemplate'enablesustocreatedocumentsinWorkflowwithdifferentPCapplications.ThesedocumentsarebasedonatemplatethatwecreatewiththePCapplication
whenwedefinetheWorkflow.ThistemplatecanreferenceelementsfromtheWorkflowcontainer.WecandisplayandedittemplatescreatedinthiswaythroughouttheWorkflow.
TheDifferentPCApplicationsare:-

OnemusthavesavedtheWorkflowtobeabletocreateatemplate.ThereceiveroftheWorkflowmusthaveinstalledthePCapplicationlocallyontheirPCtobeabletoexecutetheworkitem.When
theWorkflowisexecuted,thetemplateisopenedintherelevantPCapplicationandcanbecompletedthere.ThedocumentisthensavedinacontainerelementintheWorkflowcontainer.
HowtocreateaDocumentTemplate?
ChoosethisStep-Type.

AworkflowContainernamedWF_DOCUMENT_001automaticallygetscreated.Clickon'CREATE'.
Page 10 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow ...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types

SelectoneoftheOptions.

AfterSelectingaPCApplication,Thesystemfieldsandthecontainerelementsoftheworkflowcontainerareofferedforselectioninthenavigationarea.Theycanbetransferredintothetemplateby
double-clicking.
Page 11 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow ...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types

SelecttoassignanameforthedocumenttemplateandSAVEtheDocumenttemplate.NowExecutetheWorkflowanditgivesustheOptiontoselectfromthevariousTemplatesCreated.The
ContainerFieldsthatwehaveinsertedinourTemplategetsreplacedbytheRun-timeValues.

SelecttheDocumentthatyoucreatedandfindtheruntimevalues.
Page 12 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow ...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types

Form
Wecanuseaformtodisplayoreditdataofacontainerelementoftheworkflowcontainerthatreferstoastructure.Wecanuseallthefieldsinthestructureintheform.Wecanuseawizardto
generatetheformweneedandwecaneditthegeneratedformandmakeourindividualsettings.
Dependingontheactionchosen,theformisdisplayedineitherdisplayoreditmodewhenexecuted.Additionalpushbuttonsaregeneratedfortheapprovalactions.Aswellastheform,theworkflow
toolboxisautomaticallyavailableinexecution.
HowtocreateanduseaFORM?
CreateaWFContainertheTypeofwhichyouneedtheFORMtobe.SelecttheFORMStep-Typethere.

ClickonCREATE.
Page 13 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow ...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types

ClickonCONTINUE.

ClickonCONTINUE.
Page 14 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow ...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types

ClickonCOMPLETE.
FormCreatedSuccessfully.

TheFORMFormat.

NowExecutetheWF.
Page 15 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow ...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types

TheFORMopensupforyoutofill.JustFilltheFORMandPressSAVEANDEXITButton.

AfteryoupresstheSAVEANDEXITButton,thedatagetssavedintherequiredtablefromwhichtheWFContainerwasmade:-CRM_ORDERADM_Iinthiscase.

LocalWorkflow
InalocalWorkflowwecanmodelapartoftheWorkflowthatisstartedbyalocalevent.
Page 16 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow ...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types

InthisLocalWorkflowweshouldcreateourownWorkflowContainerElements,calledasLocalContainers.Theseadditionalcontainerelementsarethenavailabletoallstepsthatbelongtothislocal
WorkflowandcanbefilledfromtheWorkflowcontainerbyeitheraninitialvalueorabinding.


WeonlyneedtodefineabindingifwewanttousetheeventdatainaWorkflow.WemustsettheimportindicatorforlocalcontainerelementsthatarefilledbyabindingfromtheWorkflow
containertoensurethatthebindingcanbetraced.
WithinthisLocalWorkflowyoucanstillcreatesomemoreWFSteps,sothatthisshouldactasaSub-WorkflowfortheoriginalWFinwhichthisLocalWorkflowwascreated.
CreateaSend-mailStepinthisLocalWorkflow:-
RightClickontheDownArrowforLocalException,andClickCreate.SelecttheSend-Mailandenterthevalues.
Page 17 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow ...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types

TheLocalWorkflowLookslikethis:-

ImplementthisLocalWorkflowaftertheEventCreateStep-TypeandseetheEffect.ThisLocalWorkflowwilltriggerfortheSpecifiedEventhappeningafterthestartoftheoriginalWorkflow.Inthe
EventCreatorStep-Type,UsetheLocalWorkflowastheEventCreator:-TRIGGERLOCALEVENT.
Labels

Contact Us Site Index Marketing Opportunities Legal Terms Privacy Impressum


Powered by SAP NetWeaver

workflows
Page 18 of 18 SAP Community Network Wiki - ABAP Development - Brief Overview of Workflow ...
4/19/2011 http://wiki.sdn.sap.com/wiki/display/ABAP/Brief+Overview+of+Workflow+Step-Types

Вам также может понравиться