Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf ·...

20
BIT610 SAP Workflow Programming mySAP Technology Date Training Center Instructors Education Website Instructor Handbook Course Version: 62 Course Duration: 3 Days Material Number: 50086627 Owner: Holger Kormann (D038157) An SAP Compass course - use it to learn, reference it for work

Transcript of Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf ·...

Page 1: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

BIT610SAP Workflow Programming

mySAP Technology

Date

Training Center

Instructors

Education Website

Instructor HandbookCourse Version: 62Course Duration: 3 DaysMaterial Number: 50086627Owner: Holger Kormann (D038157)

An SAP Compass course - use it to learn, reference it for work

Page 2: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

Copyright

Copyright © 2007 SAP AG. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or for any purpose without theexpress permission of SAP AG. The information contained herein may be changed without prior notice.

Some software products marketed by SAP AG and its distributors contain proprietary softwarecomponents of other software vendors.

Trademarks

� Microsoft®, WINDOWS®, NT®, EXCEL®, Word®, PowerPoint® and SQL Server® areregistered trademarks of Microsoft Corporation.

� 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.

� ORACLE® is a registered trademark of ORACLE Corporation.� INFORMIX®-OnLine for SAP and INFORMIX® Dynamic ServerTM are registered trademarks

of Informix Software Incorporated.� UNIX®, X/Open®, OSF/1®, and Motif® are registered trademarks of the Open Group.� Citrix®, the Citrix logo, ICA®, Program Neighborhood®, MetaFrame®, WinFrame®,

VideoFrame®, MultiWin® and other Citrix product names referenced herein are trademarks ofCitrix Systems, Inc.

� HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C®, World WideWeb Consortium, Massachusetts Institute of Technology.

� JAVA® is a registered trademark of Sun Microsystems, Inc.� JAVASCRIPT® is a registered trademark of Sun Microsystems, Inc., used under license for

technology invented and implemented by Netscape.� SAP, SAP Logo, R/2, RIVA, R/3, SAP ArchiveLink, SAP Business Workflow, WebFlow, SAP

EarlyWatch, BAPI, SAPPHIRE, Management Cockpit, mySAP.com Logo and mySAP.com aretrademarks or registered trademarks of SAP AG in Germany and in several other countries allover the world. All other products mentioned are trademarks or registered trademarks of theirrespective companies.

Disclaimer

THESE MATERIALS ARE PROVIDED BY SAP ON AN "AS IS" BASIS, AND SAP EXPRESSLYDISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR APPLIED, INCLUDING WITHOUTLIMITATION WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULARPURPOSE, WITH RESPECT TO THESE MATERIALS AND THE SERVICE, INFORMATION, TEXT,GRAPHICS, LINKS, OR ANY OTHER MATERIALS AND PRODUCTS CONTAINED HEREIN. INNO EVENT SHALL SAP BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL,CONSEQUENTIAL, OR PUNITIVE DAMAGES OF ANY KIND WHATSOEVER, INCLUDINGWITHOUT LIMITATION LOST REVENUES OR LOST PROFITS, WHICH MAY RESULT FROMTHE USE OF THESE MATERIALS OR INCLUDED SOFTWARE COMPONENTS.

g2008040427

Page 3: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

About This HandbookThis handbook is intended to complement the instructor-led presentation of thiscourse, and serve as a source of reference. It is not suitable for self-study.

Typographic ConventionsAmerican English is the standard used in this handbook. The following typographicconventions are also used.

Type Style Description

Example text Words or characters that appear on the screen. Theseinclude field names, screen titles, pushbuttons as well asmenu names, paths, and options.

Also used for cross-references to other documentationboth internal (in this documentation) and external (inother locations, such as SAPNet).

Example text Emphasized words or phrases in body text, titles ofgraphics, and tables

EXAMPLE TEXT Names of elements in the system. These include reportnames, program names, transaction codes, table names,and individual key words of a programming language,when surrounded by body text, for example SELECTand INCLUDE.

Example text Screen output. This includes file and directory namesand their paths, messages, names of variables andparameters, and passages of the source text of a program.

Example text Exact user entry. These are words and characters thatyou enter in the system exactly as they appear in thedocumentation.

<Example text> Variable user entry. Pointed brackets indicate that youreplace these words and characters with appropriateentries.

2007 © 2007 SAP AG. All rights reserved. iii

Page 4: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

About This Handbook BIT610

Icons in Body TextThe following icons are used in this handbook.

Icon Meaning

For more information, tips, or background

Note or further explanation of previous point

Exception or caution

Procedures

Indicates that the item is displayed in the instructor�spresentation.

iv © 2007 SAP AG. All rights reserved. 2007

Page 5: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

ContentsCourse Overview ...... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii

Course Goals.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .viiCourse Objectives .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix

Unit 1: Introduction: .. .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1Overview of Objectives and Structure of the Workflow Engine .. . . . . . . . . . . . . . . . . . . . . . . .2

Unit 2: Object Type Definition and Object Type Implementation ..... . . . . . . . . . . . . . 11Purpose and Underlying Concepts of the Business Object Repository ... . . . . . . . . . . 13Object Type Definition - Key Fields and Attributes .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25Object Type Definition - Methods ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44Object Type Definition - Attribute Access and Method Calls .. . . . . . . . . . . . . . . . . . . . . . . . . 63

Unit 3: Tasks � Binding � Programming Exits ..... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87Using Standard Tasks and Container Handling... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89Programmed Binding, Programming Exits and User-defined Work Item Display . 117

Unit 4: Rule Function Modules ..... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .135Agent Determination using Rule Function Modules.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .136

Unit 5: Event Definition and Implementation ..... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .153Event Processing Using the Event Manager.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .155Enhancing the Event Concept in the Workflow Builder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167Using Function Modules to Trigger Events... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .176Check Function Modules, Receiver Type, and Receiver Function Modules ... . . . .187Working With the Event Queue .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .205

Unit 6: The Workflow Runtime System ...... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .215Components and Architecture of the Runtime System ... . . . . . . . . . . . . . . . . . . . . . . . . . . . .217Using BAdIs to Manipulate SAP Business Workplace.. .. . . . . . . . . . . . . . . . . . . . . . . . . . . . .234Deadline Monitoring and Error Handling... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241Administration Tasks ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .251

2007 © 2007 SAP AG. All rights reserved. v

Page 6: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

Contents BIT610

Appendix 1: Business Scenario ..... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .269

Appendix 2: �Organizational Data� Rule Type ..... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .271

Appendix 3: How to Troubleshoot ..... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .275

vi © 2007 SAP AG. All rights reserved. 2007

Page 7: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

Course OverviewThis course covers customer adaptations and enhancements to workflows that requireprogramming.

Participants learn how to program workflow interfaces at the level of: Objects, events,methods, rules, and attributes. They will also find out about controlling and monitoringthe runtime system and about programming exits at workflow and step level.

Target AudienceThis course is intended for the following audiences:

� Workflow developers (with ABAP knowledge)� Workflow consultants (with ABAP knowledge)

Course PrerequisitesRequired Knowledge

� SAPTec� BIT601� BC400 or equivalent skills

Recommended Knowledge

� Basic knowledge of object-oriented programming

Course Duration DetailsUnit 1: Introduction:Overview of Objectives and Structure of theWorkflow Engine 10 Minutes

Unit 2: Object Type Definition and Object Type ImplementationPurpose and Underlying Concepts of the BusinessObject Repository 45 Minutes

Object Type Definition - Key Fields and Attributes 60 MinutesExercise 1: Create a New Object Type for a Plant. 45 MinutesObject Type Definition - Methods 60 MinutesExercise 2: Create a subtype ZMARA##A for yoursupertype Z##MARA. 35 Minutes

2007 © 2007 SAP AG. All rights reserved. vii

Page 8: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

Course Overview BIT610

Object Type Definition - Attribute Access andMethod Calls 30 MinutesExercise 3: Create Virtual Attributes and Methodswith Parameters and Exceptions 20 Minutes

Unit 3: Tasks � Binding � Programming ExitsUsing Standard Tasks and Container Handling 60 MinutesExercise 4: Creating a Workflow for the BusinessProcess 105 Minutes

Programmed Binding, Programming Exits andUser-defined Work Item Display 25 MinutesExercise 5: (Optional) Create a ProgrammedBinding 20 Minutes

Unit 4: Rule Function ModulesAgent Determination using Rule Function Modules 45 MinutesExercise 6: Create a rule function module thatreturns an agent depending on the material typeof the object used. 60 Minutes

Unit 5: Event Definition and ImplementationEvent Processing Using the Event Manager 45 MinutesExercise 7: Assess the Effect of the Type LinkageTable 10 Minutes

Enhancing the Event Concept in the WorkflowBuilder 30 Minutes

Using Function Modules to Trigger Events 30 MinutesExercise 8: Use the Function ModuleSWE_EVENT_CREATE to Trigger the EventDeadlineTest (ZMARA##A) 50 Minutes

Check Function Modules, Receiver Type, andReceiver Function Modules 40 MinutesExercise 9: Create a Check Function Module toQuery Special Conditions 60 Minutes

Exercise 10: (Optional) Using a Receiver TypeFunction Module 60 Minutes

Working With the Event Queue 15 Minutes

Unit 6: The Workflow Runtime SystemComponents and Architecture of the RuntimeSystem 45 MinutesExercise 11: Start a Workflow Directly using aFunction Module, Instead of Using a TriggeringEvent 30 Minutes

viii © 2007 SAP AG. All rights reserved. 2007

Page 9: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

BIT610 Course Overview

Using BAdIs to Manipulate SAP BusinessWorkplace 30 Minutes

Deadline Monitoring and Error Handling 30 MinutesExercise 12: Create a report that lists all workflowinstances that have not terminated and thatstarted more than a week ago. The List ShouldDisplay the Task ID, the Status and the CreationDate. 30 Minutes

Administration Tasks 35 MinutesExercise 13: Archive and delete the work itemsthat your user has created during the 3 days ofthe course. 15 Minutes

Course GoalsThis course will prepare you to:

� Perform workflow programming at all levels� Manage and monitor the workflow runtime system

Course ObjectivesAfter completing this course, you will be able to:

� Identify all points in the workflow system at which programming is possibleor necessary

� Create your own object types and enhance existing object types� Create rule function modules� Program events� Create check function modules and receiver type function modules� Use AP to create work items� Administrate the workflow runtime system

SAP Software Component InformationThe information in this course pertains to the following SAP Software Componentsand releases:

� SAP NetWeaver 1.0

2007 © 2007 SAP AG. All rights reserved. ix

Page 10: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

Course Overview BIT610

For more information, see Service Marketplace (http://service.sap.com) alias"Curr-Info".

x © 2007 SAP AG. All rights reserved. 2007

Page 11: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

Unit 11 Introduction:

See the individual lessons

Unit OverviewThe introduction unit covers a brief overview of the uses and tasks of a workflowmanagement system.

It explains the definition architecture and the places within it that can be programmed.

This unit also introduces the example that will be used in the course exercises.

Unit ObjectivesAfter completing this unit, you will be able to:

� Explain the SAP Business Workflow architecture� Recognize the components of SAP Business Workflow that enable or require

programming by the user

Unit ContentsLesson: Overview of Objectives and Structure of the Workflow Engine... . . . . .2

2007 © 2007 SAP AG. All rights reserved. 1

Page 12: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

Unit 1: Introduction: BIT610

Lesson:2

Overview of Objectives and Structure of the WorkflowEngineLesson Duration: 10 Minutes

Lesson OverviewThis lesson reinforces your knowledge of the underlying architecture of the WorkflowEngine, and the associated terminology. It also introduces the example workflow thatis created in the course.

Lesson ObjectivesAfter completing this lesson, you will be able to:

� Explain the SAP Business Workflow architecture� Recognize the components of SAP Business Workflow that enable or require

programming by the user

You can find additional information in the course Trainer Guide in the �Introduction�section.

Business ExampleYou have implemented workflows in you company and you now want to program rulefunction modules, create your own object types, and trigger events in applicationsyourself.

Workflow Management StructureWhat Is Workflow Management?

� A system that delivers work

� In the correct sequence� With all the necessary information� At the correct time� To the people responsible

2 © 2007 SAP AG. All rights reserved. 2007

Page 13: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

BIT610 Lesson: Overview of Objectives and Structure of the Workflow Engine

Workflow Management is used to link work steps automatically.

It enables the control of connected activities across transactions and across differentapplications.

Tasks of a Workflow Management System

� Process definition

�What happens, and in which order?�

Workflow builder, task definition

� Organizational modeling

�Who does what?�

Organization model, rule definition

� Application encapsulation

�Which objects are required?�

Business Object Builder, Business Object Repository

Through the process definition, the a workflow management system ensures that�work is delivered in the correct sequence...�

Through organization modeling, a workflow management system ensures that �workis delivered to the people responsible...�

Through application encapsulation, a workflow management system ensures that�work is delivered with all the necessary information�.

Tasks of a Workflow Management System

� Support for end users

�What have I got to do today?�

Business Workplace

� Process control

�What happens when?�

Workflow manager, work item manager

� Evaluation of processing

�Who did what and when?�

Reporting and analysis

2007 © 2007 SAP AG. All rights reserved. 3

Page 14: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

Unit 1: Introduction: BIT610

Through end user support, a workflow management system ensures that �work isdelivered to the people responsible at the correct time.�

Through process control, a workflow management system ensures that �work isdelivered in the correct sequence at the correct time�.

What Does Workflow Not Do?

� Simplify application transactions:

Complex application functions remain complex application functions

� Provide efficient business processes automatically:

The modelers themselves are responsible for ensuring the practicality of theworkflow from a business perspective.

Workflow cannot influence existing interfaces or menu structures.

After the application is started using the workflow, only the application has controlover which actions can be performed.

Definition Structure and Levels of Programming

Figure 1: SAP Business Workflow: Definition Architecture

A→ B means that A uses B.

4 © 2007 SAP AG. All rights reserved. 2007

Page 15: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

BIT610 Lesson: Overview of Objectives and Structure of the Workflow Engine

Example: A step definition uses attributes (container operation), events (wait steps),methods (secondary methods). A task uses a workflow definition (in multi-step tasks)or methods (in single-step tasks).

Figure 2: SAP Business Workflow: Programming

Programming is also possible in the following areas:

� Administration� Reporting� Creation of work items

The option to use ABAP classes is displayed in the diagrams in the lowest hierarchylevel of the workflow architecture.

This technology can be used as of SAP ERP 5.0 (in exceptional cases also with SAPR/3 Enterprise) to carry functions that are to be called in the subsequent architecturelevels.

As the use of ABAP classes for workflows is a special case, this course dealsexclusively with programming using business object types. In the current release, thesebusiness object types provide the main part of the functions from the applications.

An extra day can be added to course BIT610, if required - covered by course BIT611- in which participants are given the necessary information to convert applicationfunctions using ABAP classes.

2007 © 2007 SAP AG. All rights reserved. 5

Page 16: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

Unit 1: Introduction: BIT610

Facilitated DiscussionYou want to design a process diagram for a workflow process.

The department have recorded their requirements in a document.

Discussion QuestionsUse the following questions to engage the participants in the discussion. Feel free touse your own additional questions.

Using the whole enterprise scenario from the appendix, create a workflow diagramwith the course participants for the example that will be created in the course.

6 © 2007 SAP AG. All rights reserved. 2007

Page 17: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

BIT610 Lesson: Overview of Objectives and Structure of the Workflow Engine

Lesson Summary

You should now be able to:� Explain the SAP Business Workflow architecture� Recognize the components of SAP Business Workflow that enable or require

programming by the user

2007 © 2007 SAP AG. All rights reserved. 7

Page 18: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

Unit Summary BIT610

Unit SummaryYou should now be able to:� Explain the SAP Business Workflow architecture� Recognize the components of SAP Business Workflow that enable or require

programming by the user

8 © 2007 SAP AG. All rights reserved. 2007

Page 19: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

BIT610 Test Your Knowledge

9Test Your Knowledge

1. The keyword for the Workflow Engine is: The correct at thecorrect to the correct . Programming is possible inthe areas of , , and . TheWorkflow Engine consists of the ,

andcomponents.Fill in the blanks to complete the sentence.

2007 © 2007 SAP AG. All rights reserved. 9

Page 20: Print Preview - C:WINDOWSTEMPe3temp 3316 ...runsap.ir/wp-content/uploads/2017/09/BIT610.pdf · About This Handbook BIT610 Icons in Body Text The following icons are used in this handbook.

Test Your Knowledge BIT610

10Answers

1. The keyword for the Workflow Engine is: The correct work at the correct time tothe correct agent. Programming is possible in the areas of object types, rules, andevents. The Workflow Engine consists of the Workflow Manager, Work ItemManager and Event Manager components.

Answer: work, time, agent, object types, rules, events, Workflow Manager,Work Item Manager, Event Manager

10 © 2007 SAP AG. All rights reserved. 2007