How to Optimize Business Processes with Workflow in SAP B1

January 27, 2017 | Author: Karin Esser | Category: N/A
Share Embed Donate


Short Description

Download How to Optimize Business Processes with Workflow in SAP B1...

Description

How to Optimize Business Processes with Workflow in SAP B1 Philippe BERNARD/Local Product Expert Ecosystem & Channels readiness May 26-28, 2015

Customer

SAP Business One Innovation summit - Barcelona ©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

1

Agenda

§ 

Activate the Workflow Service for the Company

§ 

Manage Configuration Log File Settings

§ 

Design the Workflow Template

§ 

Import and Activate the Workflow Template in SAP Business One

§ 

Execute the Workflow

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

2

Activate Workflow Service for the Company

Activate Workflow for Company

1 5

2 1

7 6

3

8

9

4

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

4

Services Necessary for Workflow

Name :SBO_WorkflowDataAccess.exe

Name :B1_Workflow_Service.exe Depends on SAP Business One Workflow Data Access

!!! If you create new UDF,UDT or UDO services should be restarted ©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

5

Manage Configuration Settings

Configuration File of the Workflow Service C:\Program Files (x86)\SAP\SAP Business One ServerTools\Workflow\b1-workflow-manager.xml

Frequency to evaluate conditional Start Event

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

1 minute

Public

7

Manage Log File and Debug These settings in the configuration file affect the log information

Information

Error

Warning

Debug

0 : Don’t write in the file 1: Write in the log file

Name & Location of Log File Information are generated by instruction «print» in script

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

8

Design the Workflow Template

SAP Business One Studio

To create a workflow you need SAP Business One Studio It is available in 32-bit and 64-bit versions. It is also possible to include it in Visual studio 2010 ©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

10

Workflow for Replenishment of Warehouse 02 Each night we want to create a Stock Transfer Request to replenish Warehouse 2 from Warehouse 1. In the morning the manager of Warehouse 2 creates a stock transfer based on the Stock Transfer Request

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

11

Timer Start Event

Run at 3:10 am

First run on 2015/05/03 no end date

Run once a day

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

12

Script Task

Script Task are always assigned to user «Workflow»

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

13

Script Task - Javascript

Code will be explained in detail in some slides.

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

14

User Task

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

15

Customized Data Object

This object is mainly used to store variables. These variables will be read, written or updated by script task or user

Initial Value Type of variable

Name of variable

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

16

SAP Business One Data Object These objects represent object of SAP Business One. These objects are used as input or output object of tasks.

Activities Bill of Exchange Business Partner Sales Marketing Documents Deposits Dunning Terms Incoming Payments Inventory Entry Inventory Exit Inventory Transfer Request

Items Journal Entries Journal Vouchers Landed Cost Material revaluation Material Groups Production Orders Bill of Material Purchase Marketing Document Sales Forecast

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Sales Opportunities Service Calls Stock Transfer Users Outgoing Payments payment Wizard ...

Public

17

Exclusive Gateway

If condition is not true this branch is executed

If condition is true this branch is executed ©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

18

Some Recommendations for Javascript

Use debug (« print » instruction) Write your scripts step by step Consult file « SAP Business One Workflow API Reference.html » to know object, method and properties. Pay attention to variables type Pay attention to the case, don’t forget that Javascript is case sensitive !

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

19

SAP Business One Workflow API Reference.html

1 4

2

5 3

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

20

Color Code in the script To make the following script more understandable we apply the following color codes

Method

Standard Javascript

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Comment

Public

21

Script 1/4

// Create a variable of class RecordsetParams var param = company.getRecordsetParams(); // Define the query var query = "SELECT ItemCode, ( MinStock - (OnHand + OnOrder - IsCommited) ) AS \"Qty\" FROM OITW WHERE (WhsCode = \'02\') AND ((OnHand + OnOrder - IsCommited) < MinStock)"; //For debug purpose print("In the script task the SQL query is : " + query); param.setQuery(query); // Initialize a variable of class "Recordset" var recordset=company.getRecordset(); // Execute the query recordset.doQuery(param); …

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

22

Script 2/4 var xnew = "Y"; // Loop to read all record while (recordset.read()) { Where can we find this value ? if (xnew == "Y") { // Create an object DIService var invtrfreqService = company.getBusinessService('1250000001'); // Create an Object of type "Inventory Transfer Request" var transferDoc = company.createDIObject('StockTransfer'); // Define Source Warehouse transferDoc.setFromWarehouse('01'); // Define Destination Warehouse From where these strings transferDoc.setToWarehouse('02'); are coming from ? // Write a comment in the field Remark transferDoc.setComments("Generated by the workflow"); // Create a Collection for Lines of Inventory Transfer Request var collLines = transferDoc.getStockTransferLines(); if (collLines == null) { collLines=company.createDIObject('StockTransferLines'); } xnew ="N"; } ©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

23

Script 3/4 // Create a new Line in document var transferLine= company.createDIObject('StockTransferLine'); // Read first field of Query [ItemCode] var field0 = recordset.getField(0); var fieldValue0 = field0.getColumnValue();

Pay attention there are 2 objects : • 

StockTransfertLines (Collection)

• 

StockTrasfertLine (Line itself)

// Set the Item transferLine.setItemCode(fieldValue0); // Read second field of Query var field1 = recordset.getField(1); var fieldValue1 = field1.getColumnValue(); // Enter the Quantity transferLine.setQuantity(parseFloat(fieldValue1)); // Add the Line to the collection collLines.add(transferLine); }

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

24

Script 4/4

// If a document has been created, save it if (xnew == "N") { // Add Collection of Lines to the document transferDoc.setStockTransferLines(collLines); // Add New Inventory transfer request in the DataBase var invtrfreqParams = invtrfreqService.add(transferDoc); // Read Number of created Inventory Transfer Request var docNum = invtrfreqParams.getDocEntry(); // Update Inventory Transfer Request Key CurrentProcess.DataObject('transRequest').putItem("Key",docNum.toString()); // Update local variable "convert" CurrentProcess.DataObject('do1').putItem('convert',1); print("The inventory transfer request " + docNum + " has been created"); }

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

25

getBusinessServices(String objectType) // Create an object DIService var invtrfreqService = company.getBusinessService('1250000001');

To find these value use SDK HELP for DI/API then search for “BoObject Types Enumeration”, then search for row containing your object. The value is in column “Value” it should be passed as String.

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

26

createDIObject(String clsName) // Create an Object of type "Inventory Transfer Request" var transferDoc = company.createDIObject('StockTransfer'); .. collLines=company.createDIObject('StockTransferLines'); .. var transferLine= company.createDIObject('StockTransferLine');

The string is the Class Name, you can find it in the file « SAP Business One Workflow API Reference.html ».

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

27

Import and Activate Workflow in SAP Business One

Import Workflow in SAP Business One 1/2

2

1

4 3

5 6 ©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

29

Import Workflow in SAP Business One 2/2

10

8 7

9

You cannot re-import an existing Workflow template with the same name and version, even if it has been deleted in the Workflow Manager. If you change the template, change the version. The concatenation of name and version should be unique in the Database

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

30

Execute the workflow

Launch the Workflow

2 1

3 4 5

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

32

Follow Workflow Execution

This task can be picked

This task is completed

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

33

Pick Up the Task

2 3 1

4

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

34

User Task Execution

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

35

Use Case

Creation of new partner to segregate tasks between sales department and bookkeeping Creation of Item to segregate tasks between purchase, sales and production Create batch processing on various objects exposed in workflow Include manual tasks in workflow Create workflow on UDO (for example leave request) …

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

36

Appendix

Data model related to Workflow OWFI

OWMG Workflow Manager

(0,n)

Is used in

(1,1)

OWFER

Workflow Instance

Error Messages

(1,n)

Composed of (1,1)

WLS1 Potential Processor of Task

OWLS (1,1)

Be Done by

(1,n)

(0,n)

Read By

WLS2 Input Data for Task

(1,1)

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Workflow Task Detail

WLS4 (0,n)

Create By

(1,1)

Output Data for Task

(0,n)

Write in

WLS3 (1,1)

Task Note

Public

38

Workflow Manager OWMG TemplateKey

Name Status

StartType Version

Desc

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

39

Workflow Instance OWFI Status

WFInstID Creator

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

EndDate & EndTime

StartDate & StartTime

Public

40

Task Detail OWLS

TaskID TaskName TaskType

Status

Operation Priotity

EnterDate DueDate

Owner DuraHours

DuraDays

TaskDesc

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

41

Participant (Processor of task) WLS1

Candidate

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

42

Input Data for Tasks WLS2

ObjectType

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

ObjKey

Public

43

Note information in task WLS3 Note

LineID

Creator Notedate

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

44

Task Output Data WLS4

ObjectType

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

ObjKey

Public

45

Thank you Contact information: Philippe BERNARD Local Product Expert Address Phone number

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

© 2015 SAP SE or an SAP affiliate company. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. Please see http://global12.sap.com/corporate-en/legal/copyright/index.epx for additional trademark information and notices. Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors. National product specifications may vary. These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP SE or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP SE or SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality mentioned therein. This document, or any related presentation, and SAP SE’s or its affiliated companies’ strategy and possible future developments, products, and/or platform directions and functionality are all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions.

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

47

© 2015 SAP SE oder ein SAP-Konzernunternehmen. Alle Rechte vorbehalten. Weitergabe und Vervielfältigung dieser Publikation oder von Teilen daraus sind, zu welchem Zweck und in welcher Form auch immer, ohne die ausdrückliche schriftliche Genehmigung durch SAP SE oder ein SAP-Konzernunternehmen nicht gestattet. SAP und andere in diesem Dokument erwähnte Produkte und Dienstleistungen von SAP sowie die dazugehörigen Logos sind Marken oder eingetragene Marken der SAP SE (oder von einem SAP-Konzernunternehmen) in Deutschland und verschiedenen anderen Ländern weltweit. Weitere Hinweise und Informationen zum Markenrecht finden Sie unter http://global.sap.com/corporate-de/legal/copyright/index.epx. Die von SAP SE oder deren Vertriebsfirmen angebotenen Softwareprodukte können Softwarekomponenten auch anderer Softwarehersteller enthalten. Produkte können länderspezifische Unterschiede aufweisen. Die vorliegenden Unterlagen werden von der SAP SE oder einem SAP-Konzernunternehmen bereitgestellt und dienen ausschließlich zu Informationszwecken. Die SAP SE oder ihre Konzernunternehmen übernehmen keinerlei Haftung oder Gewährleistung für Fehler oder Unvollständigkeiten in dieser Publikation. Die SAP SE oder ein SAP-Konzernunternehmen steht lediglich für Produkte und Dienstleistungen nach der Maßgabe ein, die in der Vereinbarung über die jeweiligen Produkte und Dienstleistungen ausdrücklich geregelt ist. Keine der hierin enthaltenen Informationen ist als zusätzliche Garantie zu interpretieren. Insbesondere sind die SAP SE oder ihre Konzernunternehmen in keiner Weise verpflichtet, in dieser Publikation oder einer zugehörigen Präsentation dargestellte Geschäftsabläufe zu verfolgen oder hierin wiedergegebene Funktionen zu entwickeln oder zu veröffentlichen. Diese Publikation oder eine zugehörige Präsentation, die Strategie und etwaige künftige Entwicklungen, Produkte und/oder Plattformen der SAP SE oder ihrer Konzernunternehmen können von der SAP SE oder ihren Konzernunternehmen jederzeit und ohne Angabe von Gründen unangekündigt geändert werden. Die in dieser Publikation enthaltenen Informationen stellen keine Zusage, kein Versprechen und keine rechtliche Verpflichtung zur Lieferung von Material, Code oder Funktionen dar. Sämtliche vorausschauenden Aussagen unterliegen unterschiedlichen Risiken und Unsicherheiten, durch die die tatsächlichen Ergebnisse von den Erwartungen abweichen können. Die vorausschauenden Aussagen geben die Sicht zu dem Zeitpunkt wieder, zu dem sie getätigt wurden. Dem Leser wird empfohlen, diesen Aussagen kein übertriebenes Vertrauen zu schenken und sich bei Kaufentscheidungen nicht auf sie zu stützen.

©  2015 SAP SE or an SAP affiliate company. All rights reserved.

Public

48

View more...

Comments

Copyright � 2017 SILO Inc.