Transcript
Page 1: BC610 - Workflow Development (Englisch)

SAP AG 1999

%&����:RUNIORZ�'HYHORSPHQW

%&���%&���:RUNIORZ�'HYHORSPHQW:RUNIORZ�'HYHORSPHQW

n R/3: BC610 Workflow Development

n Release 4.6 C

n November 2000

n Material Number: 5004 2450

Page 2: BC610 - Workflow Development (Englisch)

SAP AG 1999

&RS\ULJKW������6$3�$*���$OO�ULJKWV�UHVHUYHG�1HLWKHU�WKLV�WUDLQLQJ�PDQXDO�QRU�DQ\�SDUW�WKHUHRI�PD\EH�FRSLHG�RU�UHSURGXFHG�LQ�DQ\�IRUP�RU�E\�DQ\�PHDQV�RU�WUDQVODWHG�LQWR�DQRWKHU�ODQJXDJH��ZLWKRXW�WKH�SULRUFRQVHQW�RI�6$3�$*��7KH�LQIRUPDWLRQ�FRQWDLQHG�LQ�WKLVGRFXPHQW�LV�VXEMHFW�WR�FKDQJH�DQG�VXSSOHPHQW�ZLWKRXW�SULRUQRWLFH�$OO�ULJKWV�UHVHUYHG�

&RS\ULJKW

7UDGHPDUNV:n Some software products marketed by SAP AG and its distributors contain proprietary software

components of other software vendors.n Microsoft®, WINDOWS®, NT®, EXCEL®, Word® and SQL Server® are registered trademarks of

Microsoft Corporation.n IBM®, DB2®, OS/2®, DB2/6000®, Parallel Sysplex®, MVS/ESA®, RS/6000®, AIX®, S/390®,

AS/400®, OS/390®, and OS/400® are registered trademarks of IBM Corporation.n ORACLE® is a registered trademark of ORACLE Corporation, California, USA.n INFORMIX®-OnLine for SAP and Informix® Dynamic ServerTM are registered trademarks of

Informix Software Incorporated.n UNIX®, X/Open®, OSF/1®, and Motif® are registered trademarks of The Open Group.n HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C®, World Wide

Web Consortium, Laboratory for Computer Science NE43-358, Massachusetts Institute ofTechnology, 545 Technology Square, Cambridge, MA 02139.

n JAVA® is a registered trademark of Sun Microsystems, Inc. , 901 San Antonio Road, Palo Alto, CA94303 USA.

n JAVASCRIPT® is a registered trademark of Sun Microsystems, Inc., used under license fortechnology invented and implemented by Netscape.

n SAP, SAP Logo, mySAP.com, mySAP.com Marketplace, mySAP.com Workplace, mySAP.comBusiness Scenarios, mySAP.com Application Hosting, WebFlow, R/2, R/3, RIVA, ABAP™, SAPBusiness Workflow, SAP EarlyWatch, SAP ArchiveLink, BAPI, SAPPHIRE, Management Cockpit,SEM, are trademarks or registered trademarks of SAP AG in Germany and in several other countriesall over the world. All other products mentioned are trademarks or registered trademarks of theirrespective companies.

n Design: SAP Communications Media

Page 3: BC610 - Workflow Development (Englisch)

SAP AG 1999

%XVLQHVV�,QWHJUDWLRQ�7HFKQRORJLHV�,

SAP BusinessWorkflow - Introduction

���������2 days

/HYHO�� /HYHO��

WorkflowSAP BusinessWorkflow - Programming

�������3 days

Archiving

SAP ArchiveLink

�������3 days

ADK - Retrievalprogramming

������ ��2 days

Web connectionSAP Business Connector

���������2 days

Data Archiving

���������3 days

SAP BusinessWorkflow -Build and Use

�������5 days

Data Archiving RetentionTool (DART)

���������2 days

Page 4: BC610 - Workflow Development (Englisch)

SAP AG 1999

%XVLQHVV�,QWHJUDWLRQ�7HFKQRORJLHV�,,

Business IntegrationTechnology

���������3 days

/HYHO�� /HYHO��

Data Transfer

���������5 days

Programming withBAPIs in Visual Basic

���������5 days

R/3 Interface and BAPIProgramming in C++

�������� 5 days

���������! #"%$&�'(��)+*���"�,�,.- ��*

/0"&�#"��&1�$+23"��%*��

CommunicationInterfaces in ABAP

�����4+�2 days

Programming withBAPIs in JAVA

���5�(�(�5 days

SAP IDoc Interface -Development

�������61 day

SAP IDoc InterfaceTechnology

���������2 days

Application LinkEnabling (ALE)Technology

�������3 days

EDI Interface

���5�7��4 days

Page 5: BC610 - Workflow Development (Englisch)

SAP AG 1999

l (VVHQWLDO�%&������,QWURGXFWLRQ�WR�WKH�$%$3�:RUNEHQFK%&������$%$3�'LFWLRQDU\%&������6$3�%XVLQHVV�:RUNIORZ���,QWURGXFWLRQ%&������6$3�%XVLQHVV�:RUNIORZ���%XLOG�DQG�8VH*RRG�RU�YHU\�JRRG�NQRZOHGJH�RI�$%$3

l 5HFRPPHQGHG�%DVLF�NQRZOHGJH�RI�REMHFW�RULHQWHG�SURJUDPPLQJ%DVLF�NQRZOHGJH�RI�WUDQVDFWLRQ�FRQFHSWV

3UHUHTXLVLWHV��%&�����

Page 6: BC610 - Workflow Development (Englisch)

SAP AG 1999

l :RUNIORZ�GHYHORSHUV�DQG�FRQVXOWDQWV�ZLWK�JRRG�RUYHU\�JRRG�NQRZOHGJH�RI�$%$3

7DUJHW�$XGLHQFH��%&����

Page 7: BC610 - Workflow Development (Englisch)

© SAP AG BC610 1-1

SAP AG 1999

&RXUVH�2YHUYLHZ

l &RXUVH�*RDOVl &RXUVH�2EMHFWLYH�V�l &RXUVH�&RQWHQWl &RXUVH�2YHUYLHZ�'LDJUDP

Page 8: BC610 - Workflow Development (Englisch)

© SAP AG BC610 1-2

SAP AG 1999

$W�WKH�FRQFOXVLRQ�RI�WKLV�FRXUVH��\RX�ZLOO�EH�DEOH�WR�

&RXUVH�*RDOV

l 3HUIRUP�ZRUNIORZ�SURJUDPPLQJ�DW�DOO�OHYHOVl 0DQDJH�DQG�PRQLWRU�WKH�ZRUNIORZ�UXQWLPH�V\VWHP

Page 9: BC610 - Workflow Development (Englisch)

© SAP AG BC610 1-3

SAP AG 1999

l ,GHQWLI\�DOO�SRLQWV�LQ�WKH�ZRUNIORZ�V\VWHP�DW�ZKLFKSURJUDPPLQJ�LV�SRVVLEOH�RU�QHFHVVDU\

l &UHDWH�\RXU�RZQ�REMHFW�W\SHV�DQG�H[WHQG�H[LVWLQJRQHV

l &UHDWH�UROH�IXQFWLRQ�PRGXOHVl 3URJUDP�HYHQWVl &UHDWH�FKHFN�DQG�UHFHLYHU�W\SH�IXQFWLRQ�PRGXOHV

$W�WKH�FRQFOXVLRQ�RI�WKLV�FRXUVH��\RX�ZLOO�EH�DEOH�WR�

&RXUVH�2EMHFWLYHV����

Page 10: BC610 - Workflow Development (Englisch)

© SAP AG BC610 1-4

SAP AG 1999

&RXUVH�2EMHFWLYHV����

l &UHDWH�ZRUN�LWHPV�YLD�$3,l $GPLQLVWUDWH�WKH�ZRUNIORZ�UXQWLPH�V\VWHP

$W�WKH�FRQFOXVLRQ�RI�WKLV�FRXUVH��\RX�ZLOO�EHDEOH�WR�

Page 11: BC610 - Workflow Development (Englisch)

© SAP AG BC610 1-5

SAP AG 1999

Unit 6 (YHQW�'HILQLWLRQ�DQG,PSOHPHQWDWLRQUnit 7 :RUNIORZ�5XQWLPH6\VWHP

Unit 1 &RXUVH�2YHUYLHZUnit 2 ,QWURGXFWLRQUnit 3 2EMHFW�'HILQLWLRQ�DQG,PSOHPHQWDWLRQUnit 4 7DVNVUnit 5 5ROHV

3UHIDFH

([HUFLVHV6ROXWLRQV$SSHQGL[

&RXUVH�&RQWHQW

Page 12: BC610 - Workflow Development (Englisch)

© SAP AG BC610 1-6

SAP AG 1999

&RXUVH�2YHUYLHZ�'LDJUDP

2UJDQL]DWLRQ

3URFHVVHV

%XVLQHVVREMHFWV

0HWKRGV

:)�GHILQLWLRQ 6WHS

(YHQWV

2EMHFW

$WWULEXWHV

3HUVRQ 3RVLWLRQ�MRE 2UJ��XQLW

5ROH 7DVN

Page 13: BC610 - Workflow Development (Englisch)

© SAP AG BC610 1-7

SAP AG 1999

0DLQ�%XVLQHVV�6FHQDULR

n Full text in appendix.

Page 14: BC610 - Workflow Development (Englisch)

© SAP AG BC610 2-1

SAP AG 1999

,QWURGXFWLRQ

l 7DVNV�RI�D�ZRUNIORZ�V\VWHPl 6$3�%XVLQHVV�:RUNIORZ�$UFKLWHFWXUHl 3URJUDPPLQJ�LQ�6$3�%XVLQHVV�:RUNIORZ

&RQWHQWV�

Page 15: BC610 - Workflow Development (Englisch)

© SAP AG BC610 2-2

SAP AG 1999

,QWURGXFWLRQ��8QLW�2EMHFWLYHV

l ([SODLQ�WKH�6$3�%XVLQHVV�:RUNIORZ�DUFKLWHFWXUHl 5HFRJQL]H�WKH�FRPSRQHQWV�RI�6$3�%XVLQHVV

:RUNIORZ�WKDW�HQDEOH�RU�UHTXLUH�SURJUDPPLQJ�E\�WKHXVHU

$W�WKH�FRQFOXVLRQ�RI�WKLV�XQLW��\RX�ZLOO�EH�DEOH�WR�

Page 16: BC610 - Workflow Development (Englisch)

© SAP AG BC610 2-3

SAP AG 1999

:KDW�,V�:RUNIORZ�0DQDJHPHQW"

l $�V\VWHP�WKDW�GHOLYHUV�ZRUN� ,Q�WKH�FRUUHFW�VHTXHQFH� :LWK�DOO�WKH�QHFHVVDU\�LQIRUPDWLRQ� $W�WKH�FRUUHFW�WLPH� 7R�WKH�SHRSOH�UHVSRQVLEOH

n Linking work steps automatically

n Application-independent control of connected activities across transactions

Page 17: BC610 - Workflow Development (Englisch)

© SAP AG BC610 2-4

SAP AG 1999

7DVNV�RI�D�:RUNIORZ�0DQDJHPHQW�6\VWHP

l 3URFHVV�GHILQLWLRQ�:KDW�KDSSHQV�LQ�ZKDW�RUGHU"�:RUNIORZ�EXLOGHU��WDVN�GHILQLWLRQ

l 2UJDQL]DWLRQ�PRGHOLQJ�:KR�GRHV�ZKDW"�2UJDQL]DWLRQ�PRGHO��UROH�GHILQLWLRQ

l $SSOLFDWLRQ�HQFDSVXODWLRQ�:KLFK�REMHFWV�DUH�UHTXLUHG"�%XVLQHVV�2EMHFW�%XLOGHU��%XVLQHVV�2EMHFW�5HSRVLWRU\

n Process definition - "Work is delivered in the correct sequence ..."

n Organization modeling - "Work is delivered to the people responsible ..."

n Application encapsulation - "Work is delivered with all the necessary information ..."

Page 18: BC610 - Workflow Development (Englisch)

© SAP AG BC610 2-5

SAP AG 1999

7DVNV�RI�D�:RUNIORZ�0DQDJHPHQW�6\VWHP

l (QG�XVHU�VXSSRUW�:KDW�KDYH�,�JRW�WR�GR�WRGD\"�%XVLQHVV�:RUNSODFH

l 3URFHVV�FRQWURO�:KDW�KDSSHQV�ZKHQ"�:RUNIORZ�PDQDJHU��ZRUN�LWHP�PDQDJHU

l 3URFHVV�HYDOXDWLRQ�:KR�GLG�ZKDW�DQG�ZKHQ"�5HSRUWLQJ�DQG�DQDO\VLV

n End user support - "Work is delivered to the people responsible at the correct time ..."

n Process control - "Work is delivered in the correct sequence at the correct time ..."

Page 19: BC610 - Workflow Development (Englisch)

© SAP AG BC610 2-6

SAP AG 1999

2UJDQL]DWLRQ

3URFHVVHV

%XVLQHVVREMHFWV

0HWKRGV

:)�GHILQLWLRQ 6WHS

(YHQWV

2EMHFW

$WWULEXWHV

3HUVRQ 3RVLWLRQ�MRE 2UJ��XQLW

5ROH 7DVN

6$3�%XVLQHVV�:RUNIORZ��'HILQLWLRQ�$UFKLWHFWXUH

n Explanation A –! B = A uses B

n Example:Step definition uses attributes (container operation), events (wait steps), methods (secondarymethods).Task uses workflow definition (in multistep tasks) or methods (in single-step tasks).

Page 20: BC610 - Workflow Development (Englisch)

© SAP AG BC610 2-7

SAP AG 1999

2UJDQL]DWLRQ

3URFHVVHV

%XVLQHVVREMHFWV

0HWKRGV

:)�GHILQLWLRQ 6WHS

(YHQWV

2EMHFW

$WWULEXWHV

3HUVRQ 3RVLWLRQ�MRE 2UJ��XQLW

5ROH 7DVN

6$3�%XVLQHVV�:RUNIORZ��3URJUDPPLQJ

n Other areas in which programming is possible:

é Administration

é Reporting

é Creation of work items

Page 21: BC610 - Workflow Development (Englisch)

© SAP AG BC610 2-8

SAP AG 1999

:KDW�'RHV�:RUNIORZ�1RW�'R"

l 6LPSOLI\�DSSOLFDWLRQ�WUDQVDFWLRQV�&RPSOH[�DSSOLFDWLRQ�IXQFWLRQV�UHPDLQ�FRPSOH[DSSOLFDWLRQ�IXQFWLRQV

l 3URYLGH�HIILFLHQW�EXVLQHVV�SURFHVVHV�DXWRPDWLFDOO\�%XVLQHVV�DVSHFWV�PXVW�EH�FDWHUHG�IRU�E\�PRGHOHUV

n Existing interfaces or menu structures cannot be affected through using workflow.

n As soon as the application is called via the workflow, only the application has control over whichactions can be performed.

Page 22: BC610 - Workflow Development (Englisch)

© SAP AG BC610 2-9

SAP AG 1999

,QWURGXFWLRQ���8QLW�6XPPDU\

l ([SODLQ�WKH�6$3�%XVLQHVV�:RUNIORZ�DUFKLWHFWXUHl 1DPH�WKH�FRPSRQHQWV�RI�6$3�%XVLQHVV�:RUNIORZ

WKDW�HQDEOH�RU�UHTXLUH�SURJUDPPLQJ�E\�WKH�XVHU

Page 23: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-1

SAP AG 1999

2EMHFW�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ

l 0RWLYDWLRQ�DQG�EDVLF�FRQFHSWVl 2EMHFW�GHILQLWLRQl 2EMHFW�LPSOHPHQWDWLRQ

&RQWHQWV�

Page 24: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-2

SAP AG 1999

$W�WKH�FRQFOXVLRQ�RI�WKLV�XQLW��\RX�ZLOO�EH�DEOH�WR�l ([SODLQ�WKH�EDVLF�WHFKQLFDO�FRQFHSWV�RI�WKH�%XVLQHVV

2EMHFW�5HSRVLWRU\l ([SODLQ�WKH�GHSHQGHQFLHV�EHWZHHQ�REMHFW�GHILQLWLRQ

DQG�LPSOHPHQWDWLRQl &UHDWH�D�QHZ�REMHFW�W\SH�RU�H[WHQG�DQ�H[LVWLQJ�RQHl ,PSOHPHQW�DQ�REMHFW�W\SH�XVLQJ�WKH�REMHFW�PDFURV

2EMHFW�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ��8QLW2EMHFWLYHV

n BOR - Business Object Repository - Data

n BOB - Business Object Builder - Tool

Page 25: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-3

SAP AG 1999

2UJDQL]DWLRQ

3URFHVVHV

%XVLQHVVREMHFWV

0HWKRGV

:)�GHILQLWLRQ 6WHS

(YHQWV

2EMHFW

$WWULEXWHV

3HUVRQ 3RVLWLRQ�MRE 2UJ��XQLW

5ROH 7DVN

&RXUVH�2YHUYLHZ�'LDJUDP

Page 26: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-4

SAP AG 1999

2EMHFWV���0RWLYDWLRQ

.H\V $WWULEXWHV 0HWKRGV

%XVLQHVV�2EMHFW5HSRVLWRU\

7DEOH������� ��� �� �

7DEOH������� ��� � � �

7$��7$��5HSRUW;;

$SSOLFDWLRQ

&KDQJH�GRFXPHQWV��VWDWXV�PDQDJHPHQW����

(YHQWV

n Note: Events are dealt with later in a separate unit

n The application data (tables) and the changes and queries (transactions and reports) that can beperformed on this data are encapsulated in the Business Object Builder.This encapsulation is used

é To simplify process modeling

é As a standard interface for the workflow runtime system

Page 27: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-5

SAP AG 1999

&RQGLWLRQDOEUDQFK

(YHQWFUHDWRU

/RRS

)RUN

:DLW�IRUHYHQW

&RQWDLQHU�RSHUDWLRQ

6WHS�GHILQLWLRQ

8VLQJ�2EMHFWV

n Objects are used in

Tasks → Executing methods

Control structures → Querying attributes

Container operation → Querying attributes

Wait steps, event creator → Triggering or receiving events

Check FM, receiver type FM → Querying attributes

Receiver function module → Receiving events

Roles → Querying attributes

Secondary methods → Calling methods

Page 28: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-6

SAP AG 1999

2EMHFW�7\SHV���5HODWLRQVKLSV

l ,QKHULWDQFH)XQFWLRQDO�H[WHQVLRQ����LV�D�W\SH�RI�

l &RPSRVLWLRQ.H\�H[WHQVLRQ����LV�SDUW�RI�

l $VVRFLDWLRQ)RUHLJQ�NH\�UHODWLRQVKLS����LQ�UHODWLRQ�WR�

n Example of inheritance: Accounting document → Customer document

n Key extensions are not allowed with inheritance. Interfaces can only be extended in an upward-compatible manner (only possible to add new components or redefine existing ones).

n Example of composition: Order → Order item

n Example of association: Material → Purchase requisition

Page 29: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-7

SAP AG 1999

3URJUDP2EMHFW�W\SH

,QWHUIDFHV

.H\ILHOGV

0HWKRGV

(YHQWV

9LUWXDO�DWWULEXWHV)LHOG�UHIHUHQFHV2EMHFW�UHIHUHQFHV

6\QFKURQRXV

$V\QFKURQRXV

$%$3�&RGH

7UDQVDFWLRQ

5HSRUW

)XQFWLRQ�PRGXOH

$WWULEXWHV

2EMHFW�7\SH���'HILQLWLRQ

n BOR is a client-independent directory of all defined object types

n Each object type is assigned to a development class and, therefore, indirectly to an applicationcomponent.

Page 30: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-8

SAP AG 1999

2EMHFWV��3URSHUWLHV

l 'DWD�HQFDSVXODWLRQl ,QKHULWDQFHl 3RO\PRUSKLVP

n Object definitions and implementations can only be manipulated via the Business Object Builder.

n Data encapsulation - definition: Abstraction for the modeler, irrespective of the concrete SAP tables,transactions, etc.

n Data encapsulation - runtime: A standard interface for calling application functionality is available tothe workflow runtime system, irrespective of the actual implementation.

n Inheritance: Object properties such as attributes, methods and events are passed on to subtypes.Properties inherited can be redefined in the subtype.

n Polymorphism: Depending on the object type, the object manager always selects the relevantimplementation for the property requested. This property is implemented technically using the "latebinding" principle.

n Dynamic call interface for calls from the workflow runtime system.

Page 31: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-9

SAP AG 1999

,QWHUIDFHV

l $VVXUDQFH�RI�D�SDUWLFXODU�EHKDYLRUl 'HILQLWLRQV�RI�DWWULEXWHV��PHWKRGV��HYHQWVl 6SHFLILFDWLRQ�RI�D�GHIDXOW�LPSOHPHQWDWLRQl +LHUDUFKLFDO�VWUXFWXUHl 5HSODFHPHQW�IRU�PXOWLSOH�LQKHULWDQFH

n The implementation of an interface using an object type means the assurance of a particularbehavior.

n The definition of an interface can contain a specified default implementation that is used if theincluding object type does not perform any implementation of its own.

n An object type that implements an interface must implement all the attributes and methods belongingto the interface (unless there is a default implementation).

n At present, the Business Object Builder does not check whether all the components belonging to theinterface are actually implemented.

n Interfaces can also enter into inheritance relationships.

n Interfaces replace multiple inheritance. They offer the same options as multiple inheritance, but areeasier to handle (for example, no conflicts when method names are the same).

Page 32: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-10

SAP AG 1999

%86����%86���� %86���� %86���� %86����

%86����

%.3) (..2 9%$.

'RFXPHQWV

��������������������������! #"$

),), 6'6'0000

���&%���'����%

���&%��(�)����%

���(� �#���������

,QWHUIDFHV���([DPSOH

n BKPF Posting documentBUS2019 Customer documentBUS2020 Vendor documentBUS2041 Asset documentBUS2069 G/L account documentBUS2029 Price changeEKKO Purchasing documentVBAK Sales documentBUS2032 Sales order

n IFSTATUS Generate events from status managementIFARCH21 Archive Link InterfaceIFIDOCOUT IDoc outbound processing

Page 33: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-11

SAP AG 1999

.H\�)LHOGV

l 6SHFLILFDWLRQ�RI�REMHFW�NH\l 6HYHUDO�NH\�ILHOGV�SRVVLEOHl 5HIHUHQFH�WR�XQGHUO\LQJ�DSSOLFDWLRQ�WDEOH�V�l &OLHQW�QRW�QHFHVVDU\

n The English ABAP Dictionary names are proposed automatically as the names of the key fields.

n Key fields must be character-based.

n The concatenated key fields can contain a maximum of 70 characters.

Page 34: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-12

SAP AG 1999

$WWULEXWHV

l 'DWDEDVH�RU�YLUWXDO�DWWULEXWHVl 7\SH�LQIRUPDWLRQ�IURP�$%$3�'LFWLRQDU\�ILHOG�RU

REMHFW�W\SHl 6LQJOH�OLQH�DQG�PXOWLSOH�OLQH�DWWULEXWHV

n Database attributes are read from the associated application table and buffered in the object. Sourcecode is generated beforehand by the Business Object Builder for this purpose.

n Virtual attributes are calculated on calling.

n There are different macros for single-line and multiple-line attributes.

Page 35: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-13

SAP AG 1999

9LUWXDO�$WWULEXWHV

l &RPELQDWLRQ�RI�RWKHU�DWWULEXWHV�RU�FRQVWDQWVl ([SOLFLW�LPSOHPHQWDWLRQ�UHTXLUHGl &DOFXODWLRQ�XSRQ�DWWULEXWH�DFFHVVl %XIIHULQJ�LQ�WKH�%XVLQHVV�2EMHFW�%XLOGHU

n For performance reasons, virtual attributes are always preferable to reading background steps,because the evaluation can take place directly in the workflow manager removing the need to createa background step.

n The Business Object Builder cannot generate a source code for virtual attributes. The algorithmrequired for calculation of the attribute value must therefore always be explicitly programmed.

n Typical examples:

� language-dependent texts

� time-dependent values

� net/gross values

� object references

Page 36: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-14

SAP AG 1999

l &RUUHVSRQG�WR�LQWHUQDO�WDEOHVl $UH�DOPRVW�DOZD\V�YLUWXDO�DWWULEXWHVl &DQ�FRQWDLQ�HLWKHU�GDWDEDVH�ILHOGV�RU�REMHFW�UHIHUHQFHV

0XOWLSOH�/LQH�$WWULEXWHV

n Example:

List of purchase requisitions for a material (BUS1001.PurchaseRequisition).

Page 37: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-15

SAP AG 1999

6\QFKURQRXV�$V\QFKURQRXV�0HWKRGV

l 6\QFKURQRXV�PHWKRG* 5HVXOW�UHWXUQHG�GLUHFWO\�WR�FDOOLQJ�SURJUDP* 5HWXUQ�RI�H[FHSWLRQV�SRVVLEOH

l $V\QFKURQRXV�PHWKRG* 5HVXOW�FDQ�RQO\�EH�UHWXUQHG�YLD�DQ�HYHQW* 2QO\�UHVWULFWHG�H[FHSWLRQV�SRVVLEOH* 0HWKRG�LWVHOI�GRHV�QRW�ZDLW�IRU�D�SRVVLEOH�WHUPLQDWLQJ�HYHQW

n (Import) parameters can be defined in both.

n Asynchronous methods are always necessary if the encapsulated application functionality usesupdating.

n Asynchronous methods can only trigger exceptions in the "dialog part".

Page 38: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-16

SAP AG 1999

0HWKRG

&DOOHU,PSRUW

([SRUW5HVXOW([FHSWLRQV

7LPH

6\QFKURQRXV�0HWKRGV

l $OO�GLVSOD\�PHWKRGVl $OO�PHWKRGV�WKDW�GR�QRW�ZULWH�WKHLU�FKDQJHV�WR�WKH

GDWDEDVH�XVLQJ�WKH�XSGDWH�WDVN

n The solid arrows represent the control flow.

n The broken arrows represent the transfer of data and control flow.

n The dotted line represents the waiting time of the caller.

Page 39: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-17

SAP AG 1999

0HWKRG

&DOOHU,PSRUW

'LDORJ

7LPH

8SGDWH

$V\QFKURQRXV�0HWKRGV

l $OO�PHWKRGV�WKDW�ZULWH�WKHLU�FKDQJHV�WR�WKH�GDWDEDVHXVLQJ�WKH�XSGDWH�WDVN

l 3URFHVVHV�PXVW�EH�V\QFKURQL]HG

n The solid arrows represent the control flow.

n The broken arrows represent the data transfer.

n The dotted line represents the waiting time of the caller.

n The distinction between synchronous and asynchronous applies to both dialog and backgroundmethods.

n It is up to the caller to coordinate a resynchronization as necessary.It is up to the method to make the synchronization possible technically (→ Events).

Page 40: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-18

SAP AG 1999

&RPPXQLFDWLRQ�0HWKRGV��&DOOHU���0HWKRG

l &RPPXQLFDWLRQ�YLD�SDUDPHWHUV* Import parameters* Export parameters

l &RPPXQLFDWLRQ�YLD�UHVXOWl &RPPXQLFDWLRQ�YLD�H[FHSWLRQV

* Temporary error* Application error* System error

l &RPPXQLFDWLRQ�YLD�HYHQW

n Synchronous methods support communication via parameters, results and exceptions.

n Asynchronous methods support communication via import parameters. An event should be triggeredonce they have been processed.

n Export parameters should be avoided. Use a result instead. The result can be multiple-line.Parameters should be avoided completely if the value can also be read as an object attribute.

n If the result is based on a fixed value domain, automatic branching is possible via these values in theWF definition.

n If object attributes on the database are changed in the method, the Business Object Builder objectbuffer must be invalidated with the macro SWC_REFRESH_OBJECT.

n The type of exception subsequently determines error handling in the work item.

n Exceptions are generally triggered via the macro EXIT_RETURN. There are two special macros,EXIT_OBJECT_NOT_FOUND and EXIT_CANCELLED, the latter is used to return a usertermination in a synchronous method. User terminations reported in this way are then treated astemporary errors.

Page 41: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-19

SAP AG 1999

6WHS�PHWKRG�

2.2. 7HPS�HUURU7HPS�HUURU

6\V�HUURU6\V�HUURU

6XEVHTXHQWVWHS

6XEVHTXHQWVWHS

6XEVHTXHQWVWHS

0RGHOHG

6\V�HUURU6\V�HUURU

,Q�SURFHVV (UURU

1RW�PRGHOHG

7HPS�HUURU7HPS�HUURU

5HDFWLRQ�WR�([FHSWLRQ���'LDORJ�6WHS

In the workflow definition… The exception is defined for the object method…

…as a temporary exception: …as an application or system error:

… a subsequent step is The status of the step changes to “completed” and the modeled for this exception subsequent step is executed

… no subsequent step is The step is not yet completed The status of the stepmodeled for this exception and remains 'in process'.andassociated workflow changes to

“error”.

Page 42: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-20

SAP AG 1999

5HDFWLRQ�WR�([FHSWLRQ���%DFNJURXQG�6WHS

6WHS�PHWKRG�

+-,+., /�0#132540#67698)6/�0�1:2�40�676;8!6

<!=�> 40�6?6@8)6<�=�> 40�6A6;8!6

<�B5CD> 0�E B 0�F�G> G@0�2

0RGHOHG

<�=�> 40�6A698)6<�=�> 4056A6;8!6

H FI2�698�J�0 >�>

K 67698)6

1RW�PRGHOHG

/50�1L2540�676;8)6/�0�1:2�40#6?6;8)6

/50�132540#67698)6/�0�1L2�40#676;8!6

/50�132'40�676;8!6/�0�132�40#6?6;8)6

MON G9P�8 B GJD8 B FDG;0#6

MON G9PIJD8 B F�GQ0#6

K 676;8!6

MON G9P�8 B G'JD8 B FDG@0�6 MRN GAPSJD8 B FDGQ0#6

<TB�CD> 0�E B 0�FDG> G@0#2<UB�CD> 0�E B 05FDG> G;0#2

<�B�C�> 0�E B 0#FDG> G@0#2

H FI256;8�JD0 >D>H FI256;8�JD0 >D>

n Background steps also offer the option of modeling a repeat counter for a temporary error.If this repeat counter is modeled and an error occurs, the step is repeated automatically as often asdefined, before either assuming "error" or "completed" status (with subsequent execution of thesubsequent step modeled).

Page 43: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-21

SAP AG 1999

9LUWXDO�$WWULEXWHV5HDG�RU�FDOFXODWH�LQGLYLGXDO�YDOXHV�RU�D�OLVW�RI�KRPRJHQHRXV�YDOXHV

(YDOXDWLRQ�DQG�H[HFXWLRQ�LQZRUNIORZ�PDQDJHU

%XIIHULQJ�RI�WKH�UHVXOWV�LQ�WKH�%XVLQHVV�2EMHFW�%XLOGHU)L[HG�FRPPXQLFDWLRQ�ZLWK�WKHFDOOHU

%DFNJURXQG�0HWKRGV5HDG�RU�FDOFXODWH�D�OLVW�RIKHWHURJHQHRXV�YDOXHV

&DOFXODWH�YDOXHV�ZKLFK�DUH�QRWGHSHQGHQW�RQ�RWKHU�DWWULEXWHV�RUV\VWHP�YDOXHV&KDQJH�YDOXHV(YDOXDWLRQ�LQ�ZRUNIORZPDQDJHU��H[HFXWLRQ�LQZRUN�LWHP�PDQDJHU

$OO�FRPPXQLFDWLRQ�PHWKRGVSRVVLEOH

1R�EXIIHULQJ�RI�UHVXOWV

9LUWXDO�$WWULEXWHV���%DFNJURXQG�0HWKRG

n The buffering of the virtual attributes must be programmed explicitly in the implementation of theattribute.

n The return of the value of a virtual attribute to the caller corresponds, in principle, to a result value ofa method.

Page 44: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-22

SAP AG 1999

(YHQWV

l 'HILQLWLRQ�DQG�LPSOHPHQWDWLRQ�DUH�VHSDUDWHl 'HIDXOW�SDUDPHWHUV�QHHG�QRW�EH�VHW�H[SOLFLWO\l 8VHU�GHILQHG�SDUDPHWHUV�DUH�VHW�H[SOLFLWO\�YLD�FRQWDLQHU

PDFURVl 'RFXPHQWDWLRQ�LV�LQGLVSHQVDEOH

n Only definitions of events in the Business Object Builder.

n Default parameters are in the include RSWEINCL.The following parameters are always incorporated:

� Triggering object (type, key and object reference)

� Name of event

� Language, date and time

� Triggering user.

n User-defined parameters are only possible for events that are programmed explicitly. Parametersshould not be object attributes of the triggering object.

Page 45: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-23

SAP AG 1999

2EMHFW�7\SH���5HOHDVH�6WDWXV

l 0RGHOHG1RW�DFFHVVLEOH�DW�UXQWLPH�

l ,PSOHPHQWHG2QO\�LQ�WHVWV�RU�LQWHUQDO�XVH��SRVVLEO\�XQVWDEOH�

l 5HOHDVHG5HOHDVHG�IRU�XVH�E\�WKH�FXVWRPHU��2QO\�XSZDUG�FRPSDWLEOH�HQKDQFHPHQWV�SRVVLEOH�

l 2EVROHWH7KH�IXQFWLRQDOLW\�KDV�EHHQ�UHSODFHG��7KH�ROGIXQFWLRQDOLW\�LV�VWLOO�VXSSRUWHG�IRU�WZR�UHOHDVHV�

n The "modeled" status is the only status in which execution is not possible. Customers should,however, only use components with the "released" status.

n The release information should be noted when a component’s status changes to "obsolete".

Page 46: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-24

SAP AG 1999

l 2EMHFW�QDPH'HVFULSWLYH�QDPH�IRU�REMHFWV�RI�WKLV�W\SH

l 'HIDXOW�PHWKRG'LVSOD\�IRU�SUHVHQWLQJ�DQ�REMHFW�LQVWDQFH

l 'HIDXOW�DWWULEXWH,GHQWLI\LQJ�DWWULEXWH�RI�DQ�REMHFW�LQVWDQFH

2EMHFW�7\SH���'HIDXOW�6HWWLQJV

n The object name is used as the element name in the container definition, for example.

n The default method is used, for example, when you double-click objects in a list of object links.

n The default attribute is used, for example, to display objects in lists.

Page 47: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-25

SAP AG 1999

,PSOHPHQWLQJ�.H\�)LHOGV

V?W�XZYA[�\�]-^�_7`�ab]�X�cZdDe`&]�f�V7WAgh\�i�c?ij_7`�a?]�X�cDelknmh_.W�_�cSX7o�ibW�f�]�e�e�mZp�q9pLV�r.f�]bW�]�sbi�c?]Z\

\�i�c?iDtkn`&]bf�V?WI_�uwv�sZV9xhi�cb]Dykzcb_S\�]�X�Ybi�sb]{vhs�V9x&i�c?]ji�c�cbsZVA`�[hc?]�rSsZ]A|&_7x&]IXb_7|b|&]ZW�c�r.iZWZ\k}VbW�rb]�s�c~v�sZV9xhi�cb]Si�cZcZsZV;`�[&c?]�r{o�]�sZ]�eZeZek~]bWb\I_�u~v�sZVAx&i�cb]Dy`�]Zf�V?WI_�u-��]A�#yrbi�YZ]�r7\�_�X?[?|&]ZW�cSYZVb��]{xb`hib�h�@xZ`h]�Y?W�y]bWb\I_�u.��]A��y

]bW�\9g&\�i�cbiS_7`�ab]�X�cDe~kUmh_SWZ_�cSX7o�ibW�fZ]�e�e�mbp�q9p:V�r-fb]bW�]�sZi�c?]Z\

��Z�;���A� �9� ���Z�A� �;�A���7�9�7���9�9����;���9� �9� ���Z�;� �Q�?���A�9�?�D�9�;����@� � � �9� ��(��� �@�Q�7� �7�A����9� �;�@�9��?� �Q� �A�

���9� �@�A���7�A�A���;�;����9�A�@�; @��7¡£¢���9� �;�@�;�9�¤7�Q¥@� �¦��9������@�;�A§ � �;� � �b� ���9� �@���?�7�9�7���;�;����9� �@���?�7�9�7���;�;����Q� �� �A�7�D§ �@� �9§ �9�7¨

©h�Z¢(�©h�&ªZ«7¦

���Q� �9§ �9�7�@�� � � � ����Q� �9§ �9�7�@�� � �;� ��Z�9�9§ �9¬�¬7�9� �

­~_ZW�YA�Sv�sZVAx&i�cb]{|&]A|�`&]�s�rl|&iA�j`h]jVbW�rb]�s�cb]b\­wVbW�cb_Ir�cbs?[�X�c7[�sZ]wv�sZVAx&i�cb]

n Each object type has a program that implements the object type.

n The macro instructions required for programming are incorporated via the include <object>.

n The Business Object Builder always works with object references. These references are used to readand manipulate the actual application data. An object reference of this kind must be created in thecalling program with the macro SWC_CREATE_OBJECT before a method is called or an attributedetermined.

n Each object program contains the variable SELF which, in turn, contains a reference to the objectinstance with which the program was called.

n The object-key-sales document variable (generally: object-key-<name of key>) is declared inconjunction with the BEGIN_DATA OBJECT macro.

n The declaration between BEGIN_DATA and END_DATA is generated entirely from the definitiondata.

Page 48: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-26

SAP AG 1999

,PSOHPHQWLQJ�'DWDEDVH�)LHOG�$WWULEXWHV

¥¢�� � § � � �;� �����?�;�?���9�;� ����� �¢&� � § � � �;� �����7�9�7���;�9� ���Q� �¢�� � § � � �9� ��(��� �@�Q�7� �7�9��Z�A� �9�Q�9��?� ��� �;�

���7�9�7���;�9� ���Q� �©&�Z¢� ;�@¢���9� �;�@�9�@�¤A�@¥@� �¦��9������@�9�9§ � �;� � �b� ���7�9�7���;�9�b�A�@� ����7�9�7���;�9�b�A�@� ��® � � � �7�7�7���7§Z�b�;� � �b�A�A�7¯

�Z�@� �� �9�7�D§ �Q� �;§ �9�7¨

�Z�?�7§ �;�©�� § � �A�9������ � � �@�9�� � �;� �

¢�� � § � � �9� �D�7§ �?�9�A§ � � �@�° �A� � � �7� �@± � � �A�°�9�A�7�Q� �?§ �² �A�Q� �9�A�;�9± � �A�7�9�A�A�9�7�A�@�

��� �Q� � �?�7�;§ ������ �A§ �;�7�@�� � � � ������ �A§ �;�7�@�� � �9� �

�(�Q� �;���?� �A�7�² �;³9�9§ �;���@� � § � � �;� �

�Z�9�;§ �9¬�¬7�;� �©&�Z¢�¢´&�b¢�¤

fZ]�cQg(cbiA`�Yb];g�vhsZ_Av&]�s�c9�Sx�`&iZ��e\�i�c?iIrA[b`hsZXjY�V?��]µr9��?r7[?`�sZX�e­{¶�VbY�Yjq;p�·�¸b¹hº¼»&·7ph½µcb_j]bWZi7`hYb]S¾?`�a?]�X�cl¿hiZW�i�fZ]�s­Àp�XbXZ]�r�rScb_IqbiA`�Yb]IÁZsZ_Avh]�sZcZVb]�rv�]�s�ub_�s9|:r?]�Yb]�X�cQg c?iA`�Yb]9g�xZ`hib�S[&rZV?W�fµr7[?`hs�XDeVbuIrA[b`hsZX-W�]IÂDe]ZÃ�V�cQg�_7`�ab]�X�c@ghW�_�cQgub_b[ZWZ\�e]?WZ\�VZu�e

]bW�\9g�v�sb_7v&]�s�c;�5eub_�s9|Lr?]�Yb]�X�cQg c?iA`�Yb]9g�xZ`hib�S[�rZV?W�fµr7[?`hs�XjYZV?��]µr;��br9[?`�sZX�eVbuS_A`(a?]�X�c���g�xZ`hib���Q|&iZWZ\&c.V�r-VbW�V�cbVbi�YSibWZ\_A`(a?]�X�c���g�xZ`hib���QxZ`h]�YbWjV�r-VbW�V�cbVbi�YDerb]�YZ]�X�cjrZV?W�f�Yb]3­.uZsZ_9|jxZ`&iZ�µXZYZVZ]bW&cSr9v&]�XZVZuZVb]b\Ä o�]�sZ]{|&ibW�\�c{ÅÆr;��@|&iZWZ\�c-iZWZ\xZ`&]�Y?WSÅI_A`�ab]�X�c��9��]A� �?r?i�Yb]�r7\�_�X7[?|h]bW&c�er7[?`�sZX-ÅÆr;��brA[b`hsZX�eV�uIrA[?`�sZX-W�]µÂDe�¹�Ã�V�c eǹ�WZ\�VZu�e_7`�ab]�X�c��Èg�xZ`&iZ�jÅ{x�`&iZ��e]ZY�rb]�er7[?`�sZX-ÅÆÂ�ex�`&iZ�SÅI_7`�a?]�X�c��Èg�x�`&iZ��e]?WZ\�VZu�e]bW�\�u?_�s9|5e

­{¶�V�YZYjq;p&·�¸Z¹&ºl»�·Aph½Æc?_j]bW�iA`hYZ]S¾7`�ab]�X�cÀ¿�ibW�i�fZ]�s­Àp�X�Xb]�rZrjc?_Iqbi7`hY?]IÁ�sb_Avh]�s�cbVb]�r

n Source code is generated in the implementation program to read the date from the application table.

n The source code between GET_TABLE_PROPERTY and END_PROPERTY is generated entirelyfrom the definition data. The form select_table_<table name> is also generated automatically for theactual database access.

n The macro EXIT_OBJECT_NOT_FOUND returns the exception "Object not found". This exceptioncorresponds to the T100 message OL826.

Page 49: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-27

SAP AG 1999

,PSOHPHQWLQJ�'DWDEDVH�)LHOG�$WWULEXWHV��2EMHFW�

fZ]�cQg(cbiA`�Yb];g�vhsZ_Av&]�s�c9�Sx�`&iZ��e\�i�c?iIrA[b`hsZXjY�V?��]µr9��?r7[?`�sZX�e

v�]�s�ub_�s9|:r?]�Yb]�X�cQg c?iA`�Yb]9g�xZ`hib�S[&rZV?W�fµr7[?`hs�XDeVbuIrA[b`hsZX-W�]IÂDe]ZÃ�V�cQg�_7`�ab]�X�c@ghW�_�cQgub_b[ZWZ\�e]?WZ\�VZu�e

]bW�\9g�v�sb_7v&]�s�c;�5eub_�s9|Lr?]�Yb]�X�cQg c?iA`�Yb]9g�xZ`hib�S[�rZV?W�fµr7[?`hs�XjYZV?��]µr;��br9[?`�sZX�eVbuS_A`(a?]�X�c���g�xZ`hib���Q|&iZWZ\&c.V�r-VbW�V�cbVbi�YSibWZ\_A`(a?]�X�c���g�xZ`hib���QxZ`h]�YbWjV�r-VbW�V�cbVbi�YDerb]�YZ]�X�cjrZV?W�f�Yb]3­.uZsZ_9|jxZ`&iZ�µXZYZVZ]bW&cSr9v&]�XZVZuZVb]b\Ä o�]�sZ]{|&ibW�\�c{ÅÆr;��@|&iZWZ\�c-iZWZ\xZ`&]�Y?WSÅI_A`�ab]�X�c��9��]A� �?r?]�i�YZ]�r7\�_�X7[b|&]ZW�c�er7[?`�sZX-ÅÆr;��brA[b`hsZX�eV�uIrA[?`�sZX-W�]µÂDe�¹�Ã�V�c eǹ�WZ\�VZu�e_7`�ab]�X�c��Èg�xZ`&iZ�jÅ{x�`&iZ��e]ZY�rb]�er7[?`�sZX-ÅÆÂ�ex�`&iZ�SÅI_7`�a?]�X�c��Èg�x�`&iZ��e]?WZ\�VZu�e]bW�\�u?_�s9|5e

¥¢�� � § � � �;� �����?� �?¤7�bÉ?�A§ � �¢&� � § � � �9� � �Z�b� �7¤?�bÉ?�;§ � �¢�� � § � � �;� ��(��� �@�Q�7� �7�9��Z�A� �9�@�;��?� ��� �A�

� § �?�;§ � �7ÊbÉ?�;§ � �©&�Z¢� ;�@¢���9� �;�@�9�;�¤A�@¥@� �¦��9������@�9�9§ � �;� � �b� � § �?�;§ � �7Ê��A�9§ � �� § �?�;§ � �7Ê��A�9§ � �

�Z�@� �� �9�7�D§ �Q� �9§ �9�7¨

�Z�?�7§ �9�©�� § � �A�9����Q� � � �@�9�� � �A� �

¢�� � § � � �;� �D�7§ �?�9�A§ � � �@�° �A� � � �7� �@± � � �A�°�9�A�7�Q� �?§ �² �9�Q� �9�A�;�9± � �A�7�9�A�A�9�?�9�@�

��� �@� � �?�7�;§ ����Q� �9§ �;�7�;�� � � � ����Q� �9§ �;�7�;�� � �;� �

� ��� �9���?� �9�7�² �;³7�;§ �;���Q� � § � � �;� �

�Z�;�9§ �A¬�¬7�;� �©&�Z¢��&´&¦�¦&�

�&¦Z¢(¡ Ë �9�Q� �b���9§

­{¶�V�YZYjq;p&·�¸Z¹&ºl»�·Aph½Æc?_j]bW�iA`hYZ]S¾7`�ab]�X�cÀ¿�ibW�i�fZ]�s­Àp�X�Xb]�rZrjc?_Iqbi7`hY?]IÁ�sb_Avh]�s�cbVb]�r

n The source code between GET_TABLE_PROPERTY and END_PROPERTY is generated entirelyfrom the definition data.

n The macro EXIT_OBJECT_NOT_FOUND returns the exception "Object not found". This exceptioncorresponds to the T100 message OL826.

n An object reference is generated automatically as an attribute value. This procedure only workscorrectly if the referenced object type has precisely one key field. Otherwise, the attribute must beimplemented itself.

Page 50: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-28

SAP AG 1999

,PSOHPHQWLQJ�9LUWXDO�$WWULEXWHV

`&]�f�V7WAgh\�i�c?ij_7`�a?]�X�cDe`�]Zf�V?WI_�u-��]A�#ye�eZe]?WZ\I_�u.��]A��yr7i�YZ]�rbf�sb_b[?v:c;��v&]µr Ä X@g(_9`�ab]�X�cDe]bW�\9g&\�i�cbiS_7`�ab]�X�cDefZ]�cQg�v�sb_7v&]�s�c;�:r?i�Yb]�r?f�sZ_?[bvÆX?o�ibW�f�VbW�fIXb_ZW�c?i�V?W�]�sDer7]�YZ]�X�cSrZV?W�f�Yb]3­.uZsZ_A|SxZ`hib�Ä o�]�sb]{x�`&]�YbWjÅj_7`�ab]�XZc��9��]7��br?i�YZ]�r?\�_�X?[?|h]bW�cDe

­.XZs?]�i�cb]S_7`�ab]�X�c�Ì£�?sb]�uZ]�sZ]bW�XZ]hÍr Ä X;g(X�sb]Zi�c?]9g�_A`(a?]�X�c_7`�a?]�X�c��?r?i�Yb]�r?f�sZ_?[bvOÎÈq;»&½�Ï?Ð#Î�x�`&iZ�h�Qx&��f�s9v�e­ Ä sbV�c?]j_A`(a?]�X�c�ÌÈ�7sZ]�ub]�sb]ZW�X?]�ÍwVbW�cb_jXZ_bW&c?i�VbW�]�sr Ä X;grb]�cQg(]�YZ]A|&]ZW�cSXb_ZW�cbiZV?W�]�sÎ�º?i�YZ]�rbÏ�sb_b[?v5Î�_7`�ab]�XZc��?r?i�Yb]�r?f�sZ_?[bv�e]bW�\9g�v�sb_7v&]�s�c;�5e

¥¢&� � § � � �;� ���Z�A� �;�;Ñ § �?�?�¢�� � § � � �;� ���Z�;� �Q�AÑ(§ �?�7�¢&� � § � � �;� ���Q� �9���7� �A�A����;� �@�;�;��b� �Q� �9�

�Z�;� �Q�AÑ(§ �?�7�Ò9ÓZ���A�;�;�; ;�Ô;�Q¢°�7�A�A� �9�¤7�Q¥9� �¦��9�D����@�9�9§ � �;� � �?� �Z�;� �Q�DÊb§ �?�?��Z�;� �Q�DÊb§ �?�?�U® � ���7� ¨@�Q� ³?� § � ¨ ÕÈÖ Ö ×�Ø Ù

����� �� �A�A�D§ ��� �A§ �9�A¨

���7�?§ �;�©�� § � �7�;����Q� � � �@�9�� � �9� �

¢&� � § � � �;� �D�7§ �?�7�;§ � � �@�°�?� � � �?� �9± � � �A�°(�A�9�?�Q� �b§ �² �9�@� �9�7�@�;± � �A�?�;�7�;�7�7�;�9�

��� ��� � �b�A�9§ ����@� �;§ �9�A�;�� � � � ����@� �;§ �9�A�;�� � �;� �

² �;³A�;§ �A����� � § � � �9� �

���@�9§ �9¬�¬A�9� �¤b´&��Ñ � �Z�9� �@�DÊ?§ �?�7�Ú ���� �;�Q�7� �A�A�

n The data declaration is generated from the definition data and is used as a runtime buffer.

n The implementation between GET_PROPERTY and END_PROPERTY must be created manually,since there is no other definition information. The object reference to be returned, in particular, mustbe created explicitly via the macro SWC_CREATE_OBJECT.

n Both the Business Object Builder runtime buffer "object-salesgroup" and the associated containerelement "SalesGroup" must be completed for data transfer.

Page 51: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-29

SAP AG 1999

`&]�f�V7WAgh\�i�c?ij_7`�a?]�X�cDe`�]Zf�V?WI_�u-��]A�#ye�eZe]?WZ\I_�u.��]A��yVZc?]7|�rjc;��v&]µr Ä X@g(_A`�ab]�X�c{_�XZX7[&s�rjÂ�e]bW�\9g&\�i�cbiS_7`�ab]�X�cDefZ]�cQg�v�sb_7v&]�s�c;�LV�cb]A|(r-X?o�iZW�fZVbW�fIXb_ZW�c?i�V?W�]�sDe­¼m&]ZX�Ybi�sb]S\�i�c?ic?i9`�Yb]�rlx�`&i7v�e\Zi�cbiIV�c?]7|:c;�Zvh]µr Ä X;g�_7`ha?]�X�c�e\�i�cbi�t�`&]�f�VbWj_�uwxZ`&i7v?g��Z]A��yxZ`h]�Y?WµY�V?��]{x�`&i9v �QxZ`h]�YbW�yv&_�r7W�sjY�V?��]{x�`&i9v �Qv&_�r7W�s�y]bW�\I_�uwxZ`hiAv?g���]7��e\Zi�cbi{xZ`&i7v?g c?iA`LY�V?��]{x�`�iAv3_�X�X7[&s�rjÂ Ä V�c7ojo�]Zib\�]�sjY�V?W�]�e­ º7]�YZ]�X�c \�i�cbir?]ZYZ]�X�cI­.u�sb_A|jx�`&iAvLVbW�c7_µc?i7`hYZ]wx�`&i7v?gcbiA`Ä o�]�sZ]{xZ`&]�Y?WjÅI_A`(a?]ZX�c��9��]A� �?r?i�Yb]�r7\�_�X7[b|&]bW&c exZ`�i7v?g���]A� �Qx�`&]�YbWjÅj_7`�ab]�XZc��9��]7��br?i�YZ]�r?\�_�X?[?|h]bW�cDe­ ÛZsb]�i�cb] _7`�ab]�X�c sZ]�ub]�sb]ZW�Xb]Yb_b_7v3i�c~xZ`hiAv?g c?i7`�ex�`&iAvbgh��]A��@v&_�r7W�s-Å.xb`hiAv?g c?i7`�Qvh_�r?W�sDer Ä X@gXZsZ]Zi�cb];g(_A`�ab]�X�c.V�c?]A|ÜÎ »�·7p(ÁDÎ�xZ`hiAvbgh��]7�#ei7vZv&]ZWZ\µV�cb]A|:c?_j_7`�a7]�X�c��?V�cb]A|�rDe]bWb\�Yb_�_Av�e­ p�rZrZVbfZW _7` a ]�X�c sZ]�ub]�sb]ZW�Xb] c?_IXZ_bW�cbi�VbW�]�sS]�Yb]A|&]bW�cr Ä X;grb]�cQg c?i7`hYb]IXZ_bW�cbi�VbWZ]�sÝÎQÞbc?]7|�r�ÎT_7`�a?]�X�c��7V�c?]A|�rDe]bW�\9g�v�sb_7v&]�s�c;�5e

¥¢&� � § � � �9� � ² � �9�D�¢&� � § � � �;� �D² � �9���¢&� � § � � �;� ����� �;�Q�7� �A�7����9� �;�Q�A��?� �@� �9�

² � �9���©h�Z¢�� 9��¢���;� �@�;�9�@�¤?��¥;� �¦��;������Q�A�;§ � �9� � �?� ² � �9����Z�A� �;�D�7�A�A�7���;�9�Z� � �9�D�

���Q� �� �A�9�D§ �@� �;§ �9�7¨

�Z�b�7§ �@�©&� § � �A�9������ � � �@�;�� � �9� �

¢&� � § � � �;� �D�?§ �b�A�9§ � � �;�° �7� � � �7� �;± � � �7�°�;�7�7�Q� �?§ �² �9�;� �9�A�;�;± � �7�7�A�9�A�A�A�A�;�

��� �Q� � �7�A�A§ ������ �A§ �A�9�9�� � � � ������ �A§ �A�9�9�� � �9� �

���� �;�Q�7� �A�A�² �9³A�9§ �9���Q� � § � � �;� �

�Z�@�A§ �;¬�¬A�A� �©h�Z¢(É ���;� �;��� � �9�

,PSOHPHQWLQJ�0XOWLSOH�/LQH�9LUWXDO�$WWULEXWHV

Ú

Ú

n The data declaration is generated from the definition data and is used as a runtime buffer.

n The implementation between GET_PROPERTY and END_PROPERTY must be created manually,since there is no other definition information. The object reference to be returned, in particular, mustbe created explicitly via the macro SWC_CREATE_OBJECT.

n Both the Business Object Builder runtime buffer "object-salesgroup" and the associated containerelement "SalesGroup" must be completed for data transfer.

n The actual implementation of the attribute also contains a query as to whether the runtime buffer iscompleted.

Page 52: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-30

SAP AG 1999

,PSOHPHQWLQJ�6\QFKURQRXV�0HWKRGV

`h]Zf�V?W9g�|&]�c9o�_Z\S\�V�r9vhYbi7�LX7o�iZW�f�V?W�fjXb_ZW�cbi�V?W�]�s�erb]�c~v&i�s?iA|h]�c?]�sjV?\RÎ p&ß?à�ÎUu�Vb]�Y?\j_7`�ab]�X�c��9��]A��br?i�Yb]�r?\�_ZX?[?|h]bW�cDeXZi�YZYIcZs?ibW&r?i�X�cbVZ_bWRÎ »�p(ÂZáDÎTibWZ\µr7��V9vLuZV�s�r�cSrZXZsZ]Z]bW�e

]ZWZ\Ag�|&]�cAo�_?\�e

â�ãQä@ã@å æ@çOèAã�éQê9ç ëQë ì@íÈã��� �9� �7Ê�b�9�7�9¬?§ �b����@�A�7� ���A�9§ �² �9�;� �9�A�;�;± � �7�

���Q�A�;§ � �9� � �?�

�°�@� ¬A�?����� �A�7� �;�°�Q� ¬9�7����� �A�?� �;�°�@� ¬A�A���Q� �@�@�7� �A�A����;� �@�;�;��b� �Q� �A�

��� �A�?� �Q�Ò9ÓZ���A�;�;�; ;�Ô;�Q¢² ���7� �A�D�A�@� �;�

¦��;���î�ï9î�ð

©�¢��;�

�°��� ¬7�7����� �A�7� �Q�°��@� ¬A�?����� �A�7� �@�°�@� ¬A�?�� ��� �9�Q�7� �9�7����A� �9�Q�9��b� �Q� �;�

��� �A�7� �;�Ò9ÓZ���9�9�;�; @�Ô9�Q¢² ���7� �;���9�;� �@�¦��A�D����;�;�9§ � �;� � �b� ��� �A�7� �;���� �A�7� �;�D� �È� �@�@�â�ãQäQãQå æQçñè7ã�éQê;ç ë@ë ì@íÈãSî�ïAî�ð

�7�A�A�@� � �?�����7�?�7� �¢Éb²È� �?�A�@� � �?�¤b§ �A�;�A�@�Q� � �b���� �A� �7Ê#���7�?�7� ����9�A�?§ �° � �9�;�;� � �9�A�;�?�9�¦��;��� ©Z¢h�; 

n The implementation between BEGIN_METHOD and END_METHOD is generated from thedefinition data.

n The macro SWC_REFRESH_OBJECT must also be called after the application functionality forsynchronous methods that can change object attributes, in order to delete the object buffer.

Page 53: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-31

SAP AG 1999

,PSOHPHQWLQJ�$V\QFKURQRXV�0HWKRGV

`&]�f�V?WAg�|h]�cAo�_b\j\�]�YbV9xh]�sA�Z`hYZ_�Xb��sb]�r?]�c-X?o�iZWZf�VbW�fIXb_ZW�c?i�V?W�]�sDer?]�YZ]�X�cSrZV?W�f�Yb]3­{uZsZ_A|jxZ`hib�Ä o�]�sZ]{xZ`&]�Y7WjÅI_A`�ab]�X�c��9��]A� �?r?i�Yb]�rA\�_�X7[?|h]bW&c�eVZuwxZ`hib�h�?YZV�u�r7�S^�dIr9v&i�XZ]�e­òVbW7xh_b��]{|h]�cAo�_?\I_bW�Y9�LVZu-\�]�YZVAx&]�sA�LY?_�Xb�IV�rjr?]�crb]�c~v&i�sbi7|&]�cb]ZsjV?\RÎ p&ß?à5Îu�Vb]�Yb\I_A`�ab]ZX�c��9��]A��br?i�Yb]�r?\�_�X7[?|h]bW&c eXZi�Y�YjcZsbiZW�r?i�XZcbVZ_bWRÎ »�p(ÂZóDÎTibW�\µr?��VAvÆu�VZs�r�cjrbXZsZ]Z]ZW�e]bWZ\�VZu�e

]bW�\9g�|h]�c7o�_b\�e

â�ã@ä�ã@å æ@çOè?ãÈé@ê@ç ëQë ì@íÈã��� �9� �7Ê�Z�A�A�9¬7§ �?����@�A�7� �b�A�A§ �² �A�Q� �A�A�;�;± � �A�

���@�;�A§ � �;� � �b�

�°��� ¬7�7�#���9� � ³7�9§ �7��� �A�Aô;���@�9�Q�°�Q� ¬A�?�����9� � ³A�9§ �7��� �?�;ôA���Q�9�Q�°�Q� ¬A�7����� �;���?� �9�7����9� �;�Q�A��?� �@� �9�

���;� � ³7�;§ �A��� �?�;ô9���@�A���Ò9Ó����;�9�;�; ;�ÔA��¢² ���A� �;���;�9� �;�

¦��9���î�ï7î�ð

©Z¢h�9�

�°�@� ¬A�7�#ªb�7� �°��� ¬7�A��ª?�?� �°��� ¬7�A���È� �@�@�7� �A�A����9� �;�;�;��b� ��� �A�

���9� � ³7�9§ �7��� �7�9ô;���;�;�Q�ÒAÓb���9�9�;�; ;�Ô9�Q¢² ���?� �A�D�A�@� �;�¦��9������@�A�;§ � �9� � �?� ���@�;�@� ���;� ��� �?�;ô���@�;�@�?�?�9� � ³9�A§ � � � �7�9ôâZã@äQã@å æ@çRè7ã�é@ê;ç ëQë ì@íÈã-î�ï7î�ð

�A�7�7��� � �b�����7�?�?� �¢(ÉZ²�� �7�A�Q� � �b�¤?§ �;�9�9�9��� � �?���� �;� �7Ê����7�b�A� ����A�9�?§ �° � �9�;�9� � �A�9�9�?�A�¦��A�D� ©�¢��@�

n The implementation between BEGIN_METHOD and END_METHOD is generated from thedefinition data. The generated source text has been extended so that the transaction is only called if adelivery block is set.

n It is not necessary to call the macro SWC_REFRESH_OBJECT in this case, because the objectcontext is always lost in an asynchronous method

n The terminating event must be triggered within the transaction called.

n The single-step task that encapsulates this method requires at least one terminating event.

Page 54: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-32

SAP AG 1999

,PSOHPHQWLQJ�([FHSWLRQV�LQ�0HWKRGVõ�ö9÷ øAùAú�ûZü�ýbø�þÿ������������õ�ö9÷ ø?ùAú�û�üZý?ø5þ ÿ���������� �� � ý�� �7ü����bù?øbýbú � ������������ ø7ú�� ���! ��û �#" �$��� $%&" ��'(� )� � ý�� �9ü����bù7øZý?ú � ������������� ø9ú*� ���+ ��û �," �$�-� %)" ��'.�

õ�öA÷ ø?ùAú/� ��� ú 0� ú � ÿ�ú � � � ú � ø � %)� ø�12��ü � ú�ø�354hø�� ý

ExceptionsExceptions

Exception 1000Exception 1000

ExceptionObject typeRelease

1000BUS100130D

Error typeTemporary errorApplication errorSystem error

MessageApplication areaMessage& blocked by another user

MA279

10007000

BUS1001BUS1001

MAM3

No. Object type Temp. App. Syst. AppArea Message Message text

279195

& blocked by another userNo selectable views

`&]�f�V?WAg�|h]�cAo�_b\jfZ]�c;|hV�rZrb]b\7x�Vb] Ä rSX7o�ibWZf�V?W�fIXZ_bW�cbi�VbW�]�s�eeZeZeXbi�Y�Yju7[�W�X�c?VZ_bWRÎ�¹bà�6ZßZ¹Zß�¹Agh¹7¿Z¿�p�Ð?p�¹�Î]bÃ?v&_�s�cbVbW�f|&i�c7W�s ÅI_A`�ab]�X�c��;��]A��@|&i�c?]�s�Vbi�YgrZXb_9vh] ÅRΣóDÎg Ä i�VZc ÅRÎ�7�Î]bÃ�Xb]7v�cbVZ_bW�rub_�sb]ZVZfbWAg(Yb_�X?� Å98�eVZuIr;� �?rA[b`hsbX-W�]IÂDe­-c?]A|�v&_�sbi�sA�µ]�sZsZ_�sÆ�¼|&i�cb]�s�Vbi�YjX?[�sbsZ]bW�cZY9�LYb_�X?��]b\.`Z�3ibW�_�cAo�]�s.[&rb]�s

]ZÃ�V�cQg(sZ]�c7[�s?W98ZÂ�ÂZÂ-_A`(a?]�X�c��A��]7��Q|&i�c?]�sZVZi�YIr;vhi�Xb]µr9v&i�XZ]jr9v&i�Xb]�e]bWZ\�VZu�eeZeZe]bW�\9g�|h]�c7o�_b\�e

n No source code is generated for triggering an exception.

n Every exception must correspond to a T100 message.

n Up to four parameters, which correspond to the four parameters of the T100 message, can betransferred with the EXIT_RETURN macro.

n The triggering of exceptions is the same for all error types.

Page 55: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-33

SAP AG 1999

,PSOHPHQWLQJ�3DUDPHWHU�7UDQVIHU

Object Edit Goto Utilities View System Help

.

Other view Program Exceptions

:�;=<*> ;@? < ABDC*E <=F*GIH*JLK*M�<*N=O P@Q*R*<PS> CSN=F�C=J�O ? HDN*TIH@U@< V�WLX�YV�WLX�Y

Z M�R@E [\SC*> C@M�<�O <*> :�] ^ <=J�OLO Q@R*< T�> <=C�O ? HLN�> <=E [ Z M�R@E [ _�C*N=[ `Sa*R*[

b�c*d ãLe£ëgf;ìQíÈãï�h�i�jLk@lLjImDn�oIp ë?ð@æ@å æIqhã£ë ã@å ér s9å�t�ãÈë uDsIo�vZè�n;î�fIn

w@x Xw@x X\SC*> CLM�<�O <*>:�] ^ <=J�OLO QLR�<yD<SE <�C=F�<P@<*a O FzLC@M�<GL<=F�JS> ? R*O ? HDN BgC*E <*F�USH*JSK@M�<*N�OLO QLR�<

BDC*E <=F*GIH*JLK*M�<*N=O P@Q*R*<V�WLX�Yw@x X

BgC*E <*F�USH*JSK@M�<*N�OLO QLR�<

\SC*> CLM�<�O <*>IR*> HDR�<S> O ? <=FZ M�R*HL> O`La*R=HL> O_�K@E O ? R@E <*{ E ? N*<Z M�R*HL> O _�C*N*U*C*O HS> Q_�C*N�USC=O HD> Q

GDC*O C�O QSR=<�> <�| <@> <*N�J@<G�? J=O ? HSN*C@> QyI<�| <L> <*N*J=<�O C*]SE <yI<�| <L> <*N*J=<�| ? <*E UBI<�CS> J*}�}=<SE R:�] ^ <=J�OLO Q@R*<

P VDX�YX�~LX yIP

`&]�f�V7WAg�|h]�cAo�_b\µXZsZ]Zi�c?]IX7o�ibWZf�V?W�fIXZ_bW�cbi�VbW�]�s�e\Zi�cbi�tnr?i�Yb]�r7\�_�X7[b|&]bW&cZc9�bv&]IYZVb��]µc;xhib���Ai?[�i�s�c ycbsZibW&r?i�X�cbVZ_bW�XZ_b\�]SY�V?��]µc�8��ZÂ��?cZXb_b\�]�er Ä X;g�f�]�cQg(]�YZ]A|&]ZW�cSXb_ZW�cbiZV?W�]�sÎ�º?i�YZ]�r9m&_�X?[?|h]bW�cZq9��v&]DÎnr?i�Yb]�r7\�_�X7[b|&]bW&cZc9�Zv&]�er7]�c~vhi�sbi7|&]�c?]�sjVb\�Î pZp(q�ÎUuZVb]�Y?\Ær?i�Yb]�r7\�_�X7[b|&]bW�cZc;��v&]�er Ä X;g�f�]�cQg(]�YZ]A|&]ZW�cSXb_ZW�cbiZV?W�]�sÎÈqZsbiZW�rbi�X�cZVb_ZW�ÛZ_Z\�]�ÎTcZsbibW&r?i�X�cbVZ_bW�Xb_b\�]�er7]�c~vhi�sbi7|&]�c?]�sjVb\�Î pZp(q�ÎUuZVb]�Y?\Ær?i�Yb]�r7\�_�X7[b|&]bW�cZc;��v&]�eX?i�Y�YIcbsbiZW�rbi�X�cZVb_ZWµcZsbiZW�r?i�X�cbVZ_bW�Xb_b\�]�eeee

n The parameter transfer source code is generated entirely from the definition data.

n Single-line input parameters are generally read via the macro SWC_GET_ELEMENT, and outputparameters written via the macro SWC_SET_ELEMENT.The macros SWC_GET_TABLE and SWC_SET_TABLE are used for multiple-line parameters.

Page 56: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-34

SAP AG 1999

,PSOHPHQWLQJ�WKH�5HWXUQ�RI�5HVXOWV

°��� ¬7�7� ¢��?�7§ �;³A��°��� ¬7�7��¢��A�?§ �A³9�°(�Q� ¬A�?�D¢(�A�7§ �9³A�

�(��� �@�Q�7� �7�A� � � �&°�¢(����ªZ¦ Ë���9� �;�@�9��?� �Q� �A�

¦��9������@�9�9§ � �9� � �?�

 @�Q¢���A� �9�@�;�9�

¢��?�7§ �9³9�¢��?�7§ �9³9�� �b§ �

Ñ(�9�A�9§ �9� ¢(�Z¢(É���Q�7�7� �7� �7�A���� �Q� � �?�A�9§ ���� ��� � �b�A�9§ ����Q� �9§ �A�A�;�� � � � ����Q� �;§ �9�A�;�� � �9� ����@�9§ �9¬�¬A�9� �

� ���� �;�Q�7� �A�A�� � ��� �9���?� �9�7�

° �7� � � �A� �;± � � �A�° �7� � � �?� �;± � � �7�

�����&� � ��°�¢�Z�ÉZ� � Ë ��¤;¢�¤bª

`&]�f�VbW9g�|h]�c7o�_b\Ii7vbvhsZ_Ax&]IX?o�ibW�f�VbW�fIXb_ZW�c?i�V?W�]�sDe\�i�c?i�t�v�sb_�X;gr�c7i�cb]jY�V?��]Ir Ä Ã�ub_�sA|&i7`�r��Qvhsb_�X�r�c?i�cb]�eXbi�YZYju7[�W�X�cZVb_ZWÝÎ�ºD�$77g�¶Z¾bÐ7¿�p�·hºQg�p(ÁZÁ?Ð�¾A»&¹�Î]bÃ?v&_�s�cbVbW�fub_�s9|�WZ[?|Z`h]�s Åj_7`�ab]�X�c��;��]7��AWb[?|�`&]�sV9|�v&_�s�cbVbW�fvhsZ_�XQg rZc?i�c?] Å{v�sb_�X@gr�c7i�cb]]bÃ�Xb]7v�cbVZ_bW&rub_�s9|7g�W�_�c@g(uZ_?[�W�\jŵÂ�8iA`h_�sZcb]b\ ŵÂZóDeXbi�r?]µr;� �?rA[b`hs�XDeÄ o�]ZWÆÂZÂ�er Ä X;gr?]�cQg(]�Y?]7|&]bW&cSXb_bW&c?i�V?W�]�sjsb]�r7[�Y�c~v�sb_�X;gr�c?i�cb]�eÄ o�]ZWÆÂ�8�e]ZÃ�V�cQg(sZ]�c7[�s7W98Zá�Â�8jr;vhi�XZ]Ir9v&i�Xb]µr@v&i�Xb]µr;vhi�XZ]�eÄ o�]ZWÆÂbóDe]ZÃ�V�cQg(XZibW�Xb]ZY�Yb]b\�e]bW�\�Xbi�r?]�e

]bW�\9g�|&]�c7o�_Z\�e

n The result parameter must be set explicitly under the name "result" using the macroSWC_SET_ELEMENT. The constant "result" is predefined and need not be defined explicitly.

Page 57: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-35

SAP AG 1999

,PSOHPHQWLQJ�$WWULEXWH�$FFHVV

¥¢�� � § � � �;� ���Z�9� �@�9Ñ(§ �?�7�¢&� � § � � �9� � �Z�9� �@�AÑ(§ �?�7�¢�� � § � � �;� ���È� �@�@�7� �A�A����9� �;�;�;��b� ��� �A�

�Z�9� �@�AÑ(§ �b�7�ÒAÓb���9�9�@�9 ;�Ô9�Q¢°�?�A�A� �;�¤7�Q¥;� �¦��9�D����@�;�A§ � �;� � �b� �Z�9� �@�DÊ?§ �?�7��Z�9� �@�DÊ?§ �?�7�U® � ���7� ¨Q�@� ³?� § � ¨ �@� � § ¨ ¯

���Q� �� �9�7�D§ �Q� �A§ �A�A¨

���7�7§ �;�©�� § � �9�A����Q� � � �;�9�� � �9� �

¢�� � § � � �;� �D�7§ �?�A�9§ � � �Q�° �7� � � �A� �@± � � �A�°�A�9�7�@� �?§ �² �9�Q� �A�9�9�;± � �A�7�9�A�9�A�?�;�;�

��� �Q� � �?�7�;§ ����@� �9§ �;�7�@�� � � � ����@� �9§ �;�7�@�� � �;� �

�(�Q� �;���?� �9�7�² �;³A�;§ �;���@� � § � � �;� �

���;�;§ �9¬�¬7�;� �¤Z´���Ñ� �Z�9� �Q�DÊb§ �b�7�

V?W�XZY?[�\�]-^�ÛAà&qAà�Â�8ZdDev&i�sbi7|&]�cb]�s�r�tUr?i�YZ]�r@g�_�sb\�]�s@gh��]A�LYZVb�Z]{xZ`hib�h�@xZ`h]�Y?W�e\�i�c?i�tUrbi�YZ]�r�g(_�s?\�]�sIc;��v&]µr Ä X@g(_A`�ab]ZX�c�yrbi�YZ]�r�g(f�sb_b[?v:c;��v&]µr Ä X@g(_A`�ab]ZX�cDe­.XZsZ]Zi�cb]j_A`hab]�X�c�Ì£�?sb]�uZ]�sZ]bW�XZ]hÍr Ä X@g(X�sb]�i�c7]9g�_A`(a?]�X�crbi�YZ]�r�g(_�s?\�]�s

’ � g&·�ß&ºbó�ÂZáZó ’ r7i�YZ]�r@g�_�sb\�]�s@gh��]A�5eVZuIr;� �?r7[?`&s�X.W�]µÂ�e� \�_{�&_7[&s-_ Ä WI]�s�sb_�s{o�ibW�\�YZVbWZf]bW�\�VZu�e

­.sb]�ib\Ii�c�cbsbVA`�[&cb]µº?i�YZ]�rbÏ�sb_b[?v3_�u-_�sb\�]�sr Ä X@g�f�]�c@g�v&sZ_Av&]�s�c9�Lrbi�YZ]�rQg(_�sb\�]�s ’ºbi�YZ]�r?Ï�sb_b[?v

’rbi�Yb]�rQghf�sb_b[?v�e

n The include <cntn01> must always be incorporated in the calling program. This include is alsoincorporated in the implementation program via the include <object>.

n Before attribute access, an object reference must be created by calling the macroSWC_CREATE_OBJECT. Error handling measures must be incorporated if the object referencecannot be created.

n Attribute access for single-line attributes uses the macro SWC_GET_PROPERTY, and for multiple-line attributes the macro SWC_GET_TABLE_PROPERTY - irrespective of whether a virtual or adatabase attribute is read.

n Attributes cannot be set via macros. Object values can only be changed via methods.

Page 58: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-36

SAP AG 1999

V?W�XZY?[�\�]-^�ÛAàhqAà�Â�8bdDe\�i�c?i�tUrbi�YZ]�rQg(_�sb\�]�sIc9�bv&]µr Ä X@g(_A`�ab]�X�c yXZ_A|�v?g(X?[�s�sb]bW?� YZVb��]{xZ`hib�h� Ä i�]�s?�j\�]�ubi?[�Y�c e�eZebyW�] Ä g�x&i�Y7[�] YZVb��]{xZ`hib�h�AW�]�c Ä s�er Ä X;g(Xb_ZW�cbi�V?W�]�s~|&]�cAo�_Z\9gXb_bW&c?i�V?W�]�sDe­.XZsZ]Zi�cb]j_A`�ab]�X�c�Ì£�?sb]ZuZ]�sZ]bW�XZ]hÍr Ä X@g(X�sb]�i�c?]9g�_7`�a?]�X�cSr?i�Yb]�r@g�_�s?\�]�s

’·Zßhºbó�Â�ábó

’rbi�Y?]�rQg(_b\�]�s@g���]A�5eVZuIr;� �?r7[?`hs�X-W�]µÂ�e� \�_{�&_?[&sS_ Ä WI]Zs�sb_�s{o�ibW�\�YZVbW�f]bW�\�VZu�e

­-r?]�c-VA|Zvh_�s�c~vhi�sbi7|&]�cb]�s�r-uZ_�sIcAo&V�r~|&]�cAo�_b\r Ä X@grb]�c@g�]�YZ]A|h]bW�c~|�]�cAo�_b\9gXb_ZW�c?i�V?W�]�s’ÛZ_7|Zv&Ûb[�s�sb]bW�X9�

’XZ_A|Zvbg(X?[�sZsZ]bW�X9��e

­.Xbi�YZYw|&]�cAo�_Z\jW�_ Är Ä X@g(XZi�Y�Y@g�|h]�c7o�_b\Ær7i�Yb]�rQg�_�s?\�]�s’Û�_bW?x&]�s�cbqZ_ZÛZ_7|ZvhÛ7[�s�sb]bW�X9�

’|h]�c7o�_b\Ag(XZ_bW�cbi�V?W�]�s�e

­.sb]�ib\I]bÃ?v&_�s�c~v&i�sZiA|�]�c?]�sr Ä X@g�f�]�c@g�]�YZ]A|h]bW�c~|�]�cAo�_b\9gXb_ZW�c?i�V?W�]�s’à&]�c;x&i�Y7[�]&Þ9W�ÛZ_9|�v&Ûb[�sZsZ]bW�X9�

’W�] Ä g�x&i�Y7[�]�e

,PSOHPHQWLQJ�0HWKRG�&DOOV

Created

40A40A

õ�ö9÷ øAùAú�ûZü�ýbø�þÿ�����������õ�ö9÷ ø?ùAú�û�üZý?ø5þ ÿ�-��������� �� � ý�� �7ü���� � ��35øAú ø � ��������� øAú*� ����� õ�� % �$�hû�ûZõ � õ � � � ÿ)��)��hû )� � ý�� �9ü���� � ��3#ø7ú ø � ��������� ø7ú�� ����� õ,� % ���(û�ûZõ � õ � � � ÿ�)��$�(ûõ�öA÷ ø?ùAú/� ��� ú 0� ú � ÿ�ú � � � ú � ø � %)� ø�12��ü � ú�ø�354hø�� ý

OverviewOverview

Object type

õ�ú*�bø ����� ø�1�� ������� ��3����Zù7øbýbú � ����

CompCurrencyNetvalueInCompCurr

VBAKVBAK

Parameter

Parameter CompCurrent

ParameterObject typeRelease

CompCurrencyVBAK40A

TextsName

Description

Comparison currency

Comparison currency

Parameter properties

ImportExportMultiple-line

Mandatory

VBAK

Data type reference

Dictionary

Dictionary

Reference tableReference fieldSearch help

WAERK

CompCurrency

n The include <cntn01> must always be incorporated in the calling program. This include is alsoincorporated in the implementation program via the include <object>.

n Before attribute access, an object reference must be created by calling the macroSWC_CREATE_OBJECT. Error handling measures must be incorporated if the object referencecannot be created.

n The import parameters of the method must also be completed before the method call.

n The actual method call is implemented with the macro SWC_CALL_METHOD.

n The export parameters can be read after the call.

Page 59: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-37

SAP AG 1999

0DFURV���6XPPDU\

l 0DFURV�IRU�REMHFW�SURFHVVLQJ�LQ�LQFOXGH��FQWQ��!* Container macros, for example setting or reading container

elements* Object macros, for example creating objects or reading

attribute values

l 2EMHFWV�FDQ�DOVR�EH�PDQLSXODWHG�RXWVLGH�WKHZRUNIORZ�YLD�PDFURV

n The macro number must always be included if you are working in a program with objects. Themacro is included automatically in the Business Object Builders implementation programs via<object>.

n Only macros from <cntn01> may be used to manipulate objects and containers.

Page 60: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-38

SAP AG 1999

0DFURV�IRU�2EMHFW�'HILQLWLRQ�DQG�&UHDWLRQ

l 2EMHFW�UHIHUHQFH* Declaration

DATA: <obj_ref> TYPE SWC_OBJECT* Creation

SWC_CREATE_OBJECT <obj_ref> <obj_type> <obj_key>

n When SWC_CREATE_OBJECT is called, the method "ExistenceCheck" of the associated objecttype is always called implicitly, in order to prevent references to non-existent objects.

Page 61: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-39

SAP AG 1999

0DFURV�IRU�$WWULEXWHV�DQG�0HWKRGV

l $WWULEXWH�DFFHVV* SWC_GET_[TABLE_]PROPERTY <obj_ref> <attribute> <value>

l 0HWKRG�FDOO* SWC_CALL_METHOD <obj_ref> <method> <container>

n An object reference must be created before an object macro is called (for example, for attributeaccess or method call).

n These macros are not usually used in object implementation, but are required in the program that theobject uses.

n If the <method> is SPACE for SWC_CALL_METHOD, the default method is executed.

Page 62: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-40

SAP AG 1999

0DFURV�IRU�7ULJJHULQJ�([FHSWLRQV

l 7ULJJHULQJ�H[FHSWLRQV* EXIT_RETURN <exception_no> <var1> ... <var4>* EXIT_OBJECT_NOT_FOUND* EXIT_CANCELLED

n EXIT_RETURN - trigger general exceptions (similar to T100 messages).

n EXIT_OBJECT_NOT_FOUND - specified object instance not found.

n EXIT_CANCELLED - action cancelled by user (for example, in methods after BACK).

n It is not necessary to define the exceptions EXIT_OBJECT_NOT_FOUND andEXIT_CANCELLED explicitly in a method.

n Customer-defined exceptions must be in the customer name range.

Page 63: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-41

SAP AG 1999

0DFURV�IRU�0DQDJLQJ�WKH�2EMHFW�5HIHUHQFH

l 7\SH�DQG�NH\� SWC_GET_OBJECT_TYPE <obj_ref> <obj_type>� SWC_GET_OBJECT_KEY <obj_ref> <obj_key>

l 5HIUHVKLQJ�REMHFW�W\SHV� SWC_REFRESH_OBJECT <obj_ref>

n When a work item is executed, the objects in the associated container are automatically refreshed.

Page 64: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-42

SAP AG 1999

&RQWDLQHU�0DFURV

l 'HILQLWLRQ�DQG�LQLWLDOL]DWLRQ� SWC_CONTAINER <cont>� SWC_CREATE_CONTAINER <cont>

l 5HDGLQJ�DQG�VHWWLQJ�HOHPHQWV� SWC_GET/SET_ELEMENT <cont> <element> <value>� SWC_GET/SET_TABLE <cont> <element> <int_tab>

n The container macros are also located in the include <cntn01>.

n All types of container are manipulated via these macros (for example, task, role, event).

Page 65: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-43

SAP AG 1999

��&�������������������������� �

��& ������¡������������������� �

��& �����¢¡�,�&�����������£,� ¤¥¦ §�¨

��&����������0��������������� �

��&������¢�,�&�����������£,� ¤$¥-¦ §�¨

�-�& �����©¡)���������������ª�«$¦ «�§�¤�«

�-�������¢���0�����������£�� ¤¥¦ §�¨

��& �����¬���0�����������ª0«$¦ «�§�¤�«

<®­°¯< GD±#F,²#±#6�²

H F�P�0�6 N GI±5F�J�0

³ 0�´ 0�µ#±�G N 8)F

3URFHVV�GHILQLWLRQ %2%

¶0·0¸ ¹º+¸ »&¼)½ ¾�¿

À+Á�Â!Ã�Ä$Ä)Ã

À+Á�Â!Ã�Ä$Ä)Ã

¶0·0¸ ¹º+¸ »&¼)½ ¾�¿

Å#À�Á#Â�Ã�ÄÄ�Ã

Æ�ǽ Ç�¾$»Ç

¶0·0¸ ¹º+¸ »&¼)½ ¾�¿

À+Á�Â!Ã�Ä$Ä)Ã

¶0·0¸ ¹º+¸ »&¼)½ ¾�¿

Å#À�Á#Â�Ã�ÄÄ�Ã

Æ�ǽ Ç�¾$»Ç

À�Á�Â�Ã�Ä$ÄÃ

'HOHJDWLRQ

¶0·0¸ ¹º+¸ »&¼)½ ¾�¿

n Problem:How can customers use their own object extensions with the tasks, events, etc. supplied by SAP

� Without having to change the application program where events are triggered,

� Without having to redefine existing tasks.

n Solution:Define subtype and delegation.Delegation "covers" the original supertype.Continue to use the supertype.

n Gray/Top: Behavior without inheritanceRed/Middle: Behavior with inheritanceBlue/Bottom:Behavior with delegation - the object type BUS1001 is regarded as having theproperties of Z_BUS1001 (that is, additional events, attributes and methods).

n In the Business Object Builder itself, you can only see from the basic data for a supertype whether adelegation has been defined.

Page 66: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-44

SAP AG 1999

2EMHFW�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ��8QLW�6XPPDU\

l ([SODLQ�WKH�EDVLF�WHFKQLFDO�FRQFHSWV�RIWKH�%XVLQHVV�2EMHFW�%XLOGHU

l ([SODLQ�WKH�GHSHQGHQFLHV�EHWZHHQ�REMHFW�GHILQLWLRQDQG�LPSOHPHQWDWLRQ

l ([SODLQ�WKH�SRLQWV�WR�QRWH�ZKHQ�FUHDWLQJ�RUH[WHQGLQJ�DQ�REMHFW�W\SH

Page 67: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-45

([HUFLVHV8QLW��2EMHFW�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ6HFWLRQ��0RWLYDWLRQ�DQG�3URSHUWLHV�RI�2EMHFW�7\SHV

After completion of these exercises, you will be able to:

• Navigate in the Business Object Builder

• Change the default settings and release status of an object type

As a member of the workflow development group in your enterprise, youmust:

• Understand the basic technical concepts of the BOB

• Master the search and navigation options in the BOB

• Be familiar with the various statuses of an object type

Note: After every implementation step in the following tasks, notethe changes of color, status and icons. For example, the variousstatuses are represented with different icons.

1-1 Familiarize yourself with the Business Object Repository.

1-1-1 Find and check your object type =��0$5$. The ‘##’ characters refer toyour group number.

1-1-2 Set the default attribute to MaterialDescription.

Note: You can find the default settings of an object type via ‘Goto >Basic data’ on the ‘Change object type’ screen.

1-1-3 Change the status of your object type to ‘released’. You can ignore themessage ” The method ExistenceCheck is not redefined” .

Note: If you have not completed this step, you cannot use yourobject type in a task or role.

Page 68: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-46

8QLW��2EMHFW�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ 6HFWLRQ��2EMHFW�GHILQLWLRQ

After completion of these exercises, you will be able to:

• Define a new object type

When implementing a workflow you will notice that not all customer-specific business processes can be modeled using a business objectsupplied by SAP. In these cases, you must create a new object type.

2-1 Create a new business object type

2-1-1 Create a new business object type =3/$17��� where ‘##’ stands for yourgroup number. Complete the basic data of this object type as below.

Note: The names of the object type and the program must be in thecustomer namespace.

Note: The object type, object name and program name must notcontain any blank characters.

2-1-2 You must define a key field for your new object type. In a second session,look at the key of table T001W, the lines of which each represent a plant.Define the key of your business object based on the key of this underlyingapplication table.

2-1-3 Create a new attribute 1DPH based on the field NAME1 of table T001W.Generate the implementation for your definition with the Business ObjectBuilder.

Supertype 3OHDVH�GR�QRW�FRPSOHWH�WKLV�ILHOG� Object type ZPLANT##

Object name Plant_##

Name Plant ##

Short description Plant for group ##

Program ZPLANT##

Application S

Page 69: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-47

2-1-4 Redefine the method 'LVSOD\. Do not define the method with reference to atransaction or a function module. First, look at the implementation proposalgenerated by the Business Object Builder. Then complete theimplementation of this method by copying the missing lines from themethod Display of the object type BUS0008 supplied by SAP.

Note: You must declare the view V_T001W in the implementationprogram of your object type.

Page 70: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-48

8QLW��2EMHFW�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ 6HFWLRQ��2EMHFW�LPSOHPHQWDWLRQ

After completion of these exercises, you will be able to:

• Create a new object type as subtype of an existing object type

When implementing a workflow you will notice that the object typessupplied by SAP do not meet your requirements fully. In these cases, youmust extend an existing object type by creating a customer-specificsubtype for it.

3-1 Create a subtype of your material object type.

3-1-1 Create a subtype ZMARA##A for your object type Z##MARA. Completethe basic data of your new object type as below.

Note: The names of the object type and the program must be in thecustomer namespace.

Note: The object type, object name and program name must notcontain any blank characters.

Supertype Z##MARA

Object type ZMARA##A

Object name MARA_##_Version_A

Name MARA ## Version A

Short description Material group ## Version A

Program ZMARA##A

Application S

Page 71: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-49

3-2 Extend your new object type so that it meets additional requirements.

Note: After each definition step, also check the source code in theimplementation program of the object type.

3-2-1 For the workflow development, you require events as triggering orterminating events for your tasks.Create two new events %DVLF0DWHULDO&KDQJHG and 2OG0DWHULDO&KDQJHGfor your object type.

3-2-2 Change the status of the two events to ‘implemented’ .

3-2-3 Implement the two events using event creation from change documents. Thechange document required is MATERIAL. Restrict the triggering of theevent for %DVLF0DWHULDO&KDQJHG to the field MARA-WRKST and for2OG0DWHULDO&KDQJHG to MARA-BISMT.

3-2-4 Define another event 'HDGOLQH7HVW for your object type with a parameter/DWHVW(QG'DWH that refers to the field SYST-DATUM. This parameter willbe used later to transfer an “ end” deadline for a step within a workflow.

3-2-5 Create a new attribute &KDQJHG%\ based on the field MARA-AENAM.This attribute specifies the user who last changed the underlying material.You will use this attribute later to filter out ‘your’ material.

3-2-6 Create a new method &KDQJH�on the basis of transaction MM02.

Note: The transaction MM02 writes your changes to the database viaan update task.

3-2-7 Create a new method &KDQJH'RF'LVSOD\.This method is to display all change documents for a particular material andhence make the change history visible. Use the transaction MM04 for theimplementation.

3-2-8 Create a new method 'LVSOD\9LHZ.The purpose of this method is to display a material from a particular view.The desired view is to be transferred via the input parameter 0DWHULDO9LHZ.Use the implementation to ensure that value "K" (corresponds to view"Basic data 1") is accepted as the default for this parameter.The actual view is displayed using transaction MM03.

Note: Transaction MM03 recognizes a SET/GET parameter MXXvia which the view used to start the transaction can be controlled.Supply this SET/GET parameter with your input parameter value.

Note: The 0DWHULDO9LHZ�input parameter must be defined withreference to the database field T132T-STATM.

Page 72: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-50

3-2-9 Create a (virtual object-value) attribute 3ODQW for one of the plantsconnected with the material.Use the field MARC-WERKS for the implementation of the attribute todetermine the plants in which the particular material is defined. Return thefirst plant found in this manner in the form of an object reference from yourobject type ZPLANT## as a value of the attribute.

3-3 Optional extensions

3-3-1 Create a (virtual database field) attribute ,QGXVWU\1DPH for the long textfor the value of the existing attribute Industry. This industry name can beread from the field MBBEZ of table T137T on a language-specific basis.

3-3-2 Create a (virtual, multiline and object-value) attribute 40HVVDJHV that listsall quality notifications in which the current material is used.

Note: Use the field MATNR in table QMEL to find the qualitynotifications. The object type BUS2078 supplied by SAPimplements the quality notifications.

3-3-3 Create a new method &UHDWH0DWHULDO)URP5HIHUHQFH.Using a material number transferred via the input parameter5HIHUHQFH0DWHULDO1XPEHU,�this instance-independent asynchronousmethod is intended to generate a new material for which the material typeand the industry from the reference material are transferred. If no materialexists for the transferred reference material number, an exception is to betriggered with reference to the T100 message M3 305 ("The material & isnot available").To create the material, use transaction MM01.

Note: Transaction MM01 recognizes the following three SET/GETparameters:1) RMA – to set the reference material number2) MTA – to set the material type3) MTP – to set the industrySupply these SET/GET parameters with the values from your inputparameters.

Note: The 5HIHUHQFH0DWHULDO1XPEHU�input parameter must bedefined with reference to the database field MARA-MATNR.

Page 73: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-51

6ROXWLRQV8QLW��2EMHFW�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ7RSLF��0RWLYDWLRQ�DQG�3URSHUWLHV�RI�2EMHFW�7\SHV

1-1 Familiarize yourself with the Business Object Builder.

Solution:Object type Z00MARA

Path (via SAP Easy Access):Tools > SAP Business Workflow > Development > Definition tools > BusinessObject Builder

Note: Test materials (for all following tasks as well):200-100 as material of type HALB200-101 as material of type FERT200-210 as material of type ROH

�����������,PSOHPHQWDWLRQ�RI�REMHFW�W\SH�=��0$5$�������������� INCLUDE <OBJECT>.BEGIN_DATA OBJECT. " Do not change.. DATA is generated* only private members may be inserted into structure privateDATA:" begin of private," to declare private attributes remove comments and" insert private attributes here ..." end of private, BEGIN OF KEY, MATERIAL LIKE MARA-MATNR, END OF KEY, PLANT TYPE SWC_OBJECT.END_DATA OBJECT. " Do not change.. DATA is generated

BEGIN_METHOD CHANGEDOCDISPLAY CHANGING CONTAINER. SET PARAMETER ID ’MAT’ FIELD OBJECT-KEY-MATERIAL. CALL TRANSACTION ’MM04’ AND SKIP FIRST SCREEN.END_METHOD.

Page 74: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-52

GET_PROPERTY PLANT CHANGING CONTAINER. DATA: FIRST_PLANT LIKE MARC-WERKS OCCURS 0 WITH HEADER LINE. IF OBJECT-PLANT IS INITIAL. " check buffer contents. " find one arbitrary plant related to this material SELECT WERKS FROM MARC CLIENT SPECIFIED INTO TABLE FIRST_PLANT UP TO 1 ROWS WHERE MANDT = SY-MANDT AND MATNR = OBJECT-KEY-MATERIAL. " create an object reference using the found plant key " if we found no such plant, we’ll implicitly create an empty ref READ TABLE FIRST_PLANT INDEX 1. SWC_CREATE_OBJECT OBJECT-PLANT ’ZPLANT00’ FIRST_PLANT. ENDIF. SWC_SET_ELEMENT CONTAINER ’Plant’ OBJECT-PLANT.END_PROPERTY.

BEGIN_METHOD DISPLAYVIEW CHANGING CONTAINER.DATA:MATERIALVIEW LIKE T132T-STATM. SWC_GET_ELEMENT CONTAINER ’MaterialView’ MATERIALVIEW. IF MATERIALVIEW IS INITIAL. MATERIALVIEW = ’K’. " display basic view ENDIF. SET PARAMETER ID ’MAT’ FIELD OBJECT-KEY-MATERIAL. SET PARAMETER ID ’MXX’ FIELD MATERIALVIEW. CALL TRANSACTION ’MM03’ AND SKIP FIRST SCREEN.END_METHOD.

BEGIN_METHOD CHANGE CHANGING CONTAINER. SET PARAMETER ID ’MAT’ FIELD OBJECT-KEY-MATERIAL. CALL TRANSACTION ’MM02’ AND SKIP FIRST SCREEN.END_METHOD.

Page 75: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-53

8QLW��2EMHFW�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ 6HFWLRQ��2EMHFW�GHILQLWLRQ

After completion of these exercises, you will be able to:

• Define a new object type

When implementing a workflow you will notice that not all customer-specific business processes can be modeled using a business objectsupplied by SAP. In these cases, you must create a new object type.

2-1 Create a new business object type

Solution:Object type ZPLANT00

Path (via SAP Easy Access):Tools > SAP Business Workflow > Development > Definition tools > BusinessObject Builder

�����������,PSOHPHQWDWLRQ�RI�REMHFW�W\SH�=3/$17��������������� INCLUDE <OBJECT>.BEGIN_DATA OBJECT. " Do not change.. DATA is generated* only private members may be inserted into structure privateDATA:" begin of private," to declare private attributes remove comments and" insert private attributes here ..." end of private, BEGIN OF KEY, PLANT LIKE T001W-WERKS, END OF KEY, _T001W LIKE T001W.END_DATA OBJECT. " Do not change.. DATA is generated

TABLES: T001W, V_T001W.

Page 76: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-54

GET_TABLE_PROPERTY T001W.DATA SUBRC LIKE SY-SUBRC.* Fill TABLES T001W to enable Object Manager Access to Table Properties PERFORM SELECT_TABLE_T001W USING SUBRC. IF SUBRC NE 0. EXIT_OBJECT_NOT_FOUND. ENDIF.END_PROPERTY.

* Use Form also for other Properties to fill TABLES T001WFORM SELECT_TABLE_T001W USING SUBRC LIKE SY-SUBRC. IF OBJECT-_T001W-MANDT IS INITIAL AND OBJECT-_T001W-WERKS IS INITIAL. " read data from database table, if BOR buffer is empty SELECT SINGLE * FROM T001W CLIENT SPECIFIED WHERE MANDT = SY-MANDT AND WERKS = OBJECT-KEY-PLANT. SUBRC = SY-SUBRC. IF SUBRC NE 0. EXIT. ENDIF. OBJECT-_T001W = T001W. ELSE. " read data from BOR buffer SUBRC = 0. T001W = OBJECT-_T001W. ENDIF.ENDFORM.

BEGIN_METHOD DISPLAY CHANGING CONTAINER. " coding copied from BUS0008 CLEAR V_T001W. V_T001W-MANDT = SY-MANDT. V_T001W-WERKS = OBJECT-KEY-PLANT. CALL FUNCTION ’VIEW_MAINTENANCE_SINGLE_ENTRY’ EXPORTING ACTION = ’SHOW’ VIEW_NAME = ’V_T001W’ CHANGING ENTRY = V_T001W.END_METHOD.

Page 77: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-55

8QLW��2EMHFW�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ 6HFWLRQ��2EMHFW�LPSOHPHQWDWLRQ

After completion of these exercises, you will be able to:

• Create a new object type as subtype of an existing object type

When implementing a workflow you will often notice that the objecttypes supplied by SAP do not meet your requirements fully. In thesecases, you must extend an existing object type by creating a customer-specific subtype for it.

3-1 Create a subtype of your material object type.

3-2 Extend your new object type so that it meets additional requirements.

Solution:Object type Z00MARA

Path (via SAP Easy Access):

� To create/change the object typeTools > SAP Business Workflow > Development > Definition tools > BusinessObject Builder

� For the linkage between event execution and a change documentTools > SAP Business Workflow > Development > Definition tools > Events >Event creation > Change documents > Linkage

3-3 Optional extensions

Solution:Object type ZRGMARA

Path (via SAP Easy Access):Tools > SAP Business Workflow > Development > Definition tools > BusinessObject Builder

Page 78: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-56

�����������,PSOHPHQWDWLRQ�RI�REMHFW�W\SH�=5*0$5$�������������� INCLUDE <OBJECT>.BEGIN_DATA OBJECT. " Do not change.. DATA is generated* only private members may be inserted into structure privateDATA:" begin of private," to declare private attributes remove comments and" insert private attributes here ..." end of private, BEGIN OF KEY, MATERIAL LIKE MARA-MATNR, END OF KEY, QMESSAGES TYPE SWC_OBJECT OCCURS 0, INDUSTRYNAME LIKE T137T-MBBEZ.END_DATA OBJECT. " Do not change.. DATA is generated

TABLES: T137T. TABLES: QMEL. TABLES: MARA. TABLES: T006.

GET_PROPERTY INDUSTRYNAME CHANGING CONTAINER. DATA: GETINDUSTRYNAME LIKE T137T-MBBEZ. DATA: INDUSTRY_KEY LIKE MARA-MBRSH. IF OBJECT-INDUSTRYNAME EQ SPACE. " check buffer contents SWC_GET_PROPERTY SELF ’Industry’ INDUSTRY_KEY. SELECT SINGLE * FROM T137T WHERE SPRAS = SY-LANGU AND MBRSH = INDUSTRY_KEY. IF SY-SUBRC EQ 0. OBJECT-INDUSTRYNAME = T137T-MBBEZ.

ELSE. OBJECT-INDUSTRYNAME = SPACE. ENDIF. ENDIF. SWC_SET_ELEMENT CONTAINER ’IndustryName’ OBJECT-INDUSTRYNAME.END_PROPERTY.

Page 79: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-57

BEGIN_METHOD GETINDUSTRYNAME CHANGING CONTAINER. DATA: GETINDUSTRYNAME LIKE T137T-MBBEZ. DATA: INDUSTRY_KEY LIKE MARA-MBRSH. SWC_GET_PROPERTY SELF ’Industry’ INDUSTRY_KEY. SELECT SINGLE * FROM T137T WHERE SPRAS = SY-LANGU AND MBRSH = INDUSTRY_KEY. IF SY-SUBRC EQ 0. GETINDUSTRYNAME = T137T-MBBEZ. ELSE. GETINDUSTRYNAME = SPACE. ENDIF. SWC_SET_ELEMENT CONTAINER RESULT GETINDUSTRYNAME.END_METHOD.

GET_PROPERTY QMESSAGES CHANGING CONTAINER. DATA: LOCAL_QMEL LIKE QMEL OCCURS 0 WITH HEADER LINE. DATA: THIS_QMEL TYPE SWC_OBJECT. DATA: LINENO LIKE SY-TFILL. DESCRIBE TABLE OBJECT-QMESSAGES LINES LINENO. " check buffer contents IF LINENO = 0. " read from database SELECT * FROM QMEL INTO TABLE LOCAL_QMEL WHERE MATNR = OBJECT-KEY-MATERIAL. LOOP AT LOCAL_QMEL. SWC_CREATE_OBJECT THIS_QMEL ’BUS2078’ LOCAL_QMEL-QMNUM. IF SY-SUBRC EQ 0. APPEND THIS_QMEL TO OBJECT-QMESSAGES. ENDIF. ENDLOOP. ENDIF. SWC_SET_TABLE CONTAINER ’QMessages’ OBJECT-QMESSAGES.END_PROPERTY.

BEGIN_METHOD CREATEMATERIALFROMREFERENCE CHANGING CONTAINER.DATA: REFERENCEMATERIALNO LIKE MARA-MATNR, INDUSTRY LIKE MARA-MBRSH, MAT_TYPE LIKE MARA-MTART.DATA: REF_MAT TYPE SWC_OBJECT.SWC_GET_ELEMENT CONTAINER ’ReferenceMaterialNo’ REFERENCEMATERIALNO. SWC_CREATE_OBJECT REF_MAT ’Z00MARA’ REFERENCEMATERIALNO. IF SY-SUBRC NE 0. EXIT_RETURN 2000 REFERENCEMATERIALNO SPACE SPACE SPACE. ENDIF. SWC_GET_PROPERTY REF_MAT ’Industry’ INDUSTRY. SWC_GET_PROPERTY REF_MAT ’MaterialType’ MAT_TYPE. SET PARAMETER ID ’RMA’ FIELD REFERENCEMATERIALNO. SET PARAMETER ID ’MTA’ FIELD MAT_TYPE. SET PARAMETER ID ’MTP’ FIELD INDUSTRY. CALL TRANSACTION ’MM01’.END_METHOD.

Page 80: BC610 - Workflow Development (Englisch)

© SAP AG BC610 3-58

BEGIN_METHOD COPYMATERIAL CHANGING CONTAINER.DATA: INDUSTRY LIKE MARA-MBRSH, MAT_TYPE LIKE MARA-MTART. SWC_GET_PROPERTY SELF ’Industry’ INDUSTRY. SWC_GET_PROPERTY SELF ’MaterialType’ MAT_TYPE. SET PARAMETER ID ’RMA’ FIELD OBJECT-KEY-MATERIAL. SET PARAMETER ID ’MTA’ FIELD MAT_TYPE. SET PARAMETER ID ’MTP’ FIELD INDUSTRY. CALL TRANSACTION ’MM01’.END_METHOD.

Page 81: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-1

SAP AG 1999

7DVNV

&RQWHQWVl 6LQJOH�VWHS�WDVNVl 0XOWLVWHS�WDVNV

Page 82: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-2

SAP AG 1999

7DVNV��8QLW�2EMHFWLYHV

$W�WKH�FRQFOXVLRQ�RI�WKLV�XQLW��\RX�ZLOO�EH�DEOH�WR�

l ([SODLQ�WKH�GLIIHUHQFH�EHWZHHQ�D�VLQJOH�VWHS�WDVN�DQGD�PXOWLVWHS�WDVN

l 'HILQH�DQG�VWDUW�VLQJOH�VWHS�DQG�PXOWLVWHS�WDVNVl 5HFRJQL]H�DQG�GHILQH�WKH�ELQGLQJV�ZLWKLQ�D�PXOWLVWHSWDVN

Page 83: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-3

SAP AG 1999

7DVNV��2YHUYLHZ�'LDJUDP

2UJDQL]DWLRQ

3URFHVVHV

%XVLQHVVREMHFWV

0HWKRGV

:)�GHILQLWLRQ 6WHS

(YHQWV$WWULEXWHV

5ROH 7DVN

3HUVRQ 3RVLWLRQ�MRE 2UJ��XQLW

2EMHFW

Page 84: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-4

SAP AG 1999

2UJDQL]DWLRQPRGHO

(PSOR\HH3RVLWLRQ

6LQJOH�VWHS�WDVN

-RE

8VHU

���������

���� ��������������������

������� ���!�!��� "��$#%�&�!�'�(� "�)���� "����*���"+�

����)+$,.-��'��/0�21 �

�435��/6)�7�1 �5�&��1 �

%2%

2EMHFW�W\SH�

0HWKRG(YHQW

2UJ��XQLW$WWULEXWHV

6LQJOH�6WHS�7DVNV

n The default role is evaluated if the task is used either outside a workflow or in a step definitionwithout agent assignment.

n The following texts can be defined:

� Work item text (workflow inbox in Business Workplace)

� Task description (work item preview in Business Workplace)

� Completion text

� Latest end text

� Latest start text

� Requested end text

Page 85: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-5

SAP AG 1999

6\QFKURQRXV�$V\QFKURQRXV�7DVNV

l 6LQJOH�VWHS�WDVN�UHIHUULQJ�WR�V\QFKURQRXV�PHWKRG8 Single-step task is terminated when method reports back to

caller8 Binding between task container and method container in

both directions

l 6LQJOH�VWHS�WDVN�UHIHUULQJ�WR�DV\QFKURQRXV�PHWKRG8 Method started by workflow system8 Report back by terminating event8 Single-step task is terminated when terminating event

occurs

n Communication between single-step task and object method:

� Synchronous:The method is called, takes over the process control and reports back to the caller after processing.

� Asynchronous:The method is called, runs without any connection to the caller and does not report back to thecaller.

n Note the following about synchronous/asynchronous calling and synchronous/asynchronousreporting back in the step definition of a workflow:

� The task method is always called synchronously (meaning in the same session as the callingprogram).

� Before and after methods are always called synchronously.

� Secondary methods are always called asynchronously (meaning in a new external session).

� Reports back to the workflow are only made from the task method. Secondary methods are onlyfor display.

n An explicit confirmation can be modeled in the step definition for both synchronous andasynchronous tasks.

n Synchronous tasks can also have terminating events. The task is then terminated either when it hasbeen successfully executed or when the terminating event has been received. In this case, theterminating event cannot be triggered within the associated object method.

Page 86: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-6

SAP AG 1999

0HWKRG

:,0,PSRUW

([SRUW5HVXOW([FHSWLRQV

7LPH

6\QFKURQRXV�7DVNV

n The task is started via the work item manager (WIM).

n The method is started within the task. The WIM caters for the input parameters of the method.

n The WIM waits until execution of the method is terminated.

n Once execution of the method is terminated, the WIM receives the export parameters or exceptionsof the method.

Page 87: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-7

SAP AG 1999

0HWKRG

:,0,PSRUW

'LDORJ 8SGDWH

(0(QWHU�OLQNDJH�IRUWHUPLQDWLQJ�HYHQW

'HOHWH�OLQNDJH�IRUWHUPLQDWLQJ�HYHQW

7LPH

7HUPLQDWLRQRI�WKHHYHQW

$V\QFKURQRXV�7DVNV

n The task is started via the work item manager (WIM). When the associated work item is created, theWIM writes the linkages for the terminating events.

n The method is started within the task. The WIM caters for the input parameters of the method.

n The WIM waits for the end of the synchronous part of the method execution (this part takes placewithin a dialog process) and can then execute actions that are independent of the terminating event.

n Once the asynchronous part of the method execution is terminated (usually within an updatingprocess), the WIM receives a terminating event of the task, deletes all linkages and then continues.

Page 88: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-8

SAP AG 1999

• Reference to ZRUNIORZ�GHILQLWLRQ

• Definition of�WULJJHULQJ���HYHQWV• ,QWHUIDFH definition

(import and exportparameters as

elements of the workflow container)• ,QLWLDO�YDOXH�DVVLJQPHQW

•�$JHQW�DVVLJQPHQW���for starting from the workflow development

environment

:RUNIORZ�WHPSODWH :RUNIORZ�GHILQLWLRQ 6WHS

:RUNIORZ�'HILQLWLRQ�6WHSV

•Activity (task reference)•Condition•Multiple condition•Event creator•Wait for event•Process control•Container operation•User decision•Loop (until)•Loop (while)•Fork•Document from template•Send mail•Web activity

n The steps can be arranged in sequence or in parallel.

n Each step is a determining component of its own block. Operations carried out on individual stepsalways affect the entire block in which the step is located.

Page 89: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-9

SAP AG 1999

Start via event

Condition

Wait step

:RUNIORZ&RQWDLQHU

��

��

��

��

��

��

8VLQJ�WKH�:RUNIORZ�&RQWDLQHU

Container operation

Activity

Deadline monitoring

n The workflow container is basically used to determine the import and export parameters of the entireworkflow and to exchange data between the individual steps.

n (1) Data from the triggering event is transferred to the workflow container as input parameters.

n (2) In a container operation as well, data is both read from (right-hand side of the allocation) andwritten to (left-hand side of the allocation) the workflow container.

n (3) Data is read from the workflow container in a branch control condition.

n (4) In a wait step, data is both read from (for example, to set up the instance linkage for the event tobe received) and written to (for example, data received with the event) the workflow container.

n (5) In an activity as well, data is both read from (for example, the input parameters of the task to beexecuted) and written to (for example, the output parameters of this task) the workflow container.In addition, data is read from the workflow container to resolve the role used in the step for agentdetermination.

n (6) Data is read from the workflow container for deadline monitoring (for example, the latest end).

Page 90: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-10

SAP AG 1999

:RUNIORZ&RQWDLQHU

:RUN�,WHP&RQWDLQHU

0HWKRGV&RQWDLQHU

HYHQW&RQWDLQHU

5ROHV&RQWDLQHU

�9��� �����!��� "����*��!"+�

:9; "���<��)�$,

:5; "��!<= ���0�����

> ; "���<��)�$,

> ; "��!<= ���0����� �$���&�(�2"�)��0�?"����*��!"+�

@ ��1 �

@ ��1 �

����

��

�� ��

�� ����

�� ����

����

����

����

&RQWDLQHUV�DQG�%LQGLQJ

n (1) (11) Event creator fills event container using container macros; no binding.

n (2) Binding between triggering event and workflow containers. This binding is essential.

n (3) (8) Binding between workflow container and role container for setting the role input parameters.This binding is essential. (This only applies if the role was entered in the step definition. In the caseof a default role in the task definition, the parameters are supplied from the work item container.)

n (4) (7) (9) (13) Binding between workflow container and task container (work item container) forsetting the input and reading the output parameters of the task. For this binding, it is irrelevantwhether the underlying task is synchronous or asynchronous. The workflow builder generates aproposal for this binding in the step definition.

n (5) (6) (10) Binding between task and method containers. For synchronous tasks, there is a bindingfor both the import and export parameters (5) and (6); for asynchronous tasks, only for importparameters (10). If this binding is not defined in the respective task, the task container is copied tothe method container at runtime.

n (12) Binding between event and task containers. This binding is necessary if the event contains datathat was not previously contained in the task container (for example, with events from createmethods).

Page 91: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-11

SAP AG 1999

$OWHUQDWLYH�%LQGLQJ����,GHD

l %LQGLQJ�EHWZHHQ�VWUXFWXUHV�DQG�VFDODU�YDOXHVl %LQGLQJ�EHWZHHQ�PXOWLSOH�OLQH�DQG�VLQJOH�OLQH�YDOXHVl 3URJUDPPLQJ�YLD�IXQFWLRQ�PRGXOH�ZLWK�IL[HG�LQWHUIDFHl &DQ�EH�GHILQHG�IRU�DOO�ELQGLQJV

n Required with binding for BAPI methods, for example, since BAPIs generally work with structureswhile container definitions cannot contain any structures (e.g. binding between workflow and single-step task).

n Function module entries in the binding editor via the "alternative binding" context menu.

Page 92: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-12

SAP AG 1999

$OWHUQDWLYH�%LQGLQJ����([DPSOH

:6��������:RUNIORZ�&RQWDLQHU

6WHS���76��������.1$��&UHDWH)URP'DWD7DVN�FRQWDLQHU

A )���� B >DC9E2FGA�>�H�I!H%J&A9>K=MLN �2�+� A )����OB >DC9E2FGA�>�H�I!H%J <?< <: �0����+� B >DC9E2FGA�>�H�I!H%J <?< <P � � ; B >DC9E2FGA�>�H�I!H%J P E ��QR )!"���7�)��!�SB >DC9E2FGA�>�H�I!H%J&R�>DA5T.U

���

C � > �$���V��� B >DC9E2FGA�>�H�I!H<2< <@ ���07���" B >DC9E2@GL � UG@WA

N�E?@ : ��X A�>D=.L: � @YL5L �P E ��QRZ>�A9T[U�>\T.L

A9>K=OL

$%$3�'LFWLRQDU\6WUXFWXUH%$3,.1$���

)XQFWLRQ�PRGXOH966)B'$7$)/2:B:6��������)XQFWLRQ�PRGXOH966)B'$7$)/2:B:6��������

n Example in step 21 of the multistep task WS20000102 (creating a customer via web form): Theworkflow container only contains scalar values, which must be grouped together for BAPI methodKNA1.CreateFromData for structure BAPIKNA101.

This is mapped in function module VSSF_DATAFLOW_WS20000084. The scalar values from theworkflow container here are written to the appropriate structure fields of the PiAddress variablesusing the container macros SWC_GET_ELEMENT and SWC_SET_ELEMEMT.

Page 93: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-13

SAP AG 1999

$OWHUQDWLYH�%LQGLQJ����)XQFWLRQ�0RGXOH�,QWHUIDFH

FDOOLQJBFRQWDLQHU FDOOHGBFRQWDLQHU

'DWDIORZµ(¶� �([SRUW

µ,¶� �,PSRUW

l ,QWHUIDFH function prog_binding

importing dataflow like swabindef-dataflowtables called_container structure swcont

calling_container structure swcont

n The variable DATAFLOW can only accept the values ’E’ (export, meaning binding from theCalling_Container to the Called_Container) and ’I’ (import, meaning binding from theCalled_Container to the Calling_Container).

n The FM must not trigger any exceptions.

n The FM must not trigger any commits or rollbacks.

Page 94: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-14

SAP AG 1999

6WDUWLQJ�7DVNV

l 9LD�WKH�VWHS�GHILQLWLRQ�ZLWKLQ�D�PXOWLVWHS�WDVNl 9LD�WKH�ZRUNIORZ�GHYHORSPHQW�HQYLURQPHQWl 9LD�WKH�6\VWHP�PHQXl 9LD�WKH�$3,�RI�WKH�ZRUN�LWHP�PDQDJHUl 9LD�D�WULJJHULQJ�HYHQW�RI�WKH�WDVN

n Tasks are usually started via the step definition.

n For test purposes, tasks are started via the WF development environment. The current user must be apossible agent of the task.

n Tasks can be started via the "Workflow" entry in the System menu from the application transaction,if an appropriate link is provided by the application.This link is already implemented in the following applications:

Accounting (FI and CO)

Logistics - Purchasing

Logistics - Master Data

Plant Maintenance

Quality Management

Service Management

n Starting tasks via the WIM API is discussed in the unit dealing with the runtime system.

n Starting tasks via an event is discussed in the unit dealing with the event manager.

Page 95: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-15

SAP AG 1999

7DVNV��8QLW�6XPPDU\

l ([SODLQ�WKH�GLIIHUHQFH�EHWZHHQ�D�VLQJOH�VWHS�WDVN�DQGD�PXOWLVWHS�WDVN

l 'HILQH�DQG�VWDUW�ERWK�D�VLQJOH�VWHS�WDVN�DQG�DPXOWLVWHS�WDVN

Page 96: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-16

([HUFLVHV8QLW��7DVNV7RSLF��6LQJOH�6WHS�7DVNV

After completion of these exercises, you will be able to:

• Create new single-step tasks

You have either found or created all the object types that you want to usein your business process with the associated attributes and methods inthe Business Object Builder. Now you want to create single-step tasksbased on the object methods that you can use later in your workflowdefinition.

Note: All tasks are based on the object type ZMARA##A.

1-1 Create a new standard task for displaying a material master.

1-1-1 Create the task =��0DW'LVS with the method Display. Define the task as ageneral task. Specify both a work item text and a task description. Outputthe material number in both texts.

1-1-2 Test the task by starting it via the workflow development environment.

1-2 Create a new standard task for changing a material master.

1-2-1 Create the task =��0DW(GLW with the method Change. Define the task as ageneral task. Specify a work item text, a text for latest end and completion,and a task description. In addition to the material number, also output thenumber and name of the plant for this material in all texts.

1-2-2 As this task is asynchronous, you must define at least one terminating event.Use the event BasicMaterialChanged. In this case, the event does not requirea binding definition.

Page 97: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-17

1-2-3 Test the task in two steps. Start the task in the first step as usual, but do notchange the field ‘basic material’. Instead, initiate the transaction again. Nowview the instance linkages from the work item display.

1-2-4 In the second step, change the field ‘basic material’ and search again for theinstance linkages.

1-2-5 Check the event trace to ensure that the terminating event really wastriggered.

1-3 Create a new standard task for displaying a material master from a particular view.

1-3-1 Create the task =��0DW'LVS9 with the method DisplayView. Define thetask as a general task. Specify both a work item text and a task description.Output the material number in both texts.

1-3-2 Define view "K" (corresponds to "Basic data 1") as the default value for theparameter for controlling the view called for the material.

1-3-3 Test the task by starting it via the workflow development environment.

Page 98: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-18

8QLW��7DVNV6HFWLRQ��0XOWLVWHS�7DVNV

After completion of these exercises, you will be able to:

• Create new multistep tasks

You have either found or created the single-step tasks that represent thesteps in your business process. Now you want to incorporate these single-step tasks into a workflow definition.

Note: If not specified otherwise, the workflow initiator is always to bethe agent responsible for a step. Agent assignment via role resolution isdealt with in the next unit.

Note: Each time a new step is inserted, you should check, save, activate,and test your workflow definition again.

2-1 Define a workflow with a triggering event.

2-1-1 Create the workflow template =��06,352&� for changing a materialmaster. Define the input parameters required for this workflow. DefineOldMaterialChanged as triggering event for your workflow. Implement thebinding between the triggering event and the workflow and activate theevent linkage.

2-1-2 Incorporate the single-step task Z##MatDisp into your workflow definition.

2-1-3 Check, save, and activate your workflow definition.Test your workflow with your material by starting it from the workflowdevelopment environment.

2-1-4 Add the single-step task Z##MatEdit to your workflow definition as a newfirst step. Define the workflow initiator as the message recipient forcompleted processing.

Page 99: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-19

2-1-5 This step is to have deadline monitoring. Activate deadline monitoring forthe latest end. This is to be triggered if processing of the step is not finishedafter 5 minutes. Define the workflow initiator as the message recipient if thelatest end is missed.

2-1-6 For the display step, also define a secondary method, which displays allchange documents belonging to the current material in a separate session.

2-1-7 Check, save, activate and test your workflow again. Check whether, afterthe “Edit” step, you have the notification of completion in your BusinessWorkplace.

2-2 Optional extensions: Create and change a second workflow.

2-2-1 Copy your first workflow template =��06,352&� to the new workflowtemplate =��06,352&�.

2-2-2 Change the message recipient for completion for the "Edit" step. Themanager of the workflow initiator is now to receive the notification ofcompletion.

Note: Use the role AC00000168 to determine the manager of aspecific user. Read the documentation on this role in order to definethe binding from the workflow to the role container correctly.

2-2-3 Define another input parameter /DWHVW(QG'DWH for your workflow. Thisparameter is used to determine the latest end for the ”Edit” step.

2-2-4 Define another input parameter 0DWHULDO9LHZ for your workflow. Thisparameter is used to control the view in the display step of the process.Define view "K" as the default for this parameter.

2-2-5 Define DeadlineTest as another triggering event for your new workflow.Define the binding between the event parameters and the input parametersof the workflow. Activate the event linkage.

2-2-6 The latest end for the ”Edit” step should be on the date determined via/DWHVW(QG'DWH, five minutes after the current time. Ensure in yourworkflow definition that this parameter cannot contain a deadline in thepast.

2-2-7 In the display step, replace the original task Z##MatDisp with the taskZ##MatDispV Supply the step parameter for controlling the display viewwith the value of the 0DWHULDO9LHZ�parameter from the workflow container.

2-2-8 Check, save, activate and test your new workflow both by starting it fromthe development environment and by triggering the new triggering eventexplicitly.

Page 100: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-20

2-3 Optional extensions: Alternative binding

2-3-1 Create a function module =��B%,1'B:)B72B',63/$<B67(3 for analternative binding between the workflow container and the task containerof the display step.

Note: You only require one binding from the workflow to the taskcontainer of task Z##MatDispV.

2-3-2 Enter your new function module as an alternative binding for the displaystep in your workflow definition Z##MSIPROC2.

Page 101: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-21

6ROXWLRQV8QLW��7DVNV7RSLF��6LQJOH�6WHS�7DVNV

1-1 Create a new standard task for displaying a material master.

Solution:TS30900005 – Z00MatDisp

Path (via SAP Easy Access):Tools > SAP Business Workflow > Development > Definition tools > Tasks/Taskgroups > Create

1-2 Create a new standard task for changing a material master.

Solution:TS3090006 – Z00MatEdit

Path (via SAP Easy Access):Tools > SAP Business Workflow > Development > Definition tools > Tasks/Taskgroups > Create

1-3 Create a new standard task for displaying a material master from a particular view.

Solution:TS98000008 – Z00MatDispV

Path (via SAP Easy Access):Tools > SAP Business Workflow > Development > Definition tools > Tasks/Taskgroups > Create

Page 102: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-22

8QLW��7DVNV6HFWLRQ��0XOWLVWHS�7DVNV

After completion of these exercises, you will be able to:

• Create new multistep tasks

You have either found or created the single-step tasks that represent thesteps in your business process. Now you want to incorporate these single-step tasks into a workflow definition.

2-1 Define a workflow with a triggering event.6ROXWLRQ�WS96000011 – Z00MSIPROC1

Path (via SAP Easy Access):Tools > SAP Business Workflow > Development > Definition tools > Tasks/Taskgroups > Create

2-2 Optional extensions: Create and change a second workflow.6ROXWLRQ�WS96000012 – Z00MSIPROC2

Path (via SAP Easy Access):Tools > SAP Business Workflow > Development > Definition tools > Tasks/Taskgroups > Copy

2-3 Optional extensions: Alternative Binding6ROXWLRQ�Z##_BIND_WF_TO_DISPLAY_STEP

Path (via SAP Easy Access):

� To create the function moduleTools > ABAP Workbench > Development > Function Builder

� To incorporate the function module in the step definitionTools > SAP Business Workflow > Development > Definition tools >Tasks/Task groups > Change

Page 103: BC610 - Workflow Development (Englisch)

© SAP AG BC610 4-23

)XQFWLRQ�PRGXOH�=��B%,1'B:)B72B',63/$<B67(3

FUNCTION Z00_BIND_WF_TO_DISPLAY_STEP.*"----------------------------------------------------------------------*"*"Local interface:*" IMPORTING*" VALUE(DATAFLOW) LIKE SWABINDEF-DATAFLOW*" TABLES*" CALLED_CONTAINER STRUCTURE SWCONT*" CALLING_CONTAINER STRUCTURE SWCONT*"---------------------------------------------------------------------- DATA: MAT_OBJECT TYPE SWC_OBJECT. DATA: MAT_VIEW LIKE T132T-STATM.

IF DATAFLOW EQ ’E’. " only consider export dataflow from wf to wi container " read data from workflow (= calling) container SWC_GET_ELEMENT CALLING_CONTAINER ’MaterialMaster’ MAT_OBJECT. SWC_GET_ELEMENT CALLING_CONTAINER ’MaterialView’ MAT_VIEW. " write data to work item (= called) container SWC_SET_ELEMENT CALLED_CONTAINER WI_LEADING_OBJECT MAT_OBJECT. SWC_SET_ELEMENT CALLED_CONTAINER ’MaterialView’ MAT_VIEW. ENDIF.ENDFUNCTION.

Page 104: BC610 - Workflow Development (Englisch)

© SAP AG BC610 5-1

SAP AG 1999

5ROHV

&RQWHQWV�l 'HWHUPLQLQJ�DJHQWV�YLD�UROH�IXQFWLRQ�PRGXOHV

Page 105: BC610 - Workflow Development (Englisch)

© SAP AG BC610 5-2

SAP AG 1999

5ROHV��8QLW�2EMHFWLYHV

$W�WKH�FRQFOXVLRQ�RI�WKLV�XQLW��\RX�ZLOO�EH�DEOH�WR�

l 'HILQH�DQG�XVH�D�UROH�YLD�D�UROH�IXQFWLRQ�PRGXOHl ,PSOHPHQW�D�UROH�IXQFWLRQ�PRGXOH

Page 106: BC610 - Workflow Development (Englisch)

© SAP AG BC610 5-3

SAP AG 1999

2UJDQL]DWLRQ

3URFHVVHV

%XVLQHVVREMHFWV

0HWKRGV

:)�GHILQLWLRQ 6WHS

(YHQWV$WWULEXWHV

5ROH 7DVN

3HUVRQ 3RVLWLRQ�MRE 2UJ��XQLW

2EMHFW

5ROHV��2YHUYLHZ�'LDJUDP

Page 107: BC610 - Workflow Development (Englisch)

© SAP AG BC610 5-4

SAP AG 1999

5ROH�5HVROXWLRQ

l (YDOXDWLRQ�XVLQJ�RUJDQL]DWLRQ�PRGHO� Superior of...

Head of organizational unitDepartmental secretary

l (YDOXDWLRQ�XVLQJ�PDVWHU�GDWD� Person responsible for material

Customer service employee

l (YDOXDWLRQ�XVLQJ�&XVWRPL]LQJ�GDWD� Accounting clerk

Person responsible for release

n Roles are used to restrict or define more closely the number of recipients according to businessconsiderations.

n Benefits:

é dynamic restriction of the number of possible agents

é actual organizational plan does not need to be known

é agents determined according to current conditions (role resolution at runtime)

n The definition of a role contains

é the specification of the rules for role resolution (–> function module), and

é the specification of the runtime-dependent role parameters required for role resolution.

n Role definition, use of roles and role resolution using the role "Superior of…." as an example.

n The roles "Manager" and "sap_org_unit" are supplied by SAP.

Page 108: BC610 - Workflow Development (Englisch)

© SAP AG BC610 5-5

SAP AG 1999

$GGUHVVLQJ�YLD�)XQFWLRQ�0RGXOHV

l 5ROH�IXQFWLRQ�PRGXOHV�FDQ�EH�XVHG�IRU�DQ\�HYDOXDWLRQVl 5ROH�IXQFWLRQ�PRGXOHV�PXVW�EH�ZULWWHQ�E\�WKH�FXVWRPHUl ,QWHUIDFH

IXQFWLRQ�UROHBIPWDEOHV DFWRUBWDE� VWUXFWXUH�VZKDFWRU

DFBFRQWDLQHU VWUXFWXUH�VZFRQWH[FHSWLRQV QRERG\BIRXQG

l &RQWDLQHU�FRQWDLQV�WKH�SDUDPHWHUV�GHILQHG�IRU�WKH�UROH

n The role container must be filled with a binding. If the role is used in a step, data can be transferredfrom the workflow container. If the role is used as the default role of the task, data can be transferredfrom the task container.

n The function module must have the interface outlined above.

Page 109: BC610 - Workflow Development (Englisch)

© SAP AG BC610 5-6

SAP AG 1999

����������� ����������������

�������������� ��!�"�#$�����#�%���&�'#�����%(#)%��������*�+�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,*�+ �.-�/�0�132*�+ -�����4�5#��.-�/62���5�7����'7�5�16298$:'-�����4�5*�+ -��.#$��4����.-<;9��1�562���5�7����7�5�16298���4�$�*�+ 1�=��13>���;'4��2*�? ��4�/�4@�A'#�B�4�7���@*�+�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�&���&�C�����#���&D3� ����E��F�����'G�H�����������,'�G�H9#$��&D3�JI�����#$���3��%������K����E��F������������3�����L������3%��M�L!����'NMN���&����%M���������

������&�%K&�������%(#���&'GO�P%�����%����NQ&�������%(#<�&'GR�

�!���#$S����9#������'D3����� &���#���������&�������%UT @30�;V#���-�W�1XTY����(#$��&D3���

��&����M��������������ZT[2�4.#�@�0�;\#35�1-�@�#�-�>�;��JT��"]���%������S �����#���&'D3� ^K����(#$��&'D����&'G$����� �����#$������%������_^K����(#�������%��������"����']���������� ���'N���%�� ^a`�`)�

���Q��b<,��'��G�%��_���Q�J�P%�&������K���G3��b�#)��������X�Y��������J�

�����]6&��L����(#�������%������c�!�N���%��_D3�D�G���%(#)�.b�]6��d �.]3&������&�������%(#<��&'G),'���.b�]�� ^ZTe732cT��&�������%(#<��&'G),'�'G�H���K^M����(#����3��%�������,(D3�D�G3��%�,'��&'DR�&]�]3����Q&�������%�#)��&'GO�

����������']O�

���K&�������%�#)��&'GOf�gh���K����������&��J�P%�&������L���'G���b�#���������i�j��������c�

�������������������i�

l 5HDG�UROH�SDUDPHWHUVIURP�UROH�FRQWDLQHU

l (YDOXDWH�LQWHUQDODSSOLFDWLRQ�GDWD�IRUDJHQW�GHWHUPLQDWLRQ

l 5HWXUQ�DJHQWV�IRXQGRU

l 7ULJJHU�H[FHSWLRQQRERG\BIRXQG

6WUXFWXUH�RI�D�5ROH�)XQFWLRQ�0RGXOH

n The actual function module SWX_DLI_READ_FOR_ROLE is more extensive - this is only anextract. The function module is used for agent determination on the basis of a distribution list.

n The result of a role resolution does not necessarily have to be a user - it can also be anyorganizational object (for example, an organizational unit, a position, etc).

Page 110: BC610 - Workflow Development (Englisch)

© SAP AG BC610 5-7

SAP AG 1999

l )LUVW�OHYHO�7DVN�SURILOH

l 6HFRQG�OHYHO�'HWHUPLQDWLRQ�RI�UHVSRQVLEOH�DJHQWV�RU�GHIDXOWUROH�RI�WDVN

l 7KLUG�OHYHO�5HPRYDO�RI�H[FOXGHG�DJHQWV

5HVROXWLRQ�RI�$GGUHVVLQJ

n The level above may consist only of a further restriction of the level below. Therefore, if the firstlevel is missing because the task profile was not maintained, agents cannot be found in thesubsequent levels.

n Unlike e-mails, the work items derived from the tasks are not delivered as copies. Instead, just onework item exists for all recipients and they have only a view on it.

n The explicit definition of possible agents in the task definition can be replaced by classification as a"general task". In this case, all users known in the system can process the task.

n If a role is specified both in the step definition and in the task definition, the role in the stepdefinition overrides the default role from the task definition.

n Users who are not possible agents of the task never see the WI, even if they are responsible agentsbecause of a role resolution.

n The default role of a task is also evaluated if the agent assignment using a role in the step definitionends without a result, and the indicator "terminate if role resolution has no result" is not set for thisrole.

Page 111: BC610 - Workflow Development (Englisch)

© SAP AG BC610 5-8

SAP AG 1999

5ROHV��8QLW�6XPPDU\

l 'HILQH�DQG�XVH�D�UROH�GHILQHG�YLD�D�UROH�IXQFWLRQPRGXOH

l ,PSOHPHQW�D�UROH�IXQFWLRQ�PRGXOH

Page 112: BC610 - Workflow Development (Englisch)

© SAP AG BC610 5-9

([HUFLVHV8QLW��5ROHV7RSLF��5ROH�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ

After completion of these exercises, you will be able to:

• Create role definitions

• Create a role function module

The flow of the business process is now stored in the workflow definition.You now want to assign the individual dialog steps based on the currentdata of the object to be processed to the correct recipients.

1-1 Create a new role =��0DW'LVS$F using a role function module.

1-1-1 Create a role function module =��B00B0*5B25B86(5B*(7. Thisfunction module returns the “manager of” the initiator of the workflow asagent if the material type of the material entered has the value ROH (raw).Otherwise the initiator is returned.

Note: Use the function module from role AC00000168 to determinethe manager of a specific user. Read the documentation on this role inorder to provide the role container correctly with the input data.

1-1-2 Now define the role using the new function module. Define the parametersfor this role according to the implementation of your function module.

Note: The role parameters are defined via the role container.

Note: The workflow initiator can be defined with reference either tofield WFSYST-INITIATOR or to RHOBJECTS-OBJECT.

1-1-3 Use the newly created role for the agent assignment of the “display” step inyour workflow Z##MSIPROC2.

1-1-4 Check, activate and test your workflow Z##MSIPROC2 again.

Page 113: BC610 - Workflow Development (Englisch)

© SAP AG BC610 5-10

6ROXWLRQV8QLW��5ROHV7RSLF��5ROH�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ

1-1 Create a new role =��0DW'LVS$F using a role function module.

Solution:AC30900129 – Z00MatDispAcFunction module Z00_MM_MGR_OR_USER_GETOrganizational structureO 00003100 Plant Chicago----- S 50014947 Project Leader Engineering ----- P 00010810 Kimberley Hughes ----- US WF-BC-MGR Kimberley Hughes----- S 50011158 Electrical Engineer ----- P 00010812 Caroline Douglas ----- US WF-BC-CLERK Caroline Douglas

Path: (via SAP Easy Access)

� For the roleTools > SAP Business Workflow > Development > Definition tools > Standard roles > Create

� For the function moduleTools > ABAP Workbench > Development > Function Builder

� For the organizational structureTools > SAP Business Workflow > Development > Definition tools > Organizational Management > Organizational plan > Display

Page 114: BC610 - Workflow Development (Englisch)

© SAP AG BC610 5-11

FUNCTION Z00_MM_MGR_OR_USER_GET.*"----------------------------------------------------------------------*"*"Local interface:*" TABLES*" ACTOR_TAB STRUCTURE SWHACTOR*" AC_CONTAINER STRUCTURE SWCONT*" EXCEPTIONS*" NOBODY_FOUND*"----------------------------------------------------------------------

DATA: MATERIAL_TYPE LIKE MARA-MTART. " type of changed material DATA: WF_INITIATOR LIKE SWHACTOR. " workflow initiator DATA: COUNTER TYPE I.

REFRESH ACTOR_TAB. CLEAR ACTOR_TAB.

* get type of material under consideration SWC_GET_ELEMENT AC_CONTAINER ’MaterialType’ MATERIAL_TYPE. SWC_GET_ELEMENT AC_CONTAINER ’WorkflowInitiator’ WF_INITIATOR.

CASE MATERIAL_TYPE. WHEN ’ROH’. " get manager of wf_initiator from role SWC_SET_ELEMENT AC_CONTAINER ’ORG_OBJECT’ WF_INITIATOR. CALL FUNCTION ’SWX_GET_MANAGER’ TABLES ACTOR_TAB = ACTOR_TAB AC_CONTAINER = AC_CONTAINER EXCEPTIONS NOBODY_FOUND = 1. IF SY-SUBRC NE 0. RAISE NOBODY_FOUND. ENDIF. WHEN OTHERS. ACTOR_TAB = WF_INITIATOR. APPEND ACTOR_TAB. ENDCASE.

* check if we have found any agents at all DESCRIBE TABLE ACTOR_TAB LINES COUNTER. IF COUNTER = 0. RAISE NOBODY_FOUND. ENDIF.

ENDFUNCTION.

Page 115: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-1

SAP AG 1999

l (YHQW�PDQDJHUl 7ULJJHULQJ�HYHQWV�H[SOLFLWO\l 5HFHLYLQJ�HYHQWVl (YHQW�TXHXH

(YHQW�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ

&RQWHQWV�

Page 116: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-2

SAP AG 1999

(YHQW�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ��8QLW2EMHFWLYHV

$W�WKH�FRQFOXVLRQ�RI�WKLV�XQLW��\RX�ZLOO�EH�DEOH�WR�l ([SODLQ�WKH�EDVLF�FRQFHSWV�RI�WKH�HYHQW�PDQDJHUl 7ULJJHU�DQ�HYHQW�H[SOLFLWO\�XVLQJ�SURJUDPPLQJl (YDOXDWH�DQG�UHFHLYH�DQ�HYHQWl $GPLQLVWUDWH�WKH�HYHQW�TXHXH

Page 117: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-3

SAP AG 1999

2UJDQL]DWLRQ

3URFHVVHV

%XVLQHVVREMHFWV

0HWKRGV

:)�GHILQLWLRQ 6WHS

(YHQWV

2EMHFW

$WWULEXWHV

3HUVRQ 3RVLWLRQ�MRE 2UJ��XQLW

5ROH 7DVN

(YHQW�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ��2YHUYLHZ

Page 118: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-4

SAP AG 1999

(YHQWV��0RWLYDWLRQ

l 6KLIW�RI�FRPSOH[LW\l *UHDWHU�IOH[LELOLW\l (DVLHU�WR�H[WHQG�DQG�LQWHJUDWHl *UHDWHU�WUDQVSDUHQF\

n The complexity and management of general information are shifted from the applications to a centralcomponent. The information on possible linkages is no longer in the applications.

n Linkages can be easily activated and deactivated at runtime.

n New linkages can be easily integrated without changing the source code of the application. Externalcomponents can also be connected.

n The transparency of the entire system is enhanced by disclosing general information.

n Examples of applications include:

é Starting workflows from the application (flexible linkage)

é Terminating steps with updating (integration)

é Waiting for concurrent actions (integration, transparency)

Page 119: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-5

SAP AG 1999

l 3XEOLVK�DQG�VXEVFULEHl (&$�SDUDGLJPl 6WDWLF�RU�G\QDPLF�HYDOXDWLRQl 7LPH�LQGHSHQGHQWl /LQNDJH�PRGH�VHTXHQWLDO�DQG�WUDQVDFWLRQ�GHSHQGHQW

(YHQW�/LQNDJH��%DVLF�&RQFHSWV

n Linkages are entered according to the principle of "publish and subscribe", meaning that the creatorpublishes the event without considering possible receivers. The number of receivers makes nodifference to the creator.Interested receivers have to "subscribe" with the event manager (EM).

n Linkages are evaluated by the EM according to the ECA paradigm. The event is triggered (E=event),the linkage tables are checked and, if necessary, check function modules are called (C=condition),and finally the receivers found are notified (A=action).In accordance with the OO approach for the creators, the linkage is evaluated hierarchically.

n There is an option for a dynamic evaluation of the linkage using the check and receiver typedetermination function modules.

n Triggered events are evaluated immediately, meaning the receiver is called immediately. The eventsare not stored temporarily.

n The event is only triggered after an SAP commit (ABAP keyword COMMIT WORK); an implicitdatabase commit is not sufficient. Triggering does not take place after a ROLLBACK WORK.

Page 120: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-6

SAP AG 1999

7UDQVDFWLRQDO�5)&�%DVLF�'HVLJQ

l 'HSHQGHQW�RQ�H[SOLFLW�&200,7�:25.l 1HZ�ORJLQl (UURU�KDQGOLQJ�YLD�VHSDUDWH�ORJ

n Without an explicit commit work, the events "do not take place" (transactional property).

n A new login is carried out for the event receivers with each destination (RFC property).

n The transactional RFC (tRFC) log can be read via transaction SM58.

Page 121: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-7

SAP AG 1999

$SSOLFDWLRQ����&UHDWRU�

&UHDWRU�FRQWH[W 5HFHLYHU�FRQWH[W

������������ ����������������������� � � � ���

������������ !����������"��#��� $�����

)%�VZHBHYHQWBFUHDWH (YDOXDWLRQ�RIOLQNDJH�WDEOHV

&DOOUHFHLYHU�)0

(YHQW�0DQDJHU

&RPPLW�:RUN

&DOO�UHFHLYHUW\SH�)0

&DOOFKHFN�)0

$SSOLFDWLRQ����5HFHLYHU�

(YHQWV��&UHDWRU�DQG�5HFHLYHU�&RQWH[W

n The receiver type FM and check FM run in the creator’s context in order to avoid superfluous tRFCs.

Page 122: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-8

SAP AG 1999

(YHQWV��7\SH�/LQNDJH

l /LQNDJH�EHWZHHQ�WULJJHULQJ�REMHFW�W\SH�DQG�UHFHLYLQJREMHFW�W\SH

l 0DLQWHQDQFH�HLWKHU�H[SOLFLW�XVLQJ�YLHZ�PDLQWHQDQFH�RUXVLQJ�IXQFWLRQ�PRGXOHV

l 7UDQVSRUW�RI�DFWLYLW\�LQGLFDWRU�RQO\�RQ�UHTXHVW

n The type linkage is implemented using the type linkage table. The "global" indicator is activated.

n An entry in the type linkage table is always required if a receiver is to be notified. Maintenance takesplace either explicitly or internally using function modules.

n The table entries can be transported, but the transport is usually carried out without the activityindicator. Therefore the linkages usually have to be activated explicitly in the target system. If theactivity indicator is to be transported, this can be done using the general transport link of thegenerated view maintenance.

n All linkages are client-specific.

n Type linkages for triggering events are entered by the workflow runtime system when the linkage isactivated in the task definition, if there are no check or receiver type function modules. If at least onesuch function module is required, the linkage must always be entered manually (as part ofCustomizing for the relevant workflow).

n Type linkages for terminating events are entered automatically by the workflow runtime systemwhen the associated work item is created, if there are no check or receiver type function modules. Ifat least one such function module is required, the linkage must always be entered manually (as partof Customizing for the relevant workflow).

Page 123: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-9

SAP AG 1999

(YHQWV��,QVWDQFH�/LQNDJH

l /LQNDJH�EHWZHHQ�WULJJHULQJ�REMHFW�LQVWDQFH�DQG�UHFHLYLQJREMHFW�LQVWDQFH

l 'LVSOD\�H[SOLFLW�XVLQJ�ZRUNIORZ�GHYHORSPHQW�HQYLURQPHQWRU�XVLQJ�ZRUN�LWHP�GLVSOD\

l 0DLQWHQDQFH�XVXDOO\�LPSOLFLW�XVLQJ�IXQFWLRQ�PRGXOHVl 1R�WUDQVSRUW

n The instance linkage is implemented using a combination of the type linkage table and the instancelinkage table. In the type linkage table the "global" indicator is deactivated.

n The instance linkage table is only evaluated if the associated type linkage is "active" and not"global". Maintenance usually takes place using only function modules. The appropriate workflow-related entries (for example, for terminating events of a step) are entered and deleted automaticallyby the workflow runtime system.For test purposes, it is also possible to make entries in or changes to the instance linkage tablemanually.

n The table entries are never transported.

n All linkages are client-specific.

Page 124: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-10

SAP AG 1999

(YHQW�0DQDJHU���3URFHVVLQJ�/RJLF

l 6HDUFK�IRU�DOO�DFWLYH�W\SH�OLQNDJHVl (YDOXDWH�G\QDPLF�UHFHLYHU�GHWHUPLQDWLRQl ,I�JOREDO�OLQNDJH�

% Call receiver FM% Call check FM

l 2WKHUZLVH�% Search for all instance linkages% Call check FM for each instance linkage% Call receiver FM for each instance linkage

Page 125: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-11

SAP AG 1999

(YHQWV��(YHQW�7UDFH

l $OO�WULJJHUHG�HYHQWV�ORJJHGl $FWLYDWH��GHDFWLYDWH�DQG�GLVSOD\�YLD�ZRUNIORZ

GHYHORSPHQW�HQYLURQPHQWl (QWULHV�GR�QRW�VSHFLI\�EHKDYLRU�RI�UHFHLYHUl 7KH�HYHQW�WUDFH�IXQFWLRQ�VKRXOG�EH�GHDFWLYDWHG�LQ�WKH

OLYH�V\VWHP

n All triggered events are entered, irrespective of whether and how many receivers were found. Aseparate entry is made for each receiver.Errors in the check and receiver type function modules are also logged.

n Internally, the trace is regarded as an additional receiver which is always triggered. It is independentof the commit behavior of other (explicit) receivers.

n Updating and writing the trace is time consuming because a separate tRFC is triggered. For thisreason, the trace should be deactivated in live systems (see note 46358).

n You can restrict the writing of the trace to selected object types or events.

Page 126: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-12

SAP AG 1999

l 'HILQH�HYHQWV�LQ�WKH�%XVLQHVV�2EMHFW�%XLOGHUl 7ULJJHU�HYHQW

% Implicitly via generic tools, for examplechange documents orstatus management ormessage control

% Explicitly via function moduleSWE_EVENT_CREATE orSWE_EVENT_CREATE_IN_UPD_TASK orSWE_EVENT_CREATE_FOR_UPD_TASK

(YHQWV��'HILQLQJ���7ULJJHULQJ

n Events must be defined in the Business Object Builder for the relevant object type. Not all definedevents must be triggered, but all triggered events must be defined.

n Implicit triggering via change documents does not require any ABAP coding. Customizing activitiesfor the triggering application are necessary instead.Explicit triggering via function modules requires the source code of the application to be changed orextended.Important: the function module SWE_EVENT_CREATE can trigger exceptions. If these are notcaught by the triggering application, a runtime error occurs.

n The triggering modules do not execute COMMIT WORKs themselves. It is the task of the triggeringapplication to issue a COMMIT WORK at the right time.

n Events with user-defined parameters must always be triggered explicitly if these parameters are to beset.

n SWE_EVENT_CREATE - event triggered immediately. SWE_EVENT_CREATE_IN_UPD_TASK- as SWE_EVENT_CREATE, but defined as updating function module.SWE_EVENT_CREATE_FOR_UPD_TASK - as SWE_EVENT_CREATE, but is required if theobject that triggers the event is not generated via the application until the update.

n Explicit triggering via function modules usually takes place in customer systems by the customerprogramming an existing user exit.

Page 127: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-13

SAP AG 1999

&('*),+"-,.0/�132"4 5648709":<;.,=*>0=@?BA3/(C�&D'FE*GH=�I*IJ/�>LK�M(/(N<O

)0EJP*Q3=0'NK�)*ED.*/R+(&(M0/R=(',+0=�STA,-,M0U3I�O=�I0I/,>TK3',E +(&(M0/R=(',+0=�SD=D'�+D'39�OIJ-A(K '0-"P*A�/*U +(&(M0/R=(',+0=�SD=D'�+D',V8O

/*'(.HE*GF=�I*I"/�>WK�M0/(N<;.,=*>0=@?�E"A�X/*)�>YK�M0/(N +(&(M0/ZI"[,/�&D'3I>0)0E(-�SDEJA\XJM*/DN�;

IJ[,)6K�),E'�>(=,&D'*/(U /*]�>TK�)*ED'�>(=,&'*/0U<;^`_�U*&*>D/�Q =(U�=TP /,>(/0U3Ia&D'�>DEb/0]0/*',>c),E('�>(=,&'*/0UIJ[�)6K\I/,>TK3/�+D/DP,/,',>c/0],>TK�)*ED'�>(=,&'*/0Ued�G,+0=(CJK3/*f(-�&WK�=(/*'(.*/0U,'�dbdhg�d ;^�2,E6P*Q3E�IJ/HEA XD/*),>cM(/(N=�I0I/*>TK M*/N�S),ETP,Q3=0'DNK )*E(.*/cijd$7*707,9\d0;=�I0I/*>TK M*/N�S=3IDID/,>TK ',E ijd$7*707,7D7,709DV*k*l(m�n8d(;=�I0I/*>TK M*/N�S0I-JA0K '0-P*A�/*U ijd$7*907,7\d0;E"A�X/0),>LK�M(/(NRiH=�I*I"/�>WK�M0/(N<;^�5*U*&(C0C*/(UR>(o(/H/0]*/*'*>)*=*+*+aG(-,'0),>0&*E'jd$pL_ q6K q"r3q"4356K�2Ds*qt 5qud

/(vDQ�E0U,>,&"',CE"A�X0>6N0Q�/biwdyx(z3p*9*7V*V�dE"A�XDMD/0N{iHE"A�X/0),>LK�M(/(N/0]*/,'0> iwd�)Do�=D'*C0/*.<d

>(="A3+(/�I/0]*/,'0>6K�)*E('�>D=,&D'*/(UbiF/0]�>6K3),E('�>(=,&'*/0U

/(v�)D/Q >,&E*'�IE,>o�/DU I|i}7*9\;

&(G}ITN�S0I"-"A3U*)c',/}7\;~ .,EaN,E(-*UFE([,'F/*U(U,E(Uco�=('*.*+*&D',C

/*'0.�&G<;^bI(>D=0U,>b>Ds*�,2�Q�U,E0)0/�I*ID&('(C)*EJP*P3&*>�[,E0U0M��

7ULJJHULQJ�DQ�(YHQW�([SOLFLWO\

l )LOO�HYHQW�FRQWDLQHU�ZLWKHYHQW�SDUDPHWHUV

l &RPSRVH�REMHFW�NH\�IRUWULJJHULQJ�REMHFW

l &DOO�VZHBHYHQWBFUHDWHl )0�FDOO�HUURU�KDQGLQJl 7ULJJHU�HYHQW�ZLWK

H[SOLFLW�FRPPLW�ZRUN

n ,PSRUWDQW�If the event is triggered in a user exit, a COMMIT WORK usually must not be programmed here,since this would destroy the commit logic of the application.

Page 128: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-14

SAP AG 1999

&D'*),+-,.(/�1 264 5"4\7(9":<;.*=*>0=�?�E"A�XD/()�>LK�M(/(N +0&0MD/�IJ[*/�&D'3ID>()0E(-3SDE6A\X"M,/"N�;

IJ[�)JK3),E('�>D=,&D'*/0U /0],>TK�)*E(',>(=,&D'*/(U<;EJA�X/*),>WK�M0/0NFijd$7*707*709V*k*l0m�nD�*�@d0;^�5*U,&(C(C*/0UH>(o*/b/0]*/*',>)0=*+*+cGD-,'*)�>D&*E('ed$pL_ qJK3q"r3q435TK�2(s,qJt 5(q�d

/DvDQ3E*U0>,&D'*CEA X0>"N(Q�/bi d x(z3p,9*7(7*9 dEA XDM0/(N�iRE"A�X/*),>WK�M0/0N/*](/,',> ijd!)(U*/*=,>/*.�d

>D="A +0/,I/*](/,',>TK )*E('�>(=*&D'*/0UciH/*]*>6K�)*ED'�>(=,&D'0/0U

/Dv�)(/DQ�>,&(E0'�IE�>Jo�/0U3I�i�709\;

^ I(>(=0U*>F>(s(�,2�Q�U,E0)0/�I0ID&('0C)0EJP*P &*>�[�E*UDM�;

2EMHFW�W\SH%86����=B%86����

(YHQW&UHDWHG&UHDWHG

5HFHLYHU�W\SH:6��������:6��������

,QKHULWDQFH��7ULJJHULQJ���6XSHUW\SH

n The event is only triggered for the supertype.

Page 129: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-15

SAP AG 1999

&('*),+"-,.0/�132J435"487D9:<;.,=*>0=@?�E"A�X/0),>LK�MD/0N +0&(M(/}I"[0/�&D'3I>0)0E(-�SDEJA\X"M*/N�;

IJ[�)6K )*E('�>=�&D'*/(U /*]*>6K�)*ED'�>(=,&'*/0U<;E"A�X/0),>LK�M0/(NFi�d�7,707*7(9DV*k*l(m�n(�*�@d ;^�5*U*&(C0C*/0UH>Do*/b/*]*/*'*>)*=*+*+aG(-,'*),>(&0E('ed�pL_ q6K q"r3q"4356K�2(s*q"t35(qud

/(vDQ3E0U*>*&D',CE"A�X(>"N0Q,/Fiwd �LK x(z�p,9*707*9 dE"A�XM0/0N�iHE"A�X/0),>LK�M0/(N/0]0/*',> iwd�)(U*/0=,>D/*.�d

>(="A +(/�I/0]0/*',>6K3),E('�>D=,&D'*/(UbiH/0],>TK�),E'�>(=,&'*/0U

/(v�)(/Q3>*&(E*',IE,>"o,/0U I�i}7*9\;

^ I(>D=0U,>F>Ds0�*2aQ,U�E0)0/�I*ID&('(C)*EJP*P3&*>�[�E0U(M<;

2EMHFW�W\SH%86����=B%86����

(YHQW&UHDWHG&UHDWHG

5HFHLYHU�W\SH:6��������:6��������

,QKHULWDQFH��7ULJJHULQJ���6XEW\SH

n The event is triggered for the subobject type as well as for all supertypes for which the event isdefined.

Page 130: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-16

SAP AG 1999

5HFHLYHU�)XQFWLRQ�0RGXOH

l ,QWHUIDFHfunction receiver_fm

importing objtype like swetypecou-objtype objkey like sweinstcou-objkey event like swetypecou-event rectype like swetypecou-rectype

tables event_container structure swcont

l 3URFHVV�LQ�VHSDUDWH�FRQWH[W

n If possible, the function module should not trigger any exceptions, since these are only recordeddirectly in the tRFC log. If this occurs, workflow receiver function modules send an error message tothe workflow system administrator.

n Example of a function module: SWW_WI_START_VIA_EVENT

n In the case of propagated events, the default parameter _EVT_OBJTYPE contains the triggeringobject type (that is, the subtype), while the interface parameter OBJTYPE contains the propagatedobject type (that is, the supertype).This also applies to the check and receiver type function modules.

n _EVT_OBJECT always contains the triggering object type!

Page 131: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-17

SAP AG 1999

&KHFN�)XQFWLRQ�0RGXOH

l 7HVW�IRU�UHOHYDQFH�IRU�UHFHLYHUl ,QWHUIDFH

function check_fmimporting objtype like swetypecou-objtype

objkey like sweinstcou-objkey event like swetypecou-event rectype like swetypecou-rectype

tables event_container structure swcontexceptions others

l 3URFHVV�LQ�FUHDWRU�FRQWH[W

n The check FM cannot commit (nor rollback).

n Exceptions are recorded in the event trace.

Page 132: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-18

SAP AG 1999

G0-*',)0>*&(E*'F)Do,/*)(M6K�EJA\XJ/,)*>TK�>NDQ /LK8&D.,E0)*=6Q*Q +�;^*^0^*^(^*^0^,^D^,^0^*^0^0^0^*^0^*^(^*^0^*^(^*^0^,^D^,^0^*^0^*^(^*^0^*^(^*^0^*^(^*^0^,^D^,^0^*^0^^a&JP(Q E(U�>D&0'0CHEJA�X(>"N(Q�/ +,&DM*/ IJ[,/�>"NDQ�/�)0E(-�SDEJA\X>NDQ3/^ E"A�XM(/(N +,&DM*/ IJ[,/�&D'�ID>*)0E(-�SDEJA\XJM*/DN^ /0]*/*'*> +,&DM*/ IJ[,/�>"NDQ�/�)0E(-�S/(],/('�>^ U*/*),>JN(Q�/�+,&DM*/ IJ[,/�>"NDQ�/�)0E(-�SU0/,)0>NDQ3/^a>0=6A�+D/ I /0]*/*'*>TK�)*ED'�>(=�&"',/0U}I(>U0-,),>"-,U0/ IJ[,)*E('�>^�/0v*)0/"Q�>D&*E('3I�)Do,/*)0MTK�G*=,&(+(/0.^*^0^*^(^*^0^,^D^,^0^*^0^0^0^*^0^*^(^*^0^*^(^*^0^,^D^,^0^*^0^*^(^*^0^*^(^*^0^*^(^*^0^,^D^,^0^*^0^&('*),+"-,.0/�1 2"435"4�709":<;)*E('3I>0=('�>0I@?)6K E,>"N0Q,/"K�="Q0Q�+b+0&(M(/}IJ[*/�>"N0Q,/�)0E(-3SDE6A\XD>NQ3/b]*=,+-�/ed���*�,2Jt �0�0�<dDO)6K3/0]�>6K3E�>"N(Q�/H+*&DM*/ZI6[�)(E0',>�S6/�+D/P�/*'*>a]�=0+D-*/ed K3qDr�5"K3�*x,�05(�,�Dq�d;

.,=*>0=@?`&0'0&,>0&0=*>0&D'*C6K�E0>NDQ3/H+0&0MD/�IJ[,/,>"N(Q�/,)(E(-3SDE6A\XD>DN"Q /�;^a�JP(Q�+D/DP,/,',>0=*>0&(E0'HEDGH)(o0/,)(MbGDP^�s,/0=0.REU�&DC�&D'*=*>*&D'*CFEJA\X>NDQ /bG0U,EJPZ/0]*/*'*>b)*ED'�>(=�&"',/0UIJ[�)6K3C*/,>6K�/�+D/P�/0',>c/0]0/*',>TK )*E('�>=�&D'*/0U

)LK�/(]�>WK�E*>DN"Q /R&D'�&(>*&(=,>(&('0CJK E,>"N0Q,/e;^�)(o0/,)(MH&0GR&D',&0>*&(=,>(&('0CFE"A�X0>6N0Q�/R&�I�.0/3I&(U0/*.FE(',/&(GR&'�&0>,&=�>0&('0C6K�E,>"N(Q�/�1�:H)TK\E(>DNDQ3/6K�=6Q*Q +�;U,=0&�I"/F)0o*/,)(MJK3G,=*&*+/*.�;

/*'0.�&G<;/*'0.*GD-,'*)�>D&*E('<;

,PSOHPHQWLQJ�D�&KHFN�)XQFWLRQ�0RGXOH

l 5HDG�HYHQW�SDUDPHWHUVIURP�HYHQW�FRQWDLQHU

l &KHFN�FRQGLWLRQl 7ULJJHU�DQ�H[FHSWLRQ�RU

HQG�IXQFWLRQ�PRGXOH

n Other typical contents of a check function module

� Default parameter query (for example, date, time, object type)

� Object attribute query using the macro SWC_GET_PROPERTY

� Write additional values to the event container.

n If the event is triggered before the object data is written to the database, the object attributes are notyet available for querying, since the database is accessed when the attributes are evaluated by theBusiness Object Builder.This may occur, for example, if the event is triggered implicitly when generating the object (that is,via change documents, status management, etc.) and the object is not generated until later inupdating.

Page 133: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-19

SAP AG 1999

5HFHLYHU�7\SH�)XQFWLRQ�0RGXOH

l '\QDPLF�GHWHUPLQDWLRQ�RI�UHFHLYHU�W\SH�GHSHQGHQW�RQ�HYHQW�GDWDl ,QWHUIDFH

function rectypeget_fmimporting objtype like swetypecou-objtype

objkey like sweinstcou-objkey eventlike swetypecou-event

rectype like swetypecou-rectypetables event_container structure swcont

l 3URFHVV�LQ�FUHDWRU�FRQWH[W

n The receiver type FM cannot commit (nor rollback).

n The table entry "receiver type" (rectype) from the type linkage table can be used as an inputparameter generic_rectype for the function module.

n Exceptions are recorded in the event trace.

Page 134: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-20

SAP AG 1999

G0-*',)0>*&(E*'F)D]0[,G6K /0]*/*'*>TK U*/0)6K .�EM ID>TK C*/*>�;^*^0^*^(^*^0^,^D^,^0^*^0^0^0^*^0^*^(^*^0^*^(^*^0^,^D^,^0^*^0^*^(^*^0^*^(^*^0^*^(^*^0^,^D^,^0^*^0^*^(^*^0^*^(^*^^a&JP(Q E(U�>D&0'0CHEJA�X(>"N(Q�/ +*&DM*/ZI6[�/,>NQ3/*)*E- SE"A�X(>"N(Q�/^ E"A�XM(/(N +*&DM*/ZI6[�/,&('�I(>()*E- SE"A�XM0/(N^ /0]*/*'*> +*&DM*/ZI6[�/,>NQ3/*)*E- S"/0]0/*',>^ C*/0'*/(U�&()6K3U*/*)�>6N0Q�/ +*&DM*/ZI6[�/,>NQ3/*)*E- S"U*/0),>"N(Q�/^�/0v"Q E(U�>D&0'0C�U0/,)*>NQ3/ +*&DM*/ZI6[�/,>NQ3/*)*E- S"U*/0),>"N(Q�/^a>0=6A�+D/ I /0]*/*'*>TK�)*ED'�>(=�&"',/0U I(>DU0-,)*>-�U0/�IJ[,)*E('�>^�/0v*)0/"Q�>D&*E('3I�'*E6K U*/0),>"N(Q�/^*^0^*^(^*^0^,^D^,^0^*^0^0^0^*^0^*^(^*^0^*^(^*^0^,^D^,^0^*^0^*^(^*^0^*^(^*^0^*^(^*^0^,^D^,^0^*^0^*^(^*^0^*^(^*^&('*),+"-,.0/�1 2"435"4�709":<;.,=*>0=@?`+6K�.�E(M3ID>b+*&DM*/b.0U,="[�S".�EM ID>�;.,=*>0=@?BA /DC�&D'HE(GF.0U,="[�M0/(N�O

.,EDM,=(UH+*&DM*/b.0U�=J[�S".,E(M,=DU�O.,EDM*'0UH+*&DM*/b.0U�=J[�S".,E(M*'(U�O.,EDM0]*UH+*&DM*/b.0U�=J[�S".,E(M0]0U�O.,EDM�>0+b+*&DM*/b.0U�=J[�S".,E(M�>(+@O

/,'D.RE0Gb.0U,=[�M(/(N�;^a�JP(Q�+D/DP,/,',>0=*>0&(E0'HEDGFU*/0)0/,&(](/,UR>"N(Q�/FGP^�s,/0=0.H.(E,)D-DP�/0',>RI(>D=,>- I�G0U�ETP�/0]*/*'*>b)*ED'�>(=,&'*/0UIJ[�)6K3C*/,>6K�/�+D/P�/0',>c/0]0/*',>TK )*E('�>=�&D'*/0U

d��,�*2(z"�3q4 50p05"t35Dz3p�d�+TK3.,E(M3I>�;.*U*=D[*M*/DNFiZE"A�X"M0/(N�;^�U*/0=0.HUD/�)(/�&]*/0UR>NQ3/FG(U,EJP�>*=JA�+D/H>(.D[�II/,+(/0),>ZI"&0'0C�+D/}^�G*U0E"P�>.([ I

[(o�/0U*/F.0E0M*=0UciH.(U,=[�MD/0N S.*E0M0=0UH=D'*..,E(M3I>aiR+TK .�EM ID>�;

�(G}ITN�S0I-JA8I)0Ub'0/}78;s�=0&�I"/b'�ETK�U0/,)0>NDQ3/�;

q�+,I/�;s,/0),>"N0Q,/FiZ>(.[�I0SDE0>NDQ3/�;s,/0),>"N0Q,/��0VciR>(.D[�I(SDEJA\X&(.�;

q,'0.�&G<;/*'0.*GD-,'*)�>D&*E('<;

,PSOHPHQWLQJ�D�5HFHLYHU�7\SH�)XQFWLRQ�0RGXOH

l 5HDG�HYHQW�SDUDPHWHUVIURP�HYHQW�FRQWDLQHU

l 'HWHUPLQH�WKH�UHFHLYHUW\SH�RQ�WKH�EDVLV�RIDSSOLFDWLRQ�VSHFLILFVHWWLQJV

l 7ULJJHU�DQ�H[FHSWLRQ�RUHQG�IXQFWLRQ�PRGXOH

n If the event is triggered before the object data is written to the database, the object attributes are notavailable yet for querying, since the database is accessed when the attributes are evaluated by theBusiness Object Builder.This may occur, for example, if the event is triggered implicitly when generating the object (that is,via change documents, status management, etc.) and the object is not generated until later inupdating.

Page 135: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-21

SAP AG 1999

(YHQW�4XHXH��3UREOHP

l (YHQW�UHFHLYHUV�DUH�VWDUWHG�E\�W5)&l W5)&�SURFHVVLQJ�LV�D�FHQWUDO�FRPSRQHQW�RI�WKH�DSSOLFDWLRQ

VHUYHUl 3UREOHPV�DULVH�LI�WKHUH�DUH�

% /RWV�RI�HYHQWV% :LWK�SRVVLEO\�ORWV�RI�UHFHLYHUV

l &DXVH�RI�WKH�SUREOHP% 7KH�DPRXQW�RI�W5)&V�LQ�D�VKRUW�SHULRG�RI�WLPH

l (IIHFW% 7KH�FDOOV�DIIHFW�WKH�ZKROH�DSSOLFDWLRQ�VHUYHU

Page 136: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-22

SAP AG 1999

(YHQW�4XHXH��,GHD

l (YHQW�UHFHLYHUV�DUH�QRW�FDOOHG�GLUHFWO\l &DOO�GLVWULEXWHG�RYHU�D�ORQJHU�SHULRG�RI�WLPHl &DOO�PDGH

% %\�D�EDFNJURXQG�MRE% ,Q�GHILQHG�XQLWV% $W�SUHGHWHUPLQHG�LQWHUYDOV

n If the receivers are still started by tRFC (default), no less tRFCs are initiated than when the eventqueue is not used. But the calls are distributed over a longer period of time so the short-term systemload is reduced.

Page 137: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-23

SAP AG 1999

(YHQW�4XHXH��&RQVWUXFWLRQ

Event

Linkage tablesEvent manager Determination of

receivers

Starting ofreceivers

tRFC callEntering in

queueImmed-iately

Event queue

Event queue

Inserting

Background job

Selection

(t)RFC call start

n When an event occurs the receivers are determined

n Starting of receivers

é Directly by tRFC

é Using the queue if:

- The event queue is activated

- The event linkage allows the queue to be used

n When the queue is used

é Entry in queue

é Processing from queue by background job

é RFCs called in background by job

é tRFC not required

Page 138: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-24

SAP AG 1999

(YHQW�4XHXH��$GPLQLVWUDWLRQ

l 2YHUYLHZ�RI�WKH�VWDWXV�RI�WKH�HYHQW�TXHXHl 6HWWLQJ�WKH�EDVLF�GDWDl $FWLYDWLQJ�WKH�HYHQW�TXHXHl &RQILJXULQJ�WKH�EDFNJURXQG�MREl &RQILJXULQJ�WKH�HYHQW�GHOLYHU\l 2YHUYLHZ�RI�WKH�OLQNDJHV�ZLWK�HUURUV

Page 139: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-25

SAP AG 1999

3URFHGXUH�LQ�WKH�(YHQW�RI�(UURUV

l 6\VWHP�SUHVHWWLQJ�LQ�DFFRUGDQFH�ZLWK�WKH�EDVLF�GDWD�RIHYHQW�TXHXH�DGPLQLVWUDWLRQ

l &DQ�EH�UHGHILQHG�E\�FRQILJXULQJ�WKH�HYHQW�OLQNDJHl 3RVVLEOH�VHWWLQJV

% 'HDFWLYDWLRQ�RI�OLQNDJH% 0DUN�OLQNDJH�DV�KDYLQJ�HUURUV% 'R�QRW�FKDQJH�OLQNDJH

Page 140: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-26

SAP AG 1999

'HDFWLYDWLRQ�RI�/LQNDJH

l (YHQW�OLQNDJH�LV�GHDFWLYDWHGl $GPLQLVWUDWRU�LV�QRWLILHGl (YHQW�FDQQRW�EH�SURFHVVHG�DJDLQl /LQNDJH�LV�QRW�HYDOXDWHG�IRU�IXWXUH�HYHQWV

Page 141: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-27

SAP AG 1999

0DUN�/LQNDJH�$V�+DYLQJ�(UURUV

l (YHQW�OLQNDJH�LV�PDUNHG�DV�KDYLQJ�HUURUVl (YHQW�LV�HQWHUHG�LQ�TXHXH�ZLWK�WKH�VWDWXV��ZDLWLQJ

EHFDXVH�RI�HUURU�l $GPLQLVWUDWRU�LV�QRWLILHGl (YHQW�FDQ�EH�GHOLYHUHG�DJDLQl )XWXUH�HYHQWV�DUH�SXW�LQWR�WKH�TXHXH

Page 142: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-28

SAP AG 1999

'R�1RW�&KDQJH�/LQNDJH

l (YHQW�OLQNDJH�LV�QRW�FKDQJHGl (YHQW�LV�HQWHUHG�LQ�TXHXH�ZLWK�WKH�VWDWXV��ZDLWLQJ

EHFDXVH�RI�HUURU�l $GPLQLVWUDWRU�LV�QRWLILHGl (YHQW�FDQ�EH�GHOLYHUHG�DJDLQl )XWXUH�HYHQWV�DUH�SURFHVVHG�DV�XVXDO

Page 143: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-29

SAP AG 1999

(YHQW�4XHXH��%URZVHU

l 2YHUYLHZ�RI�HYHQWV�LQ�HYHQW�TXHXHl 5HVWULFW�GLVSOD\�XVLQJ�ILOWHUl 'HWDLOHG�GLVSOD\�RI�HYHQWV

Page 144: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-30

SAP AG 1999

(YHQW�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ�8QLW�6XPPDU\

l ([SODLQ�WKH�EDVLF�FRQFHSWV�RI�WKH�HYHQW�PDQDJHUl ([SODLQ�KRZ�DQ�HYHQW�FDQ�EH�WULJJHUHG�H[SOLFLWO\�XVLQJ

SURJUDPPLQJl ([SODLQ�KRZ�DQ�HYHQW�FDQ�EH�HYDOXDWHG�DQG�UHFHLYHGl ([SODLQ�WKH�SXUSRVH�DQG�RSHUDWLRQ�RI�WKH�HYHQW�TXHXH

Page 145: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-31

([HUFLVHV8QLW��(YHQW�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ6HFWLRQ��(YHQW�0DQDJHU

After completion of these exercises, you will be able to:

• Display the event linkage tables

• Display the event trace

• Simulate an event

You have completed your workflow definition and assigned the individualdialog steps to the correct agents. Now you want to check whether yourworkflow is started correctly via events.

1-1 Recall the effect of the entries in the type linkage table.

1-1-1 Ensure that your two workflows are correctly linked to the eventOldMaterialChanged of your object type.

1-1-2 Simulate the event OldMaterialChanged. Check the output of the simulationtool.

1-1-3 Check the event trace for entries for the event DeadlineTest for your objecttype that you had triggered in an earlier task.

Page 146: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-32

8QLW��(YHQW�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ6HFWLRQ��,PSOHPHQWLQJ�DQ�(YHQW

After completion of these exercises, you will be able to:

• Trigger an event explicitly (by programming)

• Create a check and receiver type function module

The event linkage to your workflow definitions is created correctly. Nowyou want to start workflows via an event that is triggered explicitly in anABAP program you have written.

2-1 Trigger an event explicitly.

2-1-1 Create a report =��(97&5 that calls the function moduleSWE_EVENT_CREATE, in order to trigger the event DeadlineTest foryour object type.

2-1-2 Check whether your workflow is triggered irrespective of whether you arethe last person to change the material or not.

2-2 Create a check function module to filter out irrelevant events.

2-2-1 Create a check function module=��B&+(&.B0$7(5,$/B&+$1*('%<. This function module isintended to ensure that your workflow is only started if you trigger the eventfor one of "your" materials (T-BBC##, T-FBC##) and if you are the lastperson who changed the material.Check in the function module whether the transferred material numberrepresents one of your materials and whether the object attribute ChangedByhas your login ID as a value. If this is not the case, an exception should betriggered.

2-2-2 Insert the check function module into the existing linkages from the eventOldMaterialChanged of your object type to your two workflow definitionsZ##MSIPROC1 and Z##MSIPROC2.

2-2-3 Now check whether your workflow is only triggered when you are the lastperson to change the material.

Page 147: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-33

2-3 Optional extensions: Create a receiver type function module to decide depending onruntime data which of your two workflow definitions is to be started.

2-3-1 Create a receiver type function module=��B5(&7<3(B'(7(50,1(B0$77<3(. This function moduledetermines the workflow to be started based on the material type of thetriggering object. If the object attribute MaterialType has the value ‘FERT’(finished), the workflow Z##MSIPROC1 should be started, otherwiseZ##MSIPROC2.

2-3-2 Change the type linkage table again so that the workflow to be started isnow determined via the receiver type function module for the eventOldMaterialChanged of your object type.

2-3-3 Now check whether the workflow associated with the material type of thetriggering material is started.

Page 148: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-34

6ROXWLRQV8QLW��(YHQW�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ7RSLF��(YHQW�0DQDJHU

1-1 Recall the effect of the entries in the type linkage table.

1-1-1 Ensure that your two workflows are correctly linked to the eventOldMaterialChanged of your object type.

Path (via SAP Easy Access):Tools > Business Workflow > Development > Definition Tools > Events >Event Linkages > Type Linkages

1-1-2 Simulate the event OldMaterialChanged. Check the output of the simulationtool.

Path (via SAP Easy Access):Tools > Business Workflow > Development > Utilities > Events > SimulateEvent

1-1-3 Check the event trace for entries for the event DeadlineTest for your objecttype that you had triggered in an earlier task.

Path (via SAP Easy Access):Tools > Business Workflow > Development > Utilities > Events > EventTrace > Display Event Trace

Page 149: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-35

8QLW��(YHQW�'HILQLWLRQ�DQG�,PSOHPHQWDWLRQ6HFWLRQ��,PSOHPHQWLQJ�DQ�(YHQW

After completion of these exercises, you will be able to:

• Trigger an event explicitly (by programming)

• Create a check and receiver type function module

The event linkage to your workflow definitions is created correctly. Nowyou want to start workflows via an event that is triggered explicitly in anABAP program you have written.

2-1 Trigger an event explicitly.

Solution:Z00EVTCR

Path (via SAP Easy Access):Tools > ABAP Workbench > Development > ABAP Editor

Page 150: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-36

*&----------------------------------------------------------------------*& Explicit triggering of Z00MARA.DEADLINETEST*&----------------------------------------------------------------------

REPORT Z00EVTCR.

INCLUDE <CNTN01>. " include container macros

DATA: OBJKEY LIKE SWEINSTCOU-OBJKEY, EVENTID LIKE SWEDUMEVID-EVTID.DATA: EVENT_CONTAINER LIKE SWCONT OCCURS 0 WITH HEADER LINE.

PARAMETERS: OBJTYPE LIKE SWETYPECOU-OBJTYPE DEFAULT ’Z00MARA’, MATERIAL LIKE MARA-MATNR, EVENT LIKE SWETYPECOU-EVENT DEFAULT ’DEADLINETEST’, END_DATE LIKE SYST-DATUM DEFAULT SPACE.

OBJKEY = MATERIAL.

* write parameter into event containerIF EVENT EQ ’DEADLINETEST’ AND END_DATE EQ SPACE. END_DATE = SY-DATUM + 1.ENDIF.SWC_SET_ELEMENT EVENT_CONTAINER ’LatestEndDate’ END_DATE.

CALL FUNCTION ’SWE_EVENT_CREATE’ EXPORTING OBJTYPE = OBJTYPE OBJKEY = OBJKEY EVENT = EVENT IMPORTING EVENT_ID = EVENTID TABLES EVENT_CONTAINER = EVENT_CONTAINER EXCEPTIONS OBJTYPE_NOT_FOUND = 1.

IF SY-SUBRC NE 0. WRITE : / ’Object type’, OBJTYPE, ’unknown’.ELSE. IF EVENTID NE 0. WRITE : / ’At least one receiver found’. COMMIT WORK. ELSE. WRITE : / ’No receivers found’. ENDIF.ENDIF.

Page 151: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-37

2-2 Create a check function module to filter out irrelevant events.

Solution:Z00_CHECK_MATERIAL_CHANGEDBY

Path (via SAP Easy Access):

� For the function moduleTools > ABAP Workbench > Development > Function Builder

� For the linkage between event and workflowTools > Business Workflow > Development > Definition Tools > Events >Event Linkages > Type Linkages

FUNCTION Z00_CHECK_MATERIAL_CHANGEDBY.*"----------------------------------------------------------------------*"*"Local interface:*" IMPORTING*" VALUE(OBJTYPE) LIKE SWETYPECOU-OBJTYPE*" VALUE(OBJKEY) LIKE SWEINSTCOU-OBJKEY*" VALUE(EVENT) LIKE SWETYPECOU-EVENT*" VALUE(RECTYPE) LIKE SWETYPECOU-RECTYPE*" TABLES*" EVENT_CONTAINER STRUCTURE SWCONT*" EXCEPTIONS*" OBJECT_NOT_FOUND*" INVALID_USER*" INVALID_MATERIAL*"----------------------------------------------------------------------* This check fm checks, if the user who triggered the event (USER) is* the same person who is related to the sample material and if* the material changed is really one of my sample materials.

CONSTANTS: MY_SAMPLE_MATERIAL_ROH LIKE MARA-MATNR VALUE ’200-110’, MY_SAMPLE_MATERIAL_FERT LIKE MARA-MATNR VALUE ’200-101’, MY_SAMPLE_MATERIAL_HALB LIKE MARA-MATNR VALUE ’200-100’, MY_OWN_USER LIKE SY-UNAME VALUE ’WF-BC-CLERK’.

DATA: MY_SAMPLE_MATERIALS LIKE MARA-MATNR OCCURS 3 WITH HEADER LINE. DATA: OBJECT TYPE SWC_OBJECT. DATA: CHANGER LIKE MARA-AENAM, USER_ACT LIKE SWHACTOR, USER LIKE SY-UNAME.

Page 152: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-38

* build int table with my sample materials MOVE MY_SAMPLE_MATERIAL_ROH TO MY_SAMPLE_MATERIALS. APPEND MY_SAMPLE_MATERIALS. MOVE MY_SAMPLE_MATERIAL_HALB TO MY_SAMPLE_MATERIALS. APPEND MY_SAMPLE_MATERIALS. MOVE MY_SAMPLE_MATERIAL_FERT TO MY_SAMPLE_MATERIALS. APPEND MY_SAMPLE_MATERIALS.

* check, if the triggering material is one of my materials READ TABLE MY_SAMPLE_MATERIALS WITH KEY = OBJKEY. IF SY-SUBRC NE 0. RAISE INVALID_MATERIAL. ENDIF.

* create the material object for later attribute access SWC_CREATE_OBJECT OBJECT OBJTYPE OBJKEY. IF SY-SUBRC NE 0. RAISE OBJECT_NOT_FOUND. ENDIF.

* read attribute ’ChangedBy’ from material object SWC_GET_PROPERTY OBJECT ’ChangedBy’ CHANGER. IF SY-SUBRC NE 0. RAISE OBJECT_NOT_FOUND. ENDIF.

* check if my sample user and material changer are identical IF CHANGER NE MY_OWN_USER. RAISE INVALID_USER. ENDIF.

ENDFUNCTION.

Page 153: BC610 - Workflow Development (Englisch)

© SAP AG BC610 6-39

2-3 Optional extensions: Create a receiver type function module to decide depending onruntime data which of your two workflow definitions is to be started.

Solution:Z00_RECTYPE_DETERMINE_MATTYPE

Path (via SAP Easy Access):

� For the function moduleTools > ABAP Workbench > Development > Function Builder

� For the linkage between event and workflowTools > Business Workflow > Development > Definition Tools > Events >Event Linkages > Type Linkages

FUNCTION Z00_RECTYPE_DETERMINE_MATTYPE.*"----------------------------------------------------------------------*"*"Local interface:*" IMPORTING*" VALUE(OBJTYPE) LIKE SWETYPECOU-OBJTYPE*" VALUE(OBJKEY) LIKE SWEINSTCOU-OBJKEY*" VALUE(EVENT) LIKE SWETYPECOU-EVENT*" VALUE(GENERIC_RECTYPE) LIKE SWETYPECOU-RECTYPE*" EXPORTING*" VALUE(RECTYPE) LIKE SWEINSTCOU-RECTYPE*" TABLES*" EVENT_CONTAINER STRUCTURE SWCONT*" EXCEPTIONS*" OBJECT_NOT_FOUND*"----------------------------------------------------------------------* This receiver type fm determins the process to be started by the* material type

DATA: OBJECT TYPE SWC_OBJECT. DATA: MTYPE LIKE MARA-MTART.

* create the material object SWC_CREATE_OBJECT OBJECT OBJTYPE OBJKEY. IF SY-SUBRC NE 0. RAISE OBJECT_NOT_FOUND. ENDIF.

* check material typ and set receiver type depending on value SWC_GET_PROPERTY OBJECT ’MaterialType’ MTYPE. IF MTYPE EQ ’FERT’. RECTYPE = ’WS96000011’. " Z00MSIPROC1 ELSE. RECTYPE = ’WS96000012’. " Z00MSIPROC2 ENDIF.

ENDFUNCTION.

Page 154: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-1

SAP AG 1999

:RUNIORZ�5XQWLPH�6\VWHP

l &RPSRQHQWV�DQG�DUFKLWHFWXUHl :RUN�LWHPVl 'HDGOLQH�PRQLWRULQJ�DQG�HUURU�KDQGOLQJl $GPLQLVWUDWLRQ�IXQFWLRQVl 3HUIRUPDQFH

&RQWHQWV�

Page 155: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-2

SAP AG 1999

:RUNIORZ�5XQWLPH�6\VWHP��8QLW�2EMHFWLYHV

$W�WKH�FRQFOXVLRQ�RI�WKLV�XQLW��\RX�ZLOO�EH�DEOH�WR�

l ([SODLQ�WKH�FRPSRQHQWV�RI�WKH�UXQWLPH�V\VWHP�DQGKRZ�WKH\�LQWHUDFW�LQ�D�ZRUNIORZ

l *HQHUDWH�DQG�H[HFXWH�ZRUN�LWHPV�YLD�WKH�ZRUN�LWHPPDQDJHU�$3,

l ([SODLQ�GHDGOLQH�PRQLWRULQJ�DQG�HUURU�KDQGOLQJ�DQGXVH�WKH�RSWLRQV�SURYLGHG�WR�FRQWURO�GHDGOLQHPRQLWRULQJ

Page 156: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-3

SAP AG 1999

:RUNIORZ�5XQWLPH�6\VWHP��8QLW�2EMHFWLYHV����

$W�WKH�FRQFOXVLRQ�RI�WKLV�XQLW��\RX�ZLOO�EH�DEOH�WR�

l 8VH�WKH�DGPLQLVWUDWLRQ�IXQFWLRQV�RI�WKH�UXQWLPHV\VWHP

l $YRLG�PRGHOLQJ�DQG�FRQILJXUDWLRQ�VHWWLQJV�WKDWXQQHFHVVDULO\�VORZ�GRZQ�WKH�UXQWLPH�V\VWHP

Page 157: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-4

SAP AG 1999

7DVN7DVNGHILQLWLRQGHILQLWLRQ

:RUNIORZ:RUNIORZGHILQLWLRQGHILQLWLRQ

DefinitionSystem

2EMHFWPDQDJHU

:RUN�LWHPPDQDJHU

:RUNIORZ�PDQDJHU

RuntimeSystem

FUHDWH

$SSOLFDWLRQ$SSOLFDWLRQ

:RUNIORZ�5XQWLPH�6\VWHP���2YHUYLHZ

H[HFXWH

LQYRNH UHVXOW

UHVXOW UHVXOW

UHVXOW

UHVXOW

%25%25

(YHQWPDQDJHU(YHQW

PDQDJHU

n The workflow manager (WFM) reads the workflow definition and the step definition and creates onework item (WI) per step using the work item manager (WIM). The WFM is then finished.

n The WIM manages the WI and triggers the application via the object manager (OM).

n If the underlying method is synchronous, the result and the export parameters of the method arereturned to the WIM via the OM.If the underlying method is asynchronous, the result of the method is returned to the WIM via anevent that is triggered in the event manager (EM). This event must be defined as a "terminatingevent" for the step.

n After receiving the return parameters, the WIM checks the return code and, if successful, returns thedata to the WFM.

n This loop continues until the end of the workflow is reached.

n Event creator, conditions, process control and container operations are executed locally in the WFMwithout a work item being created.

Page 158: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-5

SAP AG 1999

:RUNIORZ�0DQDJHU��7DVNV

l &RQWURO�H[HFXWLRQ�RI�WKH�ZRUNIORZ�GHILQLWLRQl 'DWD�WUDQVIHU�EHWZHHQ�LQGLYLGXDO�VWHSV�RI�D�ZRUNIORZ

GHILQLWLRQl 3URYLGH�LQLWLDO�GDWD�IRU�D�ZRUNIORZl 'HDGOLQH�FDOFXODWLRQ�IRU�VWHSV�LQ�D�ZRUNIORZ

GHILQLWLRQl 5ROH�UHVROXWLRQ�RQ�VWHS�OHYHOl ([HFXWLRQ�RI�FRQWDLQHU�RSHUDWLRQV��SURFHVV�FRQWURO

DQG�HYHQW�FUHDWRUVl (YDOXDWLRQ�RI�FRQGLWLRQV

Page 159: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-6

SAP AG 1999

:RUNIORZ�0DQDJHU��:RUNIORZ�/RJ

l 5HFRUG�WKH�ZRUNIORZ�H[HFXWLRQ�SURFHVV�� Work items: when created/processed/done� Process: branches, loops, start/end of forks, subworkflows

l 6WDWXV�RI�ZRUNIORZ�H[HFXWLRQl /RJ�RSHUDWLRQV�RQ�WKH�ZRUNIORZ�

� Stop/continue process� Abort work item/whole process

l (QWU\�SRLQW�IRU�WURXEOHVKRRWLQJ

Page 160: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-7

SAP AG 1999

:RUN�,WHP�0DQDJHU��7DVNV

l &RQWURO�SURFHVVLQJ�RI�LQGLYLGXDO�VWHSV�LQ�D�ZRUNIORZGHILQLWLRQ

l 0RQLWRU�GHDGOLQHV�IRU�LQGLYLGXDO�VWHSV�LQ�D�ZRUNIORZGHILQLWLRQ

l $VVLJQ�DJHQWV�IRU�LQGLYLGXDO�VWHSV�LQ�D�ZRUNIORZGHILQLWLRQ

l /RJ�DOO�DFWLYLWLHV�H[HFXWHG�RQ�D�VWHS�LQ�D�ZRUNIORZGHILQLWLRQ

l 5HVROYH�GHIDXOW�UROH

n A work item (WI) is created for every activity in a workflow.

n Processing is monitored using the individual WI statuses. The processing sequence is determined bythe statuses and the possible transitions. The WI is also locked during processing using the individualstatuses.

n Deadlines are monitored using the background job SWWDHEX and the report RSWWDHEX (seebelow).

n For precise evaluation of the agent assignment, refer to the unit "Roles".An agent who is not a possible agent for the task underlying the WI never receives the WI in theirBusiness Workplace, even if they were the result of a role resolution.

n All the activities executed by a user are logged with the WI. There is therefore a complete processinghistory for each WI.

n During execution, all secondary methods are started as well as the method from the task. Secondarymethods run in a separate session.

n Before the method from the task is executed, the before methods are executed in an arbitrarysequence. After the main method has been executed, the after methods are executed in an arbitrarysequence.

Page 161: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-8

SAP AG 1999

:RUN�,WHP�7\SHV

l $���:RUN�TXHXH�ZRUN�LWHPl %���%DFNJURXQG�ZRUN�LWHPl &���&RQWDLQHU�OLQNDJH�ZRUN�LWHPl '���0LVVHG�GHDGOLQH�ZRUN�LWHPl (���:DLW�VWHS�ZRUN�LWHPl )���:RUNIORZ�ZRUN�LWHPl 5���:HE�ZRUN�LWHPl :���'LDORJ�ZRUN�LWHP

n A work queue work item is a "logical unit" of objects and tasks that are to be executed together. Bothobjects and tasks can be different.

n A background work item is used to execute tasks that do not require dialog. They are executedautomatically by the WF runtime system and do not appear in the Business Workplace.

n A container linkage work item serves as a logical relationship between several associated objects. Itcorresponds to the assignment table from WF21. A container linkage does not possess any semanticsof its own and never appears in the Business Workplace.

n A missed deadline work item is created by default when the WF system detects that a monitoreddeadline has been missed.

n A wait step work item receives events created externally or by other WIs. A wait step has noprocessing logic and does not appear in the Business Workplace.

n A workflow work item represents a workflow to be processed, the definition of which is thenprocessed by the WFM.

n A Web work item represents a Web activity.

n A dialog work item represents a step in a WF, which is to be executed by a user.

Page 162: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-9

SAP AG 1999

:RUN�,WHP�/DQJXDJH

l (DFK�ZRUN�LWHP�KDV�D�ODQJXDJHl 7KH�ODQJXDJH�RI�D�ZRUN�LWHP�LV�GHULYHG�IURP�WKH

ODQJXDJH�RI�WKH�VXSHURUGLQDWH�ZRUNIORZl 7KH�ZRUNIORZ�ODQJXDJH�FDQ�EH�VHW�GXULQJ�FUHDWLRQl 7KH�ODQJXDJH�RI�DQ�HYHQW�FDQ�EH�VHW�DV�D�GHIDXOW

SDUDPHWHU

n The WI language determines the language of the short text and the status texts. The language of thelong text is determined by the user’s logon language.

n When a workflow is started via an event, the language of the event is passed on to the workflow.

n Under "Personal workflow settings" in the Business Workplace, the user can set whether his or herwork items in the Business Workplace always appear in the logon language. In this case, all WI textsare put into the user’s current logon language when the Business Workplace is compiled. This settingreduces performance considerably, however.

Page 163: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-10

SAP AG 1999

l :$,7,1* ��ZDLWLQJl 5($'< ��UHDG\l 6(/(&7(' ��UHVHUYHGl 67$57(' ��LQ�SURFHVVl &200,77(' ��H[HFXWHGl (5525 ��HUURUl &203/(7(' ��FRPSOHWHGl &$1&(//(' ��ORJLFDOO\�GHOHWHG

:RUN�,WHP�6WDWXV

n A WI has the status WAITING if its requested start has not yet been reached. With this status itcannot be seen by any user.

n A WI with status READY appears in the Business Workplace of the recipients. WIs running in thebackground with this status are executed immediately.

n The status SELECTED only applies to dialog and work queue work items. It means that the WI hasbeen reserved by one of the recipients and therefore disappears from the Business Workplace of theothers.

n When the underlying method has been started but not yet completed, the WI has the statusSTARTED. The WI remains in the Business Workplace of the current agent.

n If the underlying method has been executed successfully but the WI has to be set to ’done’ manually,it has the status COMMITTED.

n If, during execution of the method, a return code not modeled in the related workflow was returnedor irreparable damage occurred in the WIM, the WI is assigned the status ERROR.

n If processing of the WI has been completed successfully, it is assigned the status COMPLETED.

n If the WI is no longer required within the flow logic of the workflow, it is assigned the statusCANCELLED.

Page 164: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-11

SAP AG 1999

&DQFHOOHG

6HOHFWHG

5HDG\ 6WDUWHG

&RPPLWWHG

&RPSOHWHG:DLWLQJ

(UURU

6WDWXV�7UDQVLWLRQV

n Not all work item types can assume all statuses (for example, SELECTED only for dialog and workqueue work items, COMMITTED only for dialog work items).

n The start statuses are WAITING or READY.

n The end statuses are CANCELLED or COMPLETED.

n The change from one status into another always happens implicitly on the basis of an executedactivity (for example, "reserve" in the Business Workplace).

Page 165: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-12

SAP AG 1999

l &UHDWH�D�ZRUN�LWHP6::B:,B&5($7(�B6,03/(�

l ([HFXWH�D�ZRUN�LWHP6::B:,B:,7+287B:/&B(;(&87(

l 6WDUW�D�ZRUN�LWHP��FUHDWH�DQG�H[HFXWH�LPPHGLDWHO\�6::B:,B67$57�B6,03/(�

l *HQHUDO�$3,�IXQFWLRQV)XQFWLRQ�JURXS�6::$

:,0�$3,���)XQFWLRQ�0RGXOHV

n Important: the function modules in the function group SWWA are not officially released externally,meaning that their interface may change. However, all efforts are being made to keep enhancementsupwardly compatible.Only the function module WORKITEM_ARCHIVE_OBJECT for archiving a work item is officiallyreleased.

n When a work item is started or created, the caller must first fill the task container with the inputparameters of the task according to the task definition.The caller must also incorporate error handling measures if the WI cannot be created or started.

n Before a work item is executed, the caller must check whether all the prerequisites for executionhave been fulfilled (for example, is the current user permitted to execute the WI).

n All administration function modules (SWW_WI_ADMIN_*), for example, are in the SWWAfunction group.

n All function modules of the SAP WAPI interface can also be used (SAP_WAPI_*). These are infunction groups SWRC and SWRR.

Page 166: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-13

SAP AG 1999

6$3�:$3,�)XQFWLRQ�0RGXOHV

l )XQFWLRQ�JURXS�6:5&)XQFWLRQ�PRGXOHV�IRU�SURFHVVLQJ�WKH�ZRUNOLVW�RI�D�XVHU

l )XQFWLRQ�JURXS�6:5,)XQFWLRQ�PRGXOHV�IRU�VHOHFWLQJ�ZRUN�LWHPV�DFFRUGLQJ�WRYDULRXV�FULWHULD��H�J��IRU�UHSRUWLQJ�DQG�DQDO\VLV�

l )XQFWLRQ�JURXS�6:55)XQFWLRQ�PRGXOHV�IRU�VWDUWLQJ�D�ZRUNIORZ�RU�IRU�WULJJHULQJDQ�HYHQW

n SAP WAPI is an SAP-specific API based on the interface definitions of the Workflow ManagementCoalition.

n The SAP WAPI function modules call again the function modules internally from SWWA. Thefunctionality is the same, but the interface is different.

n If possible, the function modules from SWRI should be used instead of direct table access (e.g. totables SWWWIDEADL and SWWWIRET) for work item selection within analysis and reporting.

Page 167: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-14

SAP AG 1999

l 5HOHDVHG�KHDGHU�GDWD9LHZ�6::938%/,&

l 'HDGOLQH�GDWD7DEOH�6:::,'($'/

l 5HWXUQ�GDWD�IURP�PHWKRG�H[HFXWLRQ7DEOH�6:::,5(7

l 2EMHFWV�LQ�ZRUN�LWHP�FRQWDLQHU7DEOH�6::B&2172%

l 1RQ�REMHFWV�LQ�ZRUN�LWHP�FRQWDLQHU7DEOH�6::B&217

:,0�$3,���7DEOHV

n The entire header data is located in the table SWWWIHEAD. The view SWWVPUBLIC containsthe elements that are available for general selection and do not represent internal administrative dataof the WIM.

n Changes to the structure of the SWWVPUBLIC view are only upward compatible. The structures ofthe remaining tables and others are not guaranteed. If data of a known work item is to be read, thefunction modules SWW_WI_HEADER_READ, SWW_WI_DEADLINES_READ andSWW_WI_RETURN_READ from the SWWA function group should be used (or as of 4.5A,SWW_WIS_*_READ, if the data from several work items is to be imported).

n If the container of a known work item is to be read, the function moduleSWW_WI_CONTAINER_READ in the function group SWWA should always be used.

n Non-objects in the work item container include scalar values (char, integer) and structures.

n Changes to work items must never be made by direct table changes, but always via the functionmodules in the function group SWWA.

Page 168: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-15

SAP AG 1999

l 5XQWLPH�KDQGOHV��5+V�� Used in BOR� Valid during runtime of creating program

l 3HUVLVWHQW�REMHFW�UHIHUHQFHV��325V�� Used in workflow� Can be saved in the database

2EMHFW�5HIHUHQFHV

n The BOR only recognizes RHs (for example, as a result of macro SWC_CREATE_OBJECT, asinput for method calls, and so on). An RH is only valid during the runtime of the creating programand expires immediately afterwards.

n This is not sufficient for the workflow, since there may be program changes or several days betweenthe individual steps. For this reason, there must also be a persistent presentation. This presentation isvisible, for example, when you look at the work item container.

n All BOR macros expect an RH; all workflow FMs expect PORs.

n The workflow ensures correct conversion automatically. An explicit conversion is always necessarywhen you write your own FMs that are called on the interface between the workflow system and theBOR (for example, check FMs in the event manager).The explicit conversion takes place using the macros SWC_CONTAINER_TO_RUNTIME andSWC_CONTAINER_TO_PERSISENT from the include <cntn01>.

Page 169: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-16

SAP AG 1999

5XQWLPH�KDQGOH

5XQWLPH�KDQGOH

5XQWLPH�KDQGOH

5XQWLPH�KDQGOH

3HUVLVWHQWREMHFW�UHIHUHQFH

3HUVLVWHQWREMHFW�UHIHUHQFH

3HUVLVWHQWREMHFW�UHIHUHQFH

�������������� ����

5)&:)

:)

:)

:)

%25�$SSOLFDWLRQ

%25�$SSOLFDWLRQ

%25�$SSOLFDWLRQ

(YHQW�0DQDJHU�������� ����������������� "! ����#����

2EMHFW�5HIHUHQFHV�LQ�WKH�:RUNIORZ�&RQWH[W

n User-controlled conversion is always necessary when the caller requires a different type ofpresentation than the current one.

n With every user-controlled conversion, the caller must ensure that a "re-conversion" takes placeafterwards, since the original presentation is expected again in the subsequent context.

n When a workflow is started directly via the API, the RHs created in the program using the BORmacros must also be converted to PORs before SWW_WI_CREATE (or SWW_WI_START) iscalled.

Page 170: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-17

SAP AG 1999

8VHU�'HILQHG�:RUN�,WHP�'LVSOD\

l $GGLWLRQDO�WDE�LQ�WKH�ZRUN�LWHP�GLVSOD\l 6XEVFUHHQ�FRQWDLQV�LWV�RZQ�IORZ�ORJLFl 6XEVFUHHQ�FRPPXQLFDWHV�ZLWK�VXSHURUGLQDWH�ZRUN

LWHP�GLVSOD\

n Process or step-specific data can be displayed on the additional tab.

n The user-defined tab is never visible in processing chains, since the object method underlying thestep is executed immediately.

Page 171: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-18

SAP AG 1999

5HIHUHQFH�LQ�WKH�6WHS�'HILQLWLRQ

Enter your subscreen

n The screen entered must be defined as a "subscreen".

Page 172: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-19

SAP AG 1999

)ORZ�/RJLF�RI�WKH�6FUHHQ

l ,QLWLDOL]LQJ�WKH�GDWD�IRU�3%2l 6WDWXV�GHSHQGHQW�UHIUHVKLQJ�RI�WKH�GDWD�IRU�3%2��RSWLRQDO�l 5HDFWLRQ�WR�2.�&RGH�IRU�3$,

� (LWKHU'LUHFW�SURFHVVLQJ�LQ�WKH�VXEVFUHHQ

� 2U7UDQVIHU�RI�WKH�2.�FRGH�WR�WKH�VXSHURUGLQDWH�:,�VWDQGDUG�VFUHHQ

n The programming is carried out via macros from the <widisp> include. This include must beincluded in the module pool.

n The online documentation contains complete documentation on the macro.

Page 173: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-20

SAP AG 1999

,QLWLDOL]LQJ�WKH�6FUHHQ�IRU�3%2

4XHU\�WKH�LQLWLDO�UXQ

6HW�WKH�WLWOH

4XHU\�WKH�DVVRFLDWHG�:,�,'

4XHU\�WKH�DVVRFLDWHGDSSOLFDWLRQ�REMHFW

5HDG�WKH�DWWULEXWHV�RI�WKHDVVRFLDWHG�DSSOLFDWLRQREMHFW

n The SAP_WAPI_* function modules implement the WfMC Interface 2 and are in the SWRCfunction group.

n SAP_WAPI_GET_OBJECTS returns the leading object as a POR. A transformation to an RH must,therefore, take place before the BOR macro is called by callingSWC_OBJECT_FROM_PERSISTENT.

n To use the BOR macro, the include <cntn01> must be incorporated.

Page 174: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-21

SAP AG 1999

5HDFWLRQ�WR�2.�&RGH�IRU�3$,

$&%('�)�*,+.-(',/&021�354�'

6 )87�9�:�;8'�)5+<-(',/&0=1�3>4�'?+@3A+.-(':5%CB('�)83D)84FEG9(7�+�'&HJI�:�1�)K'('�9

L )8351�'�:(:M+<-('&/,0=1�3C4�'4FEG)K'(1�+ON *

P '�N '�+K'&+.-(',/&021�354�'

n The online documentation contains the complete list of IDs for transferring the OK codes.

Page 175: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-22

SAP AG 1999

5XQWLPH�'LVSOD\

Q�P 7�+87?;83F)RB5)83C1�'�:�: Q +K75STE :E�9�:U'5)�+V'�4W;K3F)>:5B('U1�E ;.E 1M:�+V'�BU:

1(1�'�:U:M+83A:(+K'5B�X�:>B('(1�E ;@E 13FS�Y8'(1�+>7�+�+.).E�SC%�+K'�:

1(1�'�:U:M+83A;<%59U1�+OE�3F9�:TEG9M+.-U'Z 3")O[&E +V'U\]4FE :5B5N 7�*

n The "Data for process" is always displayed as the first tab.

n The "Resubmit approval" button is mapped to OK code 0002.The "Add attachment" button is mapped to OK code 0018.The "Display application" button is handled directly using the SHOW_FORM form.

Page 176: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-23

SAP AG 1999

'HDGOLQH�0RQLWRULQJ

l 0RQLWRULQJ�IRXU�GHDGOLQHV� Requested start (resubmission)� Latest start� Requested end� Latest end

l 0RQLWRULQJ�DOO�GHDGOLQHV�XVLQJ�D�EDFNJURXQG�MRE� Either periodically on a regular basis� Or only as required (default)

n All deadlines are monitored using the background job SWWDHEX with job class A. The job callsthe report RSWWDHEX.

n You can choose between deadline monitoring on an individual or on a periodic basis. Individualmonitoring is active by default.

n With individual monitoring, the background job is rescheduled for the next deadline to be monitoredand is updated if a new deadline is entered for a WI that is sooner than any others. The backgroundjob therefore, only runs if it is really needed.Important: if the background job aborts for any reason, it must be rescheduled by starting the abovereport.

n This procedure is not economical for monitoring a large number of deadlines. In this case, youshould switch to periodic deadline monitoring (for example, every three minutes).

n You can switch between the two monitoring types at any time via SWWA or using the reportRSWWDHIN.

Page 177: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-24

SAP AG 1999

'HDGOLQH�0RQLWRULQJ�,QKHULWDQFH

l 'HDGOLQH�GDWD�DQG�PRQLWRULQJ�DFWLYLW\�LQKHULWHG�E\GHSHQGHQW�ZRUN�LWHPV�IURP�ZRUNIORZ

l 'HILQLWLRQ�RI�PRQLWRULQJ�DFWLYLW\�IRU�GHSHQGHQW�ZRUNLWHP�RYHUZULWHV�LQKHULWDQFH

l &KHFN�GHDGOLQH�GDWD�LQ�GHSHQGHQW�ZRUN�LWHP�DJDLQVWLQKHULWHG�GHDGOLQHV

n Inheritance only applies on creation of the subordinate work item. Subsequent changes to data in thesuperordinate workflow are not passed on to existing dependent work items.

n Every change in the data in the dependent work item is checked against the superordinate workflow.It is not possible to postpone beyond the inherited deadlines.

Page 178: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-25

SAP AG 1999

'HDGOLQH�0RQLWRULQJ���6SHFLDO�6LWXDWLRQV

l 0DQ\�GHDGOLQHV6ZLWFK�IURP�VLQJOH�FDVH�EDVHG�WR�SHUPDQHQW

l 6HYHUDO�LQVWDQFHV�RI�6::'+(;�'HOHWH�DOO�LQVWDQFHV�YLD�MRE�RYHUYLHZ

�����5HVFKHGXOHl 1R�LQVWDQFHV�RI�6::'+(;

&KHFN�VHOHFWLRQ�IRU�MRE�RYHUYLHZ5HVFKHGXOH

n SWWDHEX is rescheduled via transaction SWWB.

n When many deadlines are to be monitored, a conflict may arise with background jobSAP_REORG_JOBS. In this case, deadline monitoring should be suppressed whileSAP_REORG_JOBS is running.

n When displaying background jobs in the job overview, remember that this is a cross-client display.You should therefore check whether the background jobs displayed are actually scheduled in thecurrent client.

Page 179: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-26

SAP AG 1999

(UURU�VLWXDWLRQ (UURU�FRUUHFWLRQ

:, (5525�

),

(5525

:, &RUUHFWLRQ�

), (UURU�5HVWDUW

(UURU�5HVWDUW��

� �

(UURU�+DQGOLQJ

n Error situation

1) The status of the work item changes to ERROR.

2) The error is propagated to the superordinate workflow.

3) The status of the superordinate workflow also changes to ERROR.

n Error correction

1) The work item is corrected (for example, by correcting the work item container).

2) A "restart after error" is executed on the superordinate workflow.

3) The superordinate workflow propagates the restart to the work item.

4) A "restart after error" is executed on the work item implicitly.

n When an error occurs, it is propagated "bottom up" to all superordinate workflows.

n To correct the error, the WI is first repaired locally.

n Then the workflow is restarted from the top down and all work items belonging to the workflow arealso restarted. The restart must always be performed at the highest level workflow, and never fromthe WI with the error.

n Work items with errors should not be restarted with SM58 (prior to 4.0A), since steps alreadyexecuted may be executed a second time.

n All correction actions on work items should be performed with great caution to avoid side effects.

Page 180: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-27

SAP AG 1999

7HPSRUDU\�HUURU 1RQ�WHPSRUDU\HUURU

%DFNJURXQGZRUN�LWHPV:RUNIORZZRUN�LWHPV

67$57('�VWDWXV�UHVWDUW�ZLWK6::(55(

(5525�VWDWXV�VHQG�DQHUURU�PDLO�WR:)�DGPLQLVWUDWRU

'LDORJZRUN�LWHPV

67$57('�VWDWXV�H[HFXWHG�DJDLQE\�WKH�XVHU

(5525�VWDWXV�:,�UHPDLQV�LQ%XVLQHVV�:RUNSODFHRI�WKH�XVHU

%HKDYLRU�:LWK�8QPRGHOHG�(UURUV

n Behavior with unmodeled errors

n The method definition determines whether an error is temporary or not.

n The background activities are monitored by the job RSWWERRE.

n The status of background work items and workflow work items changes to ERROR after the nthunsuccessful execution.

Page 181: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-28

SAP AG 1999

6::(55( 6::'+(;7ULJJHU$FWLRQ

:RUN�LWHP�VWDWXV 'HDGOLQH�GDWD3UHGHILQHG�DFWLRQ�WULJJHU�YLD�W5)&

3UHGHILQHG�RU�XVHU�GHILQHG�DFWLRQ��WULJJHU�YLD�W5)&

-RE -RE�FODVV�&�SHULRGLF�MRE

-RE�FODVV�$�VHOI�VFKHGXOLQJ�MRE

,QWHUYDO &RQILJXUDEOH &RQILJXUDEOH�RUGHSHQGHQW�RQ�GHDGOLQHV

$XWKRUL]DWLRQ 1RUPDO�DXWKRUL]DWLRQFKHFN

&KHFNGHDFWLYDWHG

6FKHGXOLQJ &XVWRPL]LQJ�RUDXWR�FXVWRPL]LQJ

&XVWRPL]LQJ�RUDXWR�FXVWRPL]LQJ

(UURU�+DQGOLQJ���'HDGOLQH�0RQLWRULQJ

n Neither job allows real-time control since background jobs that are running are not interrupted.

Page 182: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-29

SAP AG 1999

:RUN�,WHP�0DQDJHU��/RJJLQJ

l :ULWH�WHPSRUDU\�ORJ�HQWU\�IRU�DOO�XVHU�DFWLYLWLHV�LIVXFFHVVIXO

l :ULWH�WHPSRUDU\�ORJ�HQWU\�IRU�DOO�DFWLYLWLHV�LI�HUURUVRFFXU

l :ULWH�SHUPDQHQW�ORJ�HQWU\�DIWHU�H[SOLFLW�LQVWUXFWLRQ

n Initially, only temporary log entries are written to a buffer so that the commit logic of the caller isnot destroyed.

n A log entry is written for all activities that can be triggered by a user (including) via the userinterface, if successful (FM SWW_WI_LOG_WRITE_SUCCESS).

n A log entry is always written if an error occurs so that the call hierarchy can be traced to the point oferror (FM SWW_WI_LOG_WRITE_EXCEPTION).

n The function module SWW_WI_LOG_FLUSH must be called before the database commit, so thatthe temporary log entries can be written from the buffer to the database.

n If work items are created via the WIM API (or, more generally, the work items are controlled via theWIM API) and the commit is controlled by the creator (that is, the parameter DO_COMMIT was setto SPACE), the creator must call the function module SWW_WI_LOG_FLUSH before commitwork. In all other cases, the call is performed by the workflow runtime system.

Page 183: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-30

SAP AG 1999

:RUN�,WHP�$GPLQLVWUDWLRQ

l ,QLWLDWH�ZDLWLQJ�:,Vl 5HOHDVH�UHVHUYHG�:,Vl 5HVWDUW�D�:,�DIWHU�HUURUVl /RJLFDO�GHOHWLRQ�RI�D�:,l ([SOLFLW�VXFFHVVIXO�FRPSOHWLRQ�RI�D�:,

n All administrator FMs are checked with regard to authorization. They are used to process a WI inexceptions.Note: the necessary authorizations are contained in the authorization profile S_WF_WF_ADMIN.

n When a waiting WI is initiated, its status is changed from WAITING to READY. This function canbe executed if deadline monitoring is not running due to overloading of the background queue or anerror in the background system.

n The status of the WI is changed from SELECTED or STARTED to READY again. This function canbe used in order to make a WI that is blocked by an absentee visible for other recipients.

n When restarting after an error, the status of the WI is changed from ERROR to STARTED, theunderlying method may be executed automatically.

n Logical deletion changes the status of the WI to CANCELLED.

n The system administrator for WF can explicitly change the status of a WI to COMPLETED, but isresponsible for filling the container of the WI with the expected return parameters of the methodbeforehand.

Page 184: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-31

SAP AG 1999

:RUN�,WHP�0DQDJHU��$V\QFKURQRXV&RPPXQLFDWLRQ

l 5HTXLUHG�IRU�WUDQVLWLRQ�IURP�GLDORJ�WR�EDFNJURXQGSURFHVVLQJ

l 8VH�RI�WUDQVDFWLRQDO�5)&��W5)&�l 0DLQWHQDQFH�RI�ORJLFDO�GHVWLQDWLRQ

:25.)/2:B/2&$/�B�&OQW!�UHTXLUHG

n tRFC is a Basis component (CALL FUNCTION ... IN BACKGROUND TASK). The FM called istriggered after the next SAP Commit (see unit on events).

n The logical destination WORKFLOW_LOCAL<Clnt> is maintained for the WF runtime systemwithin Customizing via the transaction SWUB. The user entered there must have all authorizationsand should therefore, for security reasons, be a background user.Important: If the password of this user is changed within user administration, this change must alsobe made in SWUB.Important: The logical destination WORKFLOW_LOCAL<Clnt> cannot be maintained via thetransaction SM59.

n The tRFCs issued are logged until they are executed. If execution is successful, these entries aredeleted. If an error occurs during execution, this is also recorded in the log.Only up to 3.1G: The log can be viewed via SM58. It is accessed with the name of the user whocalled the tRFC. For the WF system, it is normally the user who is entered in the destinationWORKFLOW_LOCAL_<Clnt>.

n There is another access possibility from the workflow development environment via "RFC monitor".

Page 185: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-32

SAP AG 1999

)LQGLQJ�:RUN�,WHPV

l 6HOHFWLRQ�UHSRUW�IRU�ILQGLQJ�ZRUN�LWHPV� ID� Work item type� Status� Task

l 'LVSOD\�DQG�FKDQJH�ZRUN�LWHPV�RI�DOO�W\SHV

n After the work item has been selected, the users can change and/or process the work item if they areassigned to the underlying task via the task profile and the work item is not already reserved byanother recipient.

n If the work item is not task-based (for example, wait steps, work queues, and so on), the user canchange and/or process it if it is not already reserved by another recipient.

Page 186: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-33

SAP AG 1999

:RUNIORZ�'LDJQRVLV�7RRO

l $FFHVV�WR�ZRUNIORZ�DQG�ZRUN�LWHP�GHEXJJLQJ� Verification of workflow Customizing� Problem: Task not started� Problem: Workflow hanging� Test environment (special test tools)

l &RQWH[W�VHQVLWLYH�GLDJQRVLV�RI�ZRUNIORZ�LQVWDQFHV

n Access either via Utilities in the workflow development environment or directly via the transactionSWUD.

n All the tools and procedures that will be described in detail can be executed via this tool.

n Problems triggering events can also be investigated via this tool.

Page 187: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-34

SAP AG 1999

:RUN�,WHP�'HEXJJLQJ

l :RUNIORZ�ORJ�HYDOXDWLRQl :RUNIORZ�WUDFH�HYDOXDWLRQ

n The workflow log is always written and cannot be switched off. It follows the database commit andwrites to the database.

n The workflow trace must be switched on explicitly. It is not dependent on the database commit andwrites to the file system of the application server.

n The workflow trace is helpful with regard to problems in background work items or binding.

Page 188: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-35

SAP AG 1999

7URXEOHVKRRWLQJ���6WDUWLQJ�D�:RUNIORZ

l :RUNIORZ�GRHV�QRW�VWDUW� Check the Customizing settings� Check event trace for initiator� Check event linkage (exists and active)� Check tRFC log under initiator’s login� Check tRFC log under user’s login from

WORKFLOW_LOCAL_<Clnt>� Check workflow definition (active version)

n The consistency check for Customizing must be carried out before you first work with SAP BusinessWorkflow.

n Note: Linkages with errors are deactivated automatically and a mail is sent to the systemadministrator for workflow.

Page 189: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-36

SAP AG 1999

7URXEOHVKRRWLQJ���:RUN�,WHP�&DQQRW�%H�)RXQG

l :RUN�LWHP�LV�QRW�LQ�WKH�%XVLQHVV�:RUNSODFH� Check whether work item created correctly (see above)� Search for work item via work item selection� Check agent assignment via task profile and step definition� Check role definition and/or role function module

n The buffer for organizational assignments may have to be refreshed.

Page 190: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-37

SAP AG 1999

7URXEOHVKRRWLQJ���:RUN�,WHP�1RW�LQ�(QG�6WDWXV

l :RUN�LWHP�FDQQRW�EH�FRPSOHWHG� Workflow log check

w Application or temporary error� If background step, check via report RSWWERRE� Check whether the system administrator for workflow has

received mail� If asynchronous step, check event instance linkage� Initiate test execution� Check container contents

n A breakpoint should be set in the method implementation before the "test execution".

n If the instance linkage table is filled correctly, the terminating event can also be triggered via theworkflow development environment for test purposes.

Page 191: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-38

SAP AG 1999

7URXEOHVKRRWLQJ���:RUNIORZ�+DQJLQJ

l :RUN�LWHP�FRPSOHWHG�EXW�ZRUNIORZ�QRW�FRQWLQXLQJ^ Workflow log check

w Preceding step completed correctly

w Status transition implemented correctly

w No waiting for event in a parallel branch

w Work item for next step created correctly^ Check whether step task is locked against instantiation^ Check whether the system administrator for workflow has

received mail^ Search for created work item (see above)

Page 192: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-39

SAP AG 1999

$UFKLYLQJ�DQG�'HOHWLQJ�:RUN�,WHPV

l 'HOHWH�LQ�WHVW�V\VWHP�XVLQJ�UHSRUWV�56:::,'(�DQG56::+,'(

l 'HOHWH�LQ�SURGXFWLRQ�V\VWHP�RQO\�XVLQJ�DUFKLYLQJREMHFW�:25.,7(0

n Reports RSWWWIDE and RSWWHIDE are only intended for internal use. The work items aredeleted from the database without further query or authorization check. They can be started throughthe Administration menu in the workflow development environment.The reports should always be called with the "display only" indicator set first to check them. Theactual deletion should then be performed using a background job.

n Workflow work items automatically delete their dependent work items as well.

n In a production system, the work items must be archived before they are deleted (transaction SARA).The contents of the archive files can be deleted afterwards.

n Archived work items can be read, but not reloaded for security reasons. The read program must bewritten individually by the customer. An example program is supplied by SAP (RSWWARCR).

n Other archiving objects can also archive work items using the archiving class WORKITEM. Workitems cannot, however, be deleted in this manner for reasons of data consistency.

n Container linkage work items should be deleted using the report RSWWCIDE.

Page 193: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-40

SAP AG 1999

5HDG�$UFKLYHG�:RUN�,WHPV

l 5HDG�SURJUDP�56::$5&5^ Sequential reading of the entire archive^ Template for own read programs

l 5HDG�SURJUDP�56::$5&3^ Read a process for a particular object^ Workflow log formatting

n RSWWARCR can be used as a template for user-defined programs. The user source code beginsafter calling the function module SWW_WI_LIST_ARCHIVED_READ, which imports the wholearchive to internal tables. The tables contain all processes in a depth-first storage format.

n RSWWARCP is a special case of a self-written read program. It searches for the associated processfor a particular application object and restructures the workflow log for this process (as far aspossible).

n The archive data cannot be reloaded to the original WI tables, since the runtime system reuses theWI numbers (i.e. data could be overwritten when reloaded).

Page 194: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-41

SAP AG 1999

5HSRUW�56:::,'( $UFKLYLQJ�REMHFW:25.,7(0

3RVVLEOH�LQ�HYHU\�VWDWXV 2QO\�SRVVLEOH�LQ�&203/(7('RU�&$1&(//('�VWDWXV

'LUHFW�VWDUW�ZLWKRXWDXWKRUL]DWLRQ�FKHFN

$XWKRUL]DWLRQ�FKHFN�XVLQJWUDQVDFWLRQ�6$5$

'LUHFW�GHOHWLRQ�IURPGDWDEDVH

$UFKLYLQJ�DQG�GHOHWLQJLQ�WZR�VHSDUDWH�VWHSV

([HFXWLRQ�LQ�GLDORJ�RULQ�EDFNJURXQG

([HFXWLRQ�LQ�EDFNJURXQGODWHU

/RJ�GDWD�QRW�GHOHWHG /RJ�GDWD�DOVRDUFKLYHG�DQG�GHOHWHG

&RPSDULVRQ�$UFKLYLQJ���'HOHWLQJ

n WI data must never be deleted directly in tables, only using the function moduleSWW_WI_DELETE.

n Large amounts of data should always be deleted in background processing.

n Report RSWIWADO can be used to determine the requirement for archiving/deleting.

n If only the workflow log is to be deleted, report RSWWHIDE can be used for this.

Page 195: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-42

SAP AG 1999

,PSURYLQJ�3HUIRUPDQFH���W5)&

l 5HSODFH�UHDGLQJ�FDOFXODWLQJ�EDFNJURXQG�PHWKRGVZLWK�YLUWXDO�DWWULEXWHV

l 1R�ZRUNIORZV�WKDW�FKHFN�LQSXW�GDWD�LQ�WKH�ILUVW�VWHSl 1R�ZRUNIORZ�VWDUWV�YLD�HYHQW�IURP�XVHU�ZULWWHQ�UHSRUWl &RPELQH��VPDOOHU��EDFNJURXQG�PHWKRGV�LQWR

�ODUJHU��XQLWVl 3DFNDJLQJ�RI�LQSXW�GDWD�LQWR�VPDOOHU�XQLWV

n Packaging is particularly relevant if large quantities of data are imported into the system (forexample, with a batch input).

n A check function module can be implemented instead of a "check step" in the workflow when theworkflow is started via an event, for example.

n The WIM API can be used instead of an event if a workflow is started from a user-defined report thatis scheduled as a background job.

n A destination can be specified for each event receiver in the type linkage table. Specific events canthen be received on a specific application server (to keep the other application servers free, forexample).

Page 196: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-43

SAP AG 1999

,PSURYLQJ�3HUIRUPDQFH���%XVLQHVV�:RUNSODFH

l 'HWDLOHG�WDVN�DVVLJQPHQW�LQ�WKH�RUJDQL]DWLRQ�PRGHOl 'R�QRW�GLVSOD\�GHDGOLQH�RU�JURXSLQJ�GDWD�LQ�WKH

VWDQGDUG�FRQILJXUDWLRQl 'LVSOD\�ZRUN�LWHPV�LQ�FUHDWLRQ�ODQJXDJH�UDWKHU�WKDQ

ORJRQ�ODQJXDJHl $OORZ�EXIIHULQJ�RI�RUJDQL]DWLRQDO�GDWDl 'HOHWH�ZRUN�LWHPV�QR�ORQJHU�UHTXLUHG

n General tasks should not be used if at all possible. If they are, a restrictive agent assignment shouldbe performed in the step definition.

n The following lead to subsequent selection if they are adopted in the standard configuration:

é Object _WI_OBJECT_ID

é Group _WI_GROUP_ID

é Task text WI_RHTEXT (if work item display in logon language)

é To do by (date) WI_LED

é To do by (time) WI_LET

n The buffering of organizational data can be controlled via the table T77S0.Please refer to note 98407.

Page 197: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-44

SAP AG 1999

:RUNIORZ�5XQWLPH�6\VWHP��8QLW�6XPPDU\����

l ([SODLQ�WKH�FRPSRQHQWV�RI�WKH�UXQWLPH�V\VWHP�DQGKRZ�WKH\�LQWHUDFW�LQ�D�ZRUNIORZ

l &RQWURO�WKH�FUHDWLRQ�DQG�H[HFXWLRQ�RI�ZRUN�LWHPV�ZLWKWKH�ZRUN�LWHP�PDQDJHU�$3,

l ([SODLQ�GHDGOLQH�PRQLWRULQJ�DQG�HUURU�KDQGOLQJ�DVZHOO�DV�WKH�RSWLRQV�IRU�FRQWUROOLQJ�GHDGOLQHPRQLWRULQJ

Page 198: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-45

SAP AG 1999

:RUNIORZ�5XQWLPH�6\VWHP��8QLW�6XPPDU\����

l 8VH�WKH�DGPLQLVWUDWLRQ�IXQFWLRQV�WR�FRUUHFW�DZRUNIORZ�ZLWK�HUURUV��FRQWLQXH�LW��DQG�DUFKLYH�LWRQFH�LW�LV�WHUPLQDWHG�

l 1DPH�WKH�PRGHOLQJ�DQG�FRQILJXUDWLRQ�VHWWLQJV�WKDWXQQHFHVVDULO\�VORZ�GRZQ�WKH�UXQWLPH�V\VWHP�

Page 199: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-46

([HUFLVHV8QLW��:RUNIORZ�5XQWLPH�6\VWHP7RSLF��:RUN�,WHP�0DQDJHU�$3,

After completion of this exercise, you will be able to:• Create a work item via the API of the work item manager

You want to start a workflow not via an event, but directly via the APIof the work item manager (for example for performance reasons).

1-1 Start a workflow via the work item manager API.

1-1-1 Create a report =��67$57 that starts your workflow Z##MSIPROC1 bycalling the API function module SWW_WI_START_SIMPLE .

Page 200: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-47

8QLW��:RUNIORZ�5XQWLPH�6\VWHP6HFWLRQ��8VHU�'HILQHG�:RUN�,WHP�'LVSOD\

After completion of this exercise, you will be able to:

• Implement a subscreen for a user-defined work item display

• Incorporate a subscreen for a user-defined work item display in yourprocess.

You want to display process-specific data for the end user before thework item is executed.

2-1 Optional extensions: Define a subscreen for a user-defined work item display.

2-1-1 Create a VFUHHQ������in your function group that displays the followingdata from the material master:+ Material number+ Last person to change the material+ Material type+ Lab/office of the material.The user is also to be able to display the material stock at the click of abutton

Note: The screen entered must be defined as a "subscreen". In thiscase, the OK code does not have to be declared explicitly as a fieldin the screen layout.

Note: The material stock can be displayed via transaction MMBE.

2-1-2 Change the display step in your process Z##MSIPROC1 in such a waythat a user-specific work item is displayed using the subscreen that youimplemented previously.

Note: If you have not implemented your own screen, you can use thescreen SAPLZ610 0100.

Note: To make the user-defined screen visible when it is displayed,you must choose the “User view without ActiveX” for the “Workitem display” under “User-defined workflow settings”.

Page 201: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-48

8QLW��:RUNIORZ�5XQWLPH�6\VWHP6HFWLRQ��$GPLQLVWUDWLYH�)XQFWLRQV

After completion of these exercises, you will be able to:

• Execute administrative functions such as selecting or deleting workitems

Several workflows have been successfully executed. After a time, youwant to delete these workflow instances.

Some workflows seem to have been running for an unusually long timewithout terminating and you require detailed information about theseworkflow instances.

3-1 Search for the work items based on specific criteria.

3-1-1 Create a report =��72'$< that lists all workflow instances startedtoday by a specific user. The list is to display the initiator, the status andthe task ID for each instance of this kind.

Note: The initiator is saved in the table SWW_CONT, and all otherdata in the table SWWWIHEAD (or in view SWWVPUBLIC).

3-1-2 Using the report RSWWWIDE, delete all the work items you created onthe first day of the workshop.

Note: First execute the report with the flag “ Display list only” set.Only if the list contains exclusively your work items, remove theflag for the second run of the report and actually delete the workitems.

Important: Once you have deleted the work items, they are lostirretrievably.

3-2 Optional extensions

3-2-1 Create a report =��:((./ that lists all unterminated workflowinstances started more than a week ago. The list is to display the task ID,the status and the creation date for each instance of this kind.

Page 202: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-49

6ROXWLRQV8QLW��:RUNIORZ�5XQWLPH�6\VWHP7RSLF��:RUN�,WHP�0DQDJHU�$3,

1-1 Start a workflow via the work item manager API.

Solution:Z00START

Path (via SAP Easy Access):Tools > ABAP Workbench > Development > ABAP Editor

REPORT Z00START .

INCLUDE <CNTN01>. " definition of container and object macros

PARAMETERS: OBJKEY LIKE MARA-MATNR DEFAULT ’200-100’.

DATA:TASK LIKE SWWVPUBLIC-WI_RH_TASK VALUE ’WS96000011’, WI_ID LIKE SWWVPUBLIC-WI_ID, OBJECT TYPE SWC_OBJECT.DATA:AGENTS LIKE SWHACTOR OCCURS 0 WITHHEADER LINE, WI_CONTAINER LIKE SWCONT OCCURS 0 WITH HEADERLINE.

* set the import parameter for flow Z00MSIPROC1* first: create object reference (runtime handle) SWC_CREATE_OBJECT OBJECT ’Z00MARA’ OBJKEY.* second: write reference to work item container using parameter def SWC_SET_ELEMENT WI_CONTAINER ’MaterialMaster’ OBJECT.* third: convert references in container from runtime handle to* persistent object reference SWC_CONTAINER_TO_PERSISTENT WI_CONTAINER.

Page 203: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-50

* start the workflow via the function APICALL FUNCTION ’SWW_WI_START_SIMPLE’ EXPORTING* CREATOR = ’ ’* PRIORITY = NO_PRIO TASK = TASK* CALLED_IN_BACKGROUND = ’ ’* DEADLINE_DATA = ’ ’ IMPORTING WI_ID = WI_ID* WI_HEADER =* RETURN =* WI_RESULT = TABLES AGENTS = AGENTS " not needed here* DEADLINE_AGENTS =* DESIRED_END_AGENTS =* LATEST_START_AGENTS =* EXCLUDED_AGENTS =* NOTIFICATION_AGENTS =* SECONDARY_METHODS = WI_CONTAINER = WI_CONTAINER EXCEPTIONS

ID_NOT_CREATED = 1 READ_FAILED = 2 IMMEDIATE_START_NOT_POSSIBLE = 3 EXECUTION_FAILED = 4 INVALID_STATUS = 5 OTHERS = 6.IF SY-SUBRC NE 0. " error message MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ELSE. " success message MESSAGE ID ’WZ’ TYPE ’S’ NUMBER ’703’ WITH WI_ID.ENDIF.

Page 204: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-51

8QLW��:RUNIORZ�5XQWLPH�6\VWHP6HFWLRQ��8VHU�'HILQHG�:RUN�,WHP�'LVSOD\

After completion of this exercise, you will be able to:

• Implement a subscreen for a user-defined work item display

• Incorporate a subscreen for a user-defined work item display in yourprocess.

You want to display process-specific data for the end user even before thework item is executed.

2-1 Optional extensions: Define a subscreen for a user-defined work item display.

2-1-1 Create a VFUHHQ������in your function group.

Solution:SAPLZ610 0100

Path (via SAP Easy Access):Tools > ABAP Workbench > Development > User Interface > ScreenPainter

2-2-2 Change the display step in your process Z##MSIPROC1 in such a way thata user-specific work item is displayed using the subscreen that youimplemented previously.

Solution:WS96000011 – Z00MSIPROC1

Path (via SAP Easy Access):Tools > SAP Business Workflow > Development > Definition tools >Tasks/Task groups > Change

Page 205: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-52

MODULE INIT_0100 OUTPUT.

*- ask frame dynpro if this is the first call of this subscreen... SWL_WIDISP_GET_INIT INIT_D0100.

CHECK INIT_D0100 IS INITIAL. INIT_D0100 = ’X’.

*- set a title heading this subscreen on the tabstrip control... SWL_WIDISP_SET_TITLE ’Process data’.

*- ask frame dynpro for the ID of workitem in display... CLEAR G_WI_ID. SWL_WIDISP_GET_WI_ID G_WI_ID.

*- now we get the data to be displayed...*- we want to show some data concerning the material, which is connected* to the workitem as an object.* therefore, we use a released interface to get the workitem’s object. CALL FUNCTION ’SAP_WAPI_GET_OBJECTS’ EXPORTING WORKITEM_ID = G_WI_ID IMPORTING LEADING_OBJECT = G_MATERIAL.* return_code =* TABLES* OBJECTS =* MESSAGE_LINES =* MESSAGE_STRUCT =.

*- from the material object we can get the data we want to show CLEAR G_OBJECT. CLEAR MARA. MOVE G_MATERIAL-OBJECT_ID TO G_OBJECT. SELECT SINGLE * FROM MARA WHERE MATNR = G_OBJECT-OBJKEY.* we do not use a possible attribute access here, because the attribute* ’BasicMaterialNumber’ does not exist and ’Laboratorty’ is defined* as an object based attribute, so we’d need to implement another* attribute access for object type T024L* clear g_runtime.* swc_object_from_persistent g_object g_runtime.* swc_get_property g_runtime ’Material’ mara-matnr.* swc_get_property g_runtime ’ChangedBy’ mara-aenam.* swc_get_property g_runtime ’MaterialType’ mara-mtart.* swc_get_property g_runtime ’OldMaterial’ mara-bismt.* swc_get_property g_runtime ’BasicMaterialNumber’ mara-wrkst.* swc_get_property g_runtime ’Laboratory’ mara-labor.ENDMODULE. " INIT_0100 OUTPUT

Page 206: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-53

MODULE USER_COMMAND_0100 INPUT.

DATA: OKAY LIKE SY-UCOMM. SWC_CONTAINER L_CONTAINER.

SWL_WIDISP_GET_OKCODE OKAY. CASE OKAY.*- we implement just one function of our own... WHEN ’DISM’. " this is the only OK code, ignore anything else*- we want to show the material, which is related to the work item* therefore, we use a released interface to get the workitem’s object. IF G_MATERIAL IS INITIAL. CALL FUNCTION ’SAP_WAPI_GET_OBJECTS’ EXPORTING WORKITEM_ID = G_WI_ID IMPORTING LEADING_OBJEC = G_MATERIAL.* return_code =* TABLES* OBJECTS =* MESSAGE_LINES =* MESSAGE_STRUCT =. ENDIF.*- we show the material stock using ta mmbe CLEAR G_OBJECT. MOVE G_MATERIAL-OBJECT_ID TO G_OBJECT. SET PARAMETER ID ’MAT’ FIELD G_OBJECT-OBJKEY. CALL TRANSACTION ’MMBE’ AND SKIP FIRST SCREEN.*- now it’s more secure to clear the okcode to the frame dynpro,* because it must not be handled again overthere... SWL_WIDISP_CLEAR_OKCODE. ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

Page 207: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-54

8QLW��:RUNIORZ�5XQWLPH�6\VWHP6HFWLRQ��$GPLQLVWUDWLYH�)XQFWLRQV

After completion of these exercises, you will be able to:

• Execute administrative functions such as selecting or deleting workitems

Several workflows have been successfully executed. After a time, youwant to delete these workflow instances.

Some workflows seem to have been running for an unusually long timewithout terminating and you require detailed information about theseworkflow instances.

3-1 Search for the work items based on specific criteria.

3-1-1 Create a report =��72'$< that lists all workflow instances started todayby a specific user.

Solution:Z00TODAYView Z00VHEACON

Path (via SAP Easy Access):

� For the reportTools > ABAP Workbench > Development > ABAP Editor

� For the viewTools > ABAP Workbench > Development > ABAP Dictionary

3-1-2 Using the report RSWWWIDE, delete all the work items you created on thefirst day of the workshop.

Path (via SAP Easy Access):Tools > ABAP Workbench > Development > ABAP Editor

Page 208: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-55

REPORT Z00TODAY LINE-SIZE 512 .

INCLUDE RSWWINCL.

TABLES: Z00VHEACON. " view over SWWWIHEAD and _WF_INITIATOR

PARAMETERS: USER LIKE SY-UNAME DEFAULT SY-UNAME.

DATA: CAND_WIS LIKE Z00VHEACON OCCURS 0 WITH HEADER LINE, INITIATOR LIKE SWHACTOR, LINE_NO LIKE SY-TFILL.

* determine intitiatorINITIATOR-OTYPE = ’US’.INITIATOR-OBJID = USER.

* search list of candidate wisIF USER NE SPACE. " search for flows of this user WRITE: / ’Number of flows started today by user ’, USER, ’:’. SELECT * FROM Z00VHEACON INTO TABLE CAND_WIS WHERE WI_CD EQ SY-DATUM AND WI_CHCKWI EQ SPACE AND " top level flows only VALUE EQ INITIATOR.ELSE. " search for flows independent of user WRITE: / ’Number of flows started today by all users :’. SELECT * FROM Z00VHEACON INTO TABLE CAND_WIS WHERE WI_CD EQ SY-DATUM AND WI_CHCKWI EQ SPACE. " top level flows onlyENDIF.

DESCRIBE TABLE CAND_WIS LINES LINE_NO.WRITE: LINE_NO.SORT CAND_WIS BY WI_RH_TASK VALUE.* display result listLOOP AT CAND_WIS. WRITE : / CAND_WIS-WI_ID, CAND_WIS-WI_RH_TASK, CAND_WIS-WI_STAT, CAND_WIS-WI_CD, CAND_WIS-VALUE.ENDLOOP.

Page 209: BC610 - Workflow Development (Englisch)

© SAP AG BC610 7-56

3-2 Optional extensions

3-2-1 Create a report =��:((./ that lists all unterminated workflow instancesstarted more than a week ago.

Solution:Z00WEEKL

Path (via SAP Easy Access):Tools > ABAP Workbench > Development > ABAP Editor

REPORT Z00WEEKL LINE-SIZE 512.

INCLUDE RSWWINCL.

TABLES: Z00VHEACON. " public view on work item header data

PARAMETERS: TASK LIKE SWWWIHEAD-WI_RH_TASK, DAYS_AGO LIKE SWWWIHEAD-RETRY_CNT DEFAULT’07’.

DATA: CAND_WIS LIKE Z00VHEACON OCCURS 0 WITHHEADER LINE.

DATA: START_DATE LIKE SY-DATUM.

WRITE : / ’List of flows started longer than ’, DAYS_AGO, ’ days ago:’.

* determine start date for candidate work flowsSTART_DATE = SY-DATUM - DAYS_AGO.

* search list of candidate flowsIF TASK NE SPACE. " search for a specific task SELECT * FROM Z00VHEACON INTO TABLE CAND_WIS WHERE WI_RH_TASK EQ TASK AND WI_CD <= START_DATE AND WI_CHCKWI EQ SPACE AND " top-level flows only ( WI_STAT NE WI_STATUS_COMPLETED AND WI_STAT NE WI_STATUS_CANCELLED ) .ELSE. " search for all tasks SELECT * FROM Z00VHEACON INTO TABLE CAND_WIS WHERE WI_CD <= START_DATE AND WI_CHCKWI EQ SPACE AND " top-level flows only ( WI_STAT NE WI_STATUS_COMPLETED AND WI_STAT NE WI_STATUS_CANCELLED ) .ENDIF.

* display result listLOOP AT CAND_WIS. WRITE : / CAND_WIS-WI_ID, CAND_WIS-WI_RH_TASK, CAND_WIS-WI_STAT, CAND_WIS-WI_CD, CAND_WIS-VALUE.ENDLOOP.

Page 210: BC610 - Workflow Development (Englisch)

© SAP AG BC610 8-1

SAP AG 1999

$SSHQGL[

l 7KLV�VHFWLRQ�FRQWDLQV�VXSSOHPHQWDU\�PDWHULDO�WR�EH�XVHG�IRU�UHIHUHQFH

l 7KLV�PDWHULDO�LV�QRW�SDUW�RI�WKH�VWDQGDUG�FRXUVHl 7KHUHIRUH��WKH�LQVWUXFWRU�PLJKW�QRW�FRYHU�WKLV�

GXULQJ�WKH�FRXUVH�SUHVHQWDWLRQ

Page 211: BC610 - Workflow Development (Englisch)

© SAP AG BC610 8-2

SAP AG 1999

$EEUHYLDWLRQ�/LVW$EEUHYLDWLRQ )LUVW�PHQWLRQ/RQJ�WH[WAPI Application Programming Interface Unit 3

BI Background Work Item Unit 6BOB Business Object Builder Unit 2BORECAEMFMFGFIRHLISLUWPORRFCtRFCWFWIWIM

WIS

Business Object RepositoryEvent Condition ActionEvent ManagerFunction ModuleFunction GroupWorkflow Work ItemRuntime Handle Logistics Information SystemLogical Unit of WorkPersistent Object ReferenceRemote Function CallTransactional RFCWorkflowWork Item (General)Work Item ManagerWorkflow Information System

Unit 2Unit 5Unit 3Unit 2Unit 6Unit 6Unit 2Unit 7Unit 5Unit 2Unit 5Unit 5Unit 1Unit 6Unit 3Unit 7

Page 212: BC610 - Workflow Development (Englisch)

© SAP AG BC610 8-3

6$3�5HYLHZ9ROXPH���,VVXH�� -XO\�����06,�%35Motor Sports International (MSI) has successfully implemented SAP R/3. SAP BusinessWorkflow helped in achieving the goals set by the company for optimizing business processes(Business Processing Reengineering, or BPR).

The following study investigates the process used by MSI to achieve these objectives with thehelp of the SAP Business Workflow tools. The study does not really outline the precise MSIworkflow implementation solution, but rather explains the business process in detail andsuggests courses of action.

This case study is not like a typical workflow process that would occur in your enterprise; it aimsto motivate you in this course and provide you with support for implementing workflowsuccessfully.

7KH�SUREOHP�DW�06,� The existing system at MSI could not notify the designer of relevantchanges to material master records. This communication gap led to a delay in adjusting theproduction line, which in turn resulted in large quantities of obsolete and unwanted warehousestock.

7KH�VROXWLRQ�DW�06,� With the help of SAP Business Workflow, BPR helped MSI to makeconsiderable savings reducing warehouse stock.

,Q�VKRUW��7KH�ZRUNIORZ�SURFHVV�DW�06,7ULJJHULQJ� This business process always starts when a user changes the 2OG�0DWHULDO�fieldin a material master record. The result of the change triggers a workflow event (for example,OldMaterialChanged), which then initiates one of two workflow processes.

The triggering event is actually initiated by a link to the SAP change documents. As soon asthe field is changed from a value ‘*’ to your group number ‘XX’, the ‘OldMaterialChanged’event is triggered.

*Note: Enquiries at MSI have shown that this field is not used. Changes to its valueare therefore used to inform the designer of a relevant change to the material master.

'LVWLQJXLVKLQJ� As mentioned above, the event triggers one of two workflows. Thedefinitions of the two workflows are identical, but different role resolutions are used. Thematerial type determines which workflow is started. The first workflow is started for materialtype ‘FERT’ for finished goods. All other material types start the second workflow.

0RQLWRULQJ: Not all changes to the 2OG�0DWHULDO�field start the workflow process. For this casestudy, you must ensure that the FKDQJHU�of the material master is your logon ID.

*** Trigger

event ***

*** Checkfunction module***

*** Receiver typefunction module***

Page 213: BC610 - Workflow Development (Englisch)

© SAP AG BC610 8-4

&RUH�SURFHVV� As soon as a material is changed, a particular designer must be informed.The agent responsible is based on the "laboratory" field.

After the notification, the designer adjusts the production process to suit the change. Toinform the workflow system that this work has been completed, the designer changes the%DVLF�0DWHULDO�field of the relevant material master. This event is therefore a terminatingevent of an asynchronous task.

*Note: Enquiries during the project indicate that nobody else uses the %DVLF�0DWHULDOfield. A change to the value represents a status change.

If the designer does not complete all activities within a specified time interval (for example,five minutes), the superior of the designer must be informed of this delay.

As soon as the workflow system is notified that the designer has completed their work, itsends a notification of completion stating that the process is completed and that the materialjust changed can now return to production. The workflow determines who receives thisnotification (note that in practice this would be implemented using role resolution). The firstworkflow (for material type ‘FERT’) forwards the notification to the user who changed thematerial at the start. The second workflow (all other material types) forwards the notificationto the designer's superior for review.

$QDO\]LQJ� The management team at MSI expects a specific daily report on all newly startedworkflows. As well as the total number, the list that is output also contains the workflowinitiator for each workflow instance.

The system administrator wants to maintain the database with minimal effort so a monthlyarchiving procedure must be planned. To support planning, the workflow administratorrequires a weekly report on the workflows that have been started but not yet terminated.

Table I: Overview of Material Object Types

3URSHUW\ 1DPH 0HDQLQJ.H\ Material Unique ID of a particular material

$WWULEXWH ChangedBy The ‘owner’ of the material

Plant The ‘main’ factory where the material is made

0HWKRG ExistenceCheck Checks whether a given material exists or not

Edit Enables the designer to change the %DVLF�0DWHULDO field

Display Displays a given material

ChangeDocDisplay Displays all changes to a given material

(YHQW BasicMaterialChanged

Designer has completed processing by changing the %DVLF0DWHULDO field

OldMaterialChanged Workflow trigger: user has changed the 2OG�0DWHULDO field

*** Workflow

runtime

environment ***

*** Roleresolution ***

*** Deadlinemonitoring ***

*** Terminatingevent ***

*** Notificationof completion ***


Top Related