Академический Документы
Профессиональный Документы
Культура Документы
Overview
June 2011
Material # TSO15095P
The information in this document is confidential and proprietary to SAP and may not be
disclosed without the permission of SAP. This presentation is not subject to your license
agreement or any other service or subscription agreement with SAP. SAP has 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's strategy and possible future developments, products and or platforms
directions and functionality are all subject to change and may be changed by SAP at any time
for any reason without notice. The information on this document is not a commitment, promise
or legal obligation to deliver any material, code or functionality. This document is provided
without a warranty of any kind, either express or implied, including but not limited to, the
implied warranties of merchantability, fitness for a particular purpose, or non-
infringement. This document is for informational purposes and may not be incorporated into a
contract. SAP assumes no responsibility for errors or omissions in this document, except if
such damages were caused by SAP intentionally or grossly negligent.
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.
Ena
Enables the strategic sourcing
pro
process across all categories of
spend
spe
Del
Delivers sourcing strategy and project
ma
management capabilities
Ma
Manages supplier identification,
qualification and on boarding
qua
Pro
Provides extensive RFI, RFQ, RFP
and Auction tools and templates
Ena
Enables effective bid negotiation,
eva
evaluation and awards
On Demand Drives rapid time to value via On
Demand Deployment and ERP
integration
Operational
Contracts
Procurement Le
Legal
L e Sales
Operational
i
Contracts
S
Sales
Procurement
Financial Leg
Legal Streamlined Negotiation Processes
■ Streamlined and controlled processes
■ Inclusion of the right stakeholders
■ Abbreviated negotiation and approval
cycles
SAP Sourcing
Project &&
Project Supplier Contracts
Contract
Sourcing
Sourcing& /
Process
Process Qualification
Supply Mgmt.& Repository & &
Management
Evaluation
Negotiation
Management
Management Performance Negotiation
Compliance(CLM)
Standard Services
Customer success manager
Onboarding and enablement
Hosting
Training
On-going support
2 new innovation waves per year
Additional Services
Event day support
Supplier support
Contracting support
Legacy contract migration
Supplier management risk profiling
Consulting services
Partner-based
SaaS (multi-tenant
OP Hosted hosted) OnDemand
Speed of
Not critical Critical
implementation
Landscape
High Low
complexity
Fast access to
Not critical Critical
innovation
Legend
User action
System activity
SAP
Delivers on-premise,
hosted, and on-demand
On-premise:
deployment options
SAP
Enables a common
experience across all
procurement solutions
On-demand: Business process Supports additional choice of
SAP outsourcing (BPO): deployment while extending
Enabled through partners existing investments
Partners
Deliver BPO offerings and
other flexible deployment
options
Localized Resources
General
Extensions
Definition
Attributes
Collections
Difference in attribute / collection storage
Browsing Extension tables
Some DO’s and DON’Ts
Bundle = cterms
Resource ID: cterm.value
Default Value: Value (what is shown if locale-specific
entry is not provided)
Locale-Specific Entries: translations for each language
Adding an attribute:
NOTE: Display After, Required and Read Only are better supported as page customizations
© 2011 SAP AG. All rights reserved. 32
Objective
Familiarize yourself with the process of creating extensions
Exercise
Based on your group and object assignments, Create Date/Time extension(s) that will
capture a “validity range”.
Extension collections are groups of attributes that allow for multiple occurrences o
The fields (a table of values) initially the collection name and internal name must be
specified
Subsequent additions to the collection are achieved by selecting “use existing collection”
and picking the proper collection
Notice the separation in the single attributes and the collection. Also notice the extra
attributes. By default these are hidden but can be exposed by….
Selecting the attribute, and changing the visibility from none to Internal Only, External
Only or Internal and External
Attributes
There is 1 table for all single attributes of an extension
definition . Each object instance has a row in the table
that contains a reference to the parent Relationship 1-1
Collections
Each collection has its own dynamic table since there
N entries for a collection per document. Relationship
1- N
Note
7-9 reference to parent object
Do consider and plan carefully. Even Don’t make a single extension field
though you can make mistakes go away Required or Read Only in the attribute
by making the extension inactive the data definition. Do that with a page
and infrastructure remain in the DB customization instead. NOTE: collection
fields cannot be affected by page
customizations should making them
Do define the value list type before adding
Required or Read Only in the extension
the extension using the value list type
definition is necessary
Objective
Familiarize yourself with the process of creating extension collections.
Exercise
Based on your group and object assignments, create an extension Collection to capture
Savings Entries. This should include:
A savings amount entry
Who entered the entry
A display of when it was entered
A field to entry comments
Hide - Remove the field from the UI – (Don’t try this on required fields)
Change Field Label - Change the text of a field – (Localized Resource)
Hide Field Label - Leave the field and just hide the label
Make editable/read-only – Make a field read-only
Change Field position – Move the filed in a relative position in the UI
Make required – Force the field to be set. (becomes part of validation)
Add Pre and Post Text – Allows for clear instruction on field content
Add Description (mouse over tool tip) same as above but temporary
Change Checkbox Label – Specialized version for checkboxes
Hide Checkbox Label – Specialized version for checkboxes
Make Price Currency read-only – Price editable Currency fixed
Object Picker – UI specific changes to pickers ( ! auto complete )
Add to Quick Create – Add this field to the Quick Create UI
Before After
Page Customizations can be conditional Dimension Field: The field ID on which the
using “dimension” capabilities conditional logic is based
If Dimension Field (which is of type Dimension Field Type: The data type
Dimension Field Type) has the value (class) of the Dimension Field
Dimension Value, then apply the page
customization override
Dimension Value: The value which will
make the condition true and apply the
Example: If DOC_TYPE (which is of type page customization override
Project Type) has the value Category
Project, then apply the page customization
override
N
NOTE: Page customizations are applied when you enter the business document only;
tthey are not applied on page refresh, save, etc. So, the dimension field should be a
value that is set before entering the business document.
v
Exercise 1 Exercise 2
Create a page customization override on Create a series of page customizations to
the project object that makes the change the order of the first 3 fields.
description field a required value.
Easy user friendly way to create page customizations. Drag and drop for positioning, Click
on field to see / set options
Supports: (Standard and Extension Fields)
Positioning of fields
Hiding fields
Making fields required
Making fields read only
Overriding field labels*
Adding tool tips*
Adding Pre Post Text*
Provides access to Value lists in that UI, and a link to add extensions
NOTE: Only users with create access to localized resources
Access to these customizations is dependent on the current users access to the master
data object or Business document.
N
Note: For objects that support Document Types select the
D
Document Type to apply the changes to.
By default customizations are dimensioned by type. If the user didn’t want this behavior or
dimension by another means, this requires direct modification of Page Customization
If internal and external visibility needs to be different on a document that supports both
these differences need to be maintained manually
No access to UDO’s
Objective
Become familiar with general and dimensioned page customizations
Exercise 1
Create a WYSIWYG override on your assigned project type that makes the description field
a required value and changes the description label to “Project type” description
Exercise 2
Create a series of WYSIWYG actions to change the order of the first 3 fields back to where
they were originally.
Assumptions
Proficient and comfortable with SQL
Basic understanding of SAP Sourcing and its use
Objectives
Gain a deeper understanding of query development in
SAP Sourcing
Learn about specific objects and how to query them
Learn tips and tricks that will assist with advanced
query development
Workshop where you can develop your own queries
with the guidance of SAP professionals
1. Introduction to Queries
2. SAP Sourcing Query Infrastructure
3. Reference Materials
4. Developing Queries
5. Additional Reporting Capabilities
6. Group Workshop
7. Schema Review
8. Advanced Reporting Concepts
9. Appendix
10. Common Errors
11. Customer Support Expectations
Queries are a major part of SAP Sourcing as they provide customizable access to data.
SAP Sourcing Query Infrastructure
A typical query is a single SQL SELECT statement. SAP Sourcing adds powerful
functionality that enhances the query development and results presentation, and provides
the integration of the SQL statement with the application.
The following slides show examples for the use of Queries in SAP Sourcing.
List Pages
Queries are used to generate List Pages
Example: All Projects Query in the example below
Project Management > Projects > All Projects
Object Pickers
Queries are used for Object Pickers
Example: “Search Organizational Units by
Name” Query in the “Organizational Unit”
picker shown below
Workbench Channels
Queries are used as content of Workbench Channels
Example: “My Projects” Query in the example below (“Projects List Channel”)
Query Groups (used for menus, lists, pickers and other selection areas)
Queries are part of Query Groups
Example: “All Projects” Query in the “FCI-ProjectBuyList” Group or the Query “Search
Organizational Units by Name” in the “FCI-BusinessUnitBuyPicker” Group
Query Group used on a menu Query Group used on a list Query Group used on a picker
Dashboards
Queries are used to provide the data for Dashboards
Example: “Contract Dashboard - Search Master Agreements and Agreements” Query in the
example below (“Contract Performance” Dashboard)
* Requires additional service from SAP Service Delivery since the Key User is not authorized to perform these tasks themselves
in the Public Edition.
Most of the elements of the SAP Sourcing Query Infrastructure can be configured in the Setup
> System Setup > Queries and Reports
The availability of some of the links (e.g. Query Definitions, Query Groups, etc.) is depending
on (tenant) security settings.
Document Reports are configured in the Setup > Document Setup > General > Document
Report Configurations.
Desktop Channels are configured in the Setup > System Setup > Workbench > Desktop
Channels
Query Definition
Includes annotated SQL (or calls stored procedures), results, filters, chart details
Allows you to Preview (NOTE: Charts not shown in preview)
Report
Collection of report elements, which can be queries or dashboards
Used on reports tab, document reports, or desktop channels
Can be emailed to users
Setup > System Setup > Queries and Reports > Reports
Query Group
Collection of Query Definitions
Used for Menus, List Pages, Pickers and other selection areas
Setup > System Setup > Queries and Reports > Query Group
Standard Query Groups are available for all business objects. Leaving no need to create
custom query groups
Custom Queries can be to added to a standard Query Group and optionally replace standard
queries
Query Groups are used for different purposes depending on the value of the their “Query Use”
field (see next slide for more details)
Setup > System Setup > Queries and Reports > Analysis Reports Setup
The content of the reports page is implemented as a hierarchy with sections and groupings
(categories, subcategories)
Main Category
Sub Category 1
Sub Category 2
Categories of all levels are only appearing in the UI if they are containing reports which are not
hidden and can be accessed by the current user
Setup > Document Setup > General > Document Report Configuration
The Document Report Configuration is used to manage the list of reports that appears in
the dropdown list for the Reports toolbar.
Locate and click the link for the business object whose reports should be customized (e.g.
“Project Document Report Configuration” to customize the report toolbar for Projects.
Use “Add [Internal/External] Report” to add (custom) reports to the report menu which will
be available for internal (buy-side) or external (sell-side) users.
Check “Open New Window” to open a report in a new (popup) Window
This option should not be used when the report has links to further reports or documents. Links
typically require breadcrumbs, but breadcrumbs are not supported in a popup window.
Use “Hidden” to hide (standard) reports
“More Details” is linking to a second report which will be opened using the entire screen
size. Most often containing the same data but with more details (columns) and/or more
rows.
Refers to 1 Analysis
Page
Refers to 1 or more
Document
Report
Refers to 1 or more Report
Has 1 or more
Picker
Has 1 or more
Query Query Is of type
Definition Group
List Page
L
The following 3 exercises require that users edit the same object (e.g.,
analysis reports setup). As a result, it is recommend that some students
begin with exercise 1, some with exercise 2, and some with exercise 3. this
will limit the delays while students wait for other students to complete their
changes.
Objective
Familiarize yourself with the Query Definition, Report,
and Analysis objects
Exercise
Find the Query Definition named: FCI-ProjectSummary
Duplicate the Query Definition – You will need to enter
the Internal Name
Add the Query Definition to a new Report
Add the Report to the Reports Page
Objective
Familiarize yourself with the Query
Definition and Query Group
Exercise
Find the Query Definition named: FCI-
DocProject
Duplicate the Query Definition, giving it a
new display name (new localized
resource)
Add the Query Definition to the FCI-
ProjectBuyList Query Group
Hide the SAP Sourcing standard FCI-
DocProject (only 1 student will be able to
do this
View the Projects list to see the new query
used
Objective
y Familiarize yourself with the Query Definition, Reports,
and Document Report Configuration
Exercise
y Find the Query Definition named: FCI-
ProjectScheduleExtract
y Duplicate the Query Definition
y Add the Query Definition to a new Report
y Find the Project Document Report Configuration
y Add the new Report to the Project Document Report
Configuration
y View the report in a Project (NOTE: The project must
have a schedule for the report to be useful)
Query Definition
Query Groups
Reports
Reference Guide
Access via “Reference Guide” Link
Class Reference
Lists ALL classes
Enables navigation from class to class
Shows database schema and column types
Includes class id (number) and logical name (string) that are used in classes
Database ERD
On-Line Help
Access via “Help” Link or via SAP Help Portal
http://help.sap.com/content/documentation/sbs/docu_sbs_esourcing.htm
Guide
Objective
Familiarize yourself with the RG
Exercise
Find the table name for Projects
Identify the table name to which the
Internal Category data member refers
Find the class logical name for RFxs
Find the class id for Vendors
Objective
Familiarize yourself with the RG
Exercise
Find the table name for Projects:
FCI_PRO_PROJECTS
Identify the table name to which the Internal Category data member refers
FCI_MAS_INTERNAL_CAT
Find the class logical name for RFxs
rfx.RFXDoc
Find the class id for Vendors
607
Query
SQL statement to be executed. Includes query attributes for advanced capabilities
Result Fields
Definition of result fields and their visibility and sort order
Filter Prompts
Definition of filter prompts
Chart Definition
Definition of chart(s)
Access List
List of users, groups and companies who are authorized to edit and/or execute the query
© 2011
1 SAP
S AG
AG. All rights reserved. 117
Database Column Name – The SQL for the column (can be a simple column name, a complex
sub-select, or anything in between)
Display indicator – Allows fields to be hidden (useful when wanting to setup special
columns for sort order)
Column Header Resource – The string displayed for the column in the result set
Hide column header – Allows column headers to be hidden (recommended for columns
that contain some action icons, like Delete or Edit)
Column Type – The type of data being returned (also specialized column types for drill
downs, hyperlinks, etc.)
Repeating Column – Columns with this indicator in a pivot query will be expanded to
multiple columns
Default Display – Indicates whether this column will be displayed to the end user by
default
Sort Order – Indicates the number within the sort for this column only applies when the
<%ORDERBY%> token is part of the Query String.
Ascending Indicator – Indicates whether the sorting direction should be ascending or
descending
<%RESULTS%> token will be replaced by SQL generated based on the defined result
fields
<%SCHEMA%> token ensures that the proper database schema is used
<%?(ParameterName)%> token refers to the filter prompt with the defined parameter name
(value of the Column ID field)
<%ORDERBY%> token enforces desired ordering as defined on the Result Fields tab
Ensure that each table is joined to avoid Cartesian joins
Filter out Cancelled and Closed documents with INACTIVE = 0
Filter out document templates with IS_TEMPLATE = 0
Ensure documents from the correct context are included with <%CONTEXT%> token
Use UPPER to allow filtering to be case-insensitive. Also make sure to check “Convert to
Upper Case” for the Query Parameter.
© 2011 SAP AG. All rights reserved. 122
Objective
Create a basic query
Exercise
Create and preview a query
definition for Projects that
retrieves the project name
Column names can be found in Browse Extension Schema (they don’t always match the
extension attribute internal name)
Objective
Create a query using an extension table
Exercise
Modify the query created in Exercise 5
adding in a string extension field
(PROContractor) to the result set
Query
Result Fields
and Details
Key columns
OBJECTID
Numeric identifier for this object
CONTEXTID
SAP Sourcing has the concept of multiple enterprises being able to reside in the same Oracle
database
Used in where clause with <%CONTEXT()%> token
UNIQUE_DOC_NAME
Unique key for the object
In many cases this is automatically generated by a numbering table or some other mechanism
DISPLAY_NAME
Human readable name for object
Parameter Name
A string with no spaces. If the same name is used multiple times, the parameter will only be displayed
once
Prompt Message Resource
The string the user will see next to the prompt in the user interface
Default Value
The default value for the prompt (has specialized value when doing Object Reference prompts)
Get Token
Use data from the current or parent business object as default value
Data Type
The type of prompt field
Value List Type
For value list prompts, indicates which value list to use
Default Operator
Default operator used for this parameter
Filter prompts are typically going to be used by a user, but can be “hard-coded”
Objective
Add an object reference filter to a query
Exercise
Modify the query created in Exercise 5/6,
adding in a Filter Prompt of type Object
Reference to filter for projects by the owner
(a user)
Query
Execution:
SQL: <%AND_OP("UPPER(T1.DISPLAY_NAME)",<%?(DisplayName)%>)%>
Filter Prompt:
Online Help
SAP Sourcing > Setup > System Setup > Queries and Reports > Query Definition: Attribute
Substitution
Alternative: the LOAD_PAGE token can be utilized, but is not commonly used
Example:
SELECT T1.DISPLAY_NAME, COUNT(T2.OBJECTID) FROM FCI_RFX_DOC T1,
FCI_RFX_VENDOR T2 WHERE T2.PARENT_OBJECT_ID = T1.OBJECTID GROUP BY
T1.DISPLAY_NAME
Objective
Create a query using an aggregate function
Use the string concatenation token
Exercise
Create a project query that has two columns:
Project Status, including the total number of projects in that status
Value: the sum of all projects in the status
The results will look like:
Query
Result Fields
Report drill downs are very useful for allowing navigation to increasing levels of detail
For example, a summary report may show the total number of projects by category.
Clicking on the number of projects (a drill down) could show a listing of the individual
projects
Show the RFx Summary Report by Workflow Phase report (Enterprise Sourcing WB)
SAP Sourcing supports various chart types (Variations of Bars, lines, Pies, Radars)
Show the RFx Summary Report by Workflow Phase report (Enterprise Sourcing WB)
Desktop
Report
Channel
Query
Query
Definitions
Query
Definitions
Definitions
Chart
Charts Chart
Charts Definitions
Chart
Charts Definitions
Definitions
Chart Type
Chart types in this drop down are dynamically shown
based on the selection of two combinations:
1 dimension, 1 measure
2 dimensions, 1 measure
Chart selected here would be treated as default chart.
Multiple chart types would be shown at run time and end
users can change from the default chart to the chart of
there choice.
Disable Multiple Chart Selection
Users can not change the chart type
Column Containing Label for Data
The non numeric result fields defined in the query. This is
default dimension.
Column Containing Data
The column which provides the numeric data for the chart
elements. This is a measure.
Each row in the result set that does not have a value for the
data column will not be represented in the chart. If none of
the rows has a value for the data column, the chart is
suppressed.
© 2011 SAP AG. All rights reserved. 153
Key tables
FCI_MAS_VENDOR
FCI_MAS_CONTACT
Interesting columns
EXTERNAL_ID is the primary key and also refers to the SAP number
Joins
FCI_MAS_CONTACT.PARENT_OBJECT_ID Æ FCI_MAS_VENDOR.OBJECTID
Key tables
FCI_RFX_DOC
FCI_RFX_VENDOR
FCI_RFX_RESPONSE
FCI_ONT_LINE_ITEM
Interesting columns
FCI_RFX_DOC.CURRENT_PHASE is an enum
FCI_RFX_DOC. DUE_DATE_DATETIME
Joins
FCI_RFX_VENDOR.PARENT_OBJECT_ID Æ FCI_RFX_DOC.OBJECTID
FCI_RFX_RESPONSE.PARENT_OBJECT_ID Æ FCI_RFX_DOC.OBJECTID
FCI_ONT_LINE_ITEM.PARENT_OBJECT_ID Æ FCI_RFX_DOC.OBJECTID
Key tables
FCI_CONTRACT – Master Agreement
FCI_AGREEMENT – Sub Agreement
FCI_CONTRACT_LINEITEM – Line items (for both objects)
Interesting columns
VENDOR_OBJECT_NAME – Vendor
EFFECTIVE_DATE_DATE
EXPIRATION_DATE_DATE
Joins
FCI_AGREEMENT.PARENT_OBJECT_ID --> FCI_CONTRACT.OBJECTID
FCI_CONTRACT_LINEITEM.PARENT_CLASS_ID = xxx AND
FCI_CONTRACT_LINEITEM.PARENT_OBJECT_ID = yyy.OBJECTID
Key tables
FCI_AUCT_AUCTION_EVENT
FCI_AUCT_BIDDERS
FCI_AUCT_LINE_ITEMS
Joins
FCI_AUCT_BIDDERS.PARENT_OBJECT_ID ->
FCI_AUCT_AUCTION_EVENT.OBJECTID
FCI_AUCT_LINE_ITEMS.PARENT_OBJECT_ID ->
FCI_AUCT_AUCTION_EVENT.OBJECTID
Key tables
FCI_PRO_PROJECTS
FCI_PRO_SCHEDITEMS
FCI_PRO_VENDOR
Interesting columns
FCI_PRO_PROJECTS.PLANNED_xxx_DATE
FCI_PRO_PROJECTS.ACTUAL_xxx_DATE
FCI_PRO_VENDOR.VENDOR_OBJECT_NAME
FCI_PRO_SCHEDITEMS.DISPLAY_NAME
Joins
FCI_PRO_SCHEDITEMS.PARENT_OBJECT_ID Æ FCI_PRO_PROJECTS.OBJECTID
FCI_PRO_VENDOR.PARENT_OBJECT_ID Æ FCI_PRO_PROJECTS.OBJECTID
Key tables
FCI_DOC_LINK
FCI_DOC_COLLABORATOR
Interesting columns
PARENT_CLASS_ID: Identifies class that a record is used with
Joins
FCI_DOC_LINK.PARENT_CLASS_ID = xxx AND FCI_DOC_LINK.PARENT_OBJECT_ID =
yyy.OBJECTID
FCI_DOC_COLLABORATOR.PARENT_CLASS_ID = xxx AND
FCI_DOC_COLLABORATOR.PARENT_OBJECT_ID = yyy.OBJECTID
There are four types or groups of database functions recommended for use:
SAP Sourcing User Defined functions which provide a common interface to commonly
available database functionality for which a common interface is not available. Example
datetime functions
SAP Sourcing defined replaceable tokens which provide a common interface to common
database functionality where only the name varies among database platforms.
SAP Sourcing defined user defined functions which provide application specific
functionality.
A small set of database built-in functions which are believed to be syntactically and
semantically equivalent across the range of supported Database Management System
(DBMS)
A list of supported functions and token can be found in the embedded Excel Worksheet.
Although it is possible to use DBMS provided functions it is recommended to refrain from using
functions whose syntax and semantics may vary from DBMS to DBMS or which are not
universally supported such as OLAP functions; “ROWNUM” and “RANK” being prime examples.
The query definition provides a couple different ways to perform currency conversions
Approach 1:
Monetary Currency columns can be converted to the User Currency, Organization
Currency, or a specified Currency
Approach 2:
The SAP Sourcing FCI_DOC_CUR_CONVERT function can be used
In certain cases, it is convenient to show a comma separated list of values in a single cell in
a result set
For example, show all of the collaborators (comma separated) on a document when
querying over a list of documents
This function can cause performance issues with a query – it should be used judiciously
Example: Report should only be available to System Administrators -> Add the System
Administrators User Group to the Access List of the Report
A populated Access List means the report is restricted to the listed users
Some requirements necessitate that a specific value list value be the default value in a
report
For example, suppose a report could be run for a year, where the filter prompt was a year
value list. It likely would be desirable for the value list to default to the current year.
Unfortunately, there is no way to have it auto populate the year based on the date.
But, the year can be defaulted by using the default value on the filter prompt
The value for the default value MUST BE THE DISPLAY NAME ID from the value list value
(not the display name resource)
To default the VLV filter to “none”, use the following construct in the default value: <Internal
Id>:616:NULL (e.g., for MA Status: 10:616:NULL)
To have the date filter default to the current day, use the token <%TODAY%> for the default
value
To have the date filter default to a specific date, the default date value MUST BE
FORMATTED AS:
YYYY/MM/DD
NOTE: The construct <%TODAY%> - x could also be used in the WHERE clause of the SQL to
subtract days from today
As of SAP Sourcing 7.0 the following Database Management Systems (DBMS) are supported:
IBM DB2 9.7
Oracle 10.2 (SP 04) and 11.x
SQL Constructs
There are differences in the SQL constructs among DMBS vendors . The Word document
provides guidelines for writing SQL which is portable across the set of Database
Management Systems (DBMs) supported by the SAP Sourcing product .These guidelines
are not exhaustive.
(Custom) Queries can be added to Menus by adding them to the Query Groups which are
used in the Menu.
The corresponding query groups need to be located by inspecting the “SRM Navigation
Group“ inside the “System Navigation Tabset (Buyside)” System Toolbar.
URL Parameters are used for drill down reports to pass parameter values
&reportFormatDirectives=
suppressTableGrid
suppressTableColumnHeaders
suppressTableToolbar
Configured via an XML file that is uploaded to the File Attachment Container
Workbook Templates: Excel workbook templates can be setup for a report “Export to Excel”
option
The option exists on both the Query Definition and the Report (most likely the one to use)
via the “Workbook Template” field
The Workbook Template is a reference to a File Attachment Container (Setup > User
Interface > File Attachment Containers), which contains the Excel workbook: create the File
Attachment Container first, the reference it on the Report
The Excel workbook can contain additional sheets, formulas, and VBA
Technique 1: The results contain a value list value and it is desirable to show an image
for that value.
Each value in the value list value should have a corresponding localized resource with a
“.image” suffix
The value of the localized resource for the “.image” should be something like
“/customimages/xxx.jpg”
Each image should be uploaded as a file attachment container with the path name like
“/customimages/xxx.jpg”
The query should select the “DISPLAY_NAME_ID” of the value list value using column type
“String Resource”
Attached XLS creates a VLV and Project extension
QUERY STRING:
SELECT <%RESULTS%> FROM <%SCHEMA%>.FCI_PRO_PROJECTS T1 JOIN
<%EXT_TABLE(projects.projects)%> T2 ON T2.PARENT_OBJECT_ID = T1.OBJECTID
LEFT OUTER JOIN <%SCHEMA%>.FCI_MAS_VALUE_LIST_VALUE T3 ON
T2.STAR_RATING_OBJECT_ID = T3.OBJECTID WHERE T1.INACTIVE = 0 AND
T1.IS_TEMPLATE = 0 AND T1.CONTEXTID = <%CONTEXT(projects.projects)%> AND
T1.DOC_OWNER_USER_OBJECT_ID = <%CURRENT_USER_ID%>
QUERY COLUMNS:
T1.OBJECTID
1100
T1.UNIQUE_DOC_NAME
T3.DISPLAY_NAME_ID
SQL:
SELECT <%RESULTS%> FROM <%SCHEMA%>.FCI_PRO_PROJECTS T1
<%DYN_JOIN%>
WHERE T1.IS_TEMPLATE=0 AND T1.CONTEXTID=<%CONTEXT(projects.projects)%>
<%AND_OP("UPPER(T1.DISPLAY_NAME)",<%?(DisplayName)%>)%>
<%DYN_FILTER%>
These tokens are used to enable the Advanced List Page (adding/removing columns/filters)
Both tokens have to be in the SQL.
At least one manually entered condition should be placed before the <%DYN_FILTER%>
token, because the first term in the resolved token will be AND.
Extensions will automatically be included in the list of available fields
The list of available fields can not be modified
NOTE: These tokens will not work with UNION statements (e.g., there is no way to use these
tokens in the combined Master Agreement / Sub-Agreement UNION queries).
Objective
Create a query which is utilizing optional filter Prompts
Exercise
Modify a query from one of the previous exercises
Add at least one query parameter with the “AND” and
at least one with the “AND_OP” token
Utilize the “DYN_JOIN” and “DYN_FILTER” tokens
Add the Query Definition to the FCI-ProjectBuyList
Query Group
The following Master Data objects have localized names and descriptions:
Material, Plant, Location, Currency, External Category, Internal Category, Unit of Measure,
Payment Terms, Currency Code, UOM ISO, Company Code, Inco Term, Transaction Type,
Purchasing Organization, Purchasing Group, Vendor Account Group, ERP Region, Logical
System
Three tokens are used to support filter and display of localized Master Data using the
language of the end user
<%MS_JOIN%> – This token should be placed in the FROM clause.
If <%DYN_JOIN%> is present, don’t use <%MS_JOIN%> since it will automatically insert a
<%MS_JOIN%> token
Example:
SELECT <%RESULTS%> FROM <%SCHEMA%>.FCI_MAS_MATERIAL
<%MS_JOIN%> WHERE
<%MS_NAME_FILTER(T1,masterdata.Material,SearchMaterial)%>
© 2011 SAP AG. All rights reserved. 183
This token can also be used in the filter to enable searching localized values based on the
current user’s locale:
Example:
<%AND_OP("UPPER(<%MS(T1.NAME_MSDEFAULT,masterdata.Material)%>)",<%?(Se
archMaterial)%>)%>
© 2011 SAP AG. All rights reserved. 184
Setup > System Setup > User Interface > System Toolbars
Search for “eso.system.toolbar.navigation”
Click on “System Navigation Tabset (Buyside)”
Collapse “Spend and Compliance”
The name of the used Query Group follows
“Dyn(amic) entry for” (e.g. “FCI-ProjectBuyList”)
j y
Locate and edit the Query Group
roup
{CALL
<%SCHEMA%>.CUSTOM_SAVINGS_EXPORT_QRY.CUSTOM_SAVINGS_EXPORT(?,'<%
EXT_TABLE(projects.projects)%>',
'<%EXT_TABLE(projects.projects,PROJ_SAVINGS)%>',
<%CONTEXT(projects.projects)%>)}
Note that the first parameter (the ?) is the cursor and is mandatory
Note also quotes around the tokens that are VARCHAR2. This cause an obscure error if
you omit.
© SAP
Desktop
Report
Channel
Query
Query
Definitions
Query
Definitions
Definitions
Dashboard Dashboard
(Adobe Flash File) Definition
© 2011 SAP AG. All rights reserved. 190
Rich set of chart types and UI components for best data visualization.
Interactive.
Combine external data sources with query results from SAP Sourcing.
Consistent UI
Use “Phase” theme for all dashboards. Choose “Phase” theme at the beginning of your
dashboard project to avoid having to reapply custom colors
The font for all labels, tabs, legends and texts should be Arial 11. For dashboard title, the
font size could be up to Arial 14.
Bold texts for dashboard title and section title only. Do not bold texts for column headers,
tabs, buttons, and error messages.
For a full page dashboard, set Canvas size to 900 (width) by 600 (height) which works with
most browsers and screen resolutions.
Refer to SAP Sourcing application form and table for layout. All field labels should be right
aligned whereas all table headers should be left aligned.
FCI-AuctionsRFxsCompletedByMonthData
Error:
ORA-00933: SQL command not properly ended
SQL String:
SELECT T1.DISPLAY_NAME FROM FCI_MAS_VENDOR T1 WHERE
<%CONTEXT(masterData.Vendor)%> AND INACTIVE=0
PROBLEM: Context token did not resolve correctly (this is known because the token is still
in the SQL statement). The class name is case sensitive and should be:
masterdata.Vendor. Notice, also, that the value of the context token is not compared to
T1.CONTEXTID
Error:
The Number result set item for Suppliers by Name in row 1, column 1 could not be
prepared for display. getBigDecimal Failed on value (Plant Oregon) in column 1
SQL String:
SELECT T1.DISPLAY_NAME FROM FCI_MAS_VENDOR T1 WHERE CONTEXTID=-
2147483548 AND T1.INACTIVE=0
Error:
ORA-00942: table or view does not exist
SQL String:
SELECT T1.OBJECTID, 900 AS CLASSID, T1.DISPLAY_NAME,
T1.DUE_DATE_DATETIME, T1.DOC_OWNER_USER_OBJECT_NAME FROM
rfx.RFXDoc T1 WHERE T1.CONTEXTID=-2147483548 AND T1.IS_TEMPLATE=0 AND
T1.INACTIVE=0 ORDER BY 4 DESC
PROBLEM: The class name was used instead of the table name. Table names begin with
“FCI_” or “ODP_”
Error:
Result field items are grouped incorrectly based on column type. See product
documentation for correct ordering of result field column types.
PROBLEM: This error happens on save of a query definition. This means that 1 of a set of
group columns is not the correct type. For example, if you are doing a drill down to a
document using 3 columns (Object ID, Class ID, and Display Name), one of the column
types is not specified correctly. This error will also happen when showing price or quantity
columns
© 2011 SAP AG. All rights reserved. 203
Error:
ORA-00920: invalid relational operator
SQL String:
SELECT T1.OBJECTID, 900 AS CLASSID, T1.DISPLAY_NAME,
T1.DUE_DATE_DATETIME, T1.DOC_OWNER_USER_OBJECT_NAME FROM
rfx.RFXDoc T1 WHERE T1.CONTEXTID-2147483548 AND T1.IS_TEMPLATE=0 AND
T1.INACTIVE=0 ORDER BY 4 DESC
PROBLEM: Notice that CONTEXTID is not compared to the value of the CONTEXT token.
The equals sign is missing.
Error:
ORA-00904: "T"."DOCUMENT_DESCRIPTION": invalid identifier 1
SQL String:
SELECT T1.OBJECTID, T1.STATUS_OBJECT_ID,
T1.DOC_OWNER_USER_OBJECT_NAME, T.DOCUMENT_DESCRIPTION FROM
FCI_PRO_PROJECTS T1
PROBLEM: The table alias T1 is not used with the column. T.DOCUMENT_DESCRIPTION
should be changed to T1.DOCUMENT_DESCRIPTION
Error:
ORA-00937: not a single-group group function
SQL String:
SELECT T1.OBJECTID, 1100, T1.DISPLAY_NAME, T2.DISPLAY_NAME,
T1.DOC_OWNER_USER_OBJECT_NAME, T1.DOCUMENT_DESCRIPTION, Count
(T3.OBJECTID) FROM FCI_PRO_PROJECTS T1, FCI_MAS_VALUE_LIST_VALUE T2,
FCI_DOC_COLLABORATOR T3 WHERE T1.STATUS_OBJECT_ID = T2.OBJECTID AND
T1.OBJECTID = T3.PARENT_OBJECT_ID AND T3.PARENT_CLASS_ID = '1100'
Error:
The query is not sorted but columns are setup with sort
Error:
ORA-01008: not all variables bound
SQL String:
SELECT P.OBJECTID, 1100, P.DISPLAY_NAME, PE.PROCONTRACTOR, 'SAP',
'http://www.sap.com' FROM FCI_PRO_PROJECTS P, FCI_DYN_$2147483472 PE
WHERE P.INACTIVE = 0 AND P.IS_TEMPLATE = 0 AND P.CONTEXTID = -2147483548
AND PE.PARENT_OBJECT_ID = P.OBJECTID AND UPPER(P.DISPLAY_NAME) LIKE
UPPER(?) AND UPPER(P.DOC_OWNER_USER_OBJECT_NAME) LIKE UPPER(?)
ORDER BY 3
PROBLEM: The number of ?’s in the query is more than the number of filters configured on
the Filter Prompts tab in the query definition
SQL String:
SELECT T1.UNIQUE_DOC_NAME, DECODE( FCI_DOC_CHECKCOLLAB(T1.OBJECTID, 1004,-2147483544,'-
2147483537'),0,null,'/contracts/contracts_summary,' || T1.OBJECTID || ':1004?rqaction=load&link_crumb=true&hook=contract_uirq'), NULL AS
UNIQUE_DOC_NAME, NULL AS AGREEMENT_LINK, T1.DISPLAY_NAME, T1.VENDOR_OBJECT_NAME, T3.DISPLAY_NAME_ID,
T1.INT_CAT_OBJECT_NAME, T1.BUSINESS_UNIT_OBJECT_NAME, T1.EFFECTIVE_DATE_DATE, T1.RENEWAL_REMINDER_DATE,
T1.EXPIRATION_DATE_DATE, T1.LAST_AUDIT_DATE, T1.NEXT_AUDIT_DATE, NVL(T2.EXPECTED,0) +
NVL(T1.TOTAL_EXPECTED_PRICE, 0), NVL(T1.TOTAL_EXPECTED_CURRENCY,'USD'), NVL(T2.SAVINGS,0) +
NVL(T1.TOTAL_SAVINGS_PRICE, 0), T1.CURRENCY_OBJECT_NAME, T1.DOC_OWNER_USER_OBJECT_NAME, DECODE(
FCI_DOC_CHECKACTIVECOLLAB(T1.OBJECTID, 1004,-2147483544,'-2147483537'), 0, 'SILENT', NULL), CEXT.SW_SUPP_HOURS FROM
FCI_CONTRACT T1, FCI_DYN_$2147483468 CEXT, FCI_MAS_VALUE_LIST_VALUE T3 , (SELECT NVL(SUM(TOTAL_EXPECTED_PRICE),0)
AS EXPECTED, NVL(SUM(TOTAL_SAVINGS_PRICE),0) AS SAVINGS, PARENT_OBJECT_ID FROM FCI_AGREEMENT WHERE INACTIVE=0
AND IS_TEMPLATE=0 AND CONTEXTID = -2147483548 GROUP BY PARENT_OBJECT_ID) T2 WHERE T1.INACTIVE = 0 AND
T1.IS_TEMPLATE=0 AND T1.CONTEXTID = -2147483548 AND T1.STATUS_OBJECT_ID = T3.OBJECTID AND
T1.OBJECTID=T2.PARENT_OBJECT_ID(+) AND ( FCI_DOC_CHECKCOLLAB(T1.OBJECTID, 1004,-2147483544,'-2147483537') = 1) AND
((0=0) OR (T1.DOC_OWNER_USER_OBJECT_ID=-2147483544)) AND CEXT.PARENT_OBJECT_ID = T1.OBJECTID UNION ALL SELECT
T1.UNIQUE_DOC_NAME, NULL, T2.UNIQUE_DOC_NAME, DECODE( FCI_DOC_CHECKCOLLAB(T2.OBJECTID,1003,-2147483544,'-
2147483537'),0,null,'/contracts/agreements/agreements_summary,' || T2.OBJECTID ||
':1003?rqaction=load&link_crumb=true&hook=agreement_uirq'), T2.DISPLAY_NAME, T2.VENDOR_OBJECT_NAME, T3.DISPLAY_NAME_ID,
T2.INT_CAT_OBJECT_NAME, T2.BUSINESS_UNIT_OBJECT_NAME, T2.EFFECTIVE_DATE_DATE, T2.RENEWAL_REMINDER_DATE,
T2.EXPIRATION_DATE_DATE, T2.LAST_AUDIT_DATE, T2.NEXT_AUDIT_DATE, NVL(T2.TOTAL_EXPECTED_PRICE, 0) AS TOTALVALUE,
NVL(T2.TOTAL_EXPECTED_CURRENCY,'USD'), NVL(T2.TOTAL_SAVINGS_PRICE, 0), T1.CURRENCY_OBJECT_NAME,
T2.DOC_OWNER_USER_OBJECT_NAME, DECODE( FCI_DOC_CHECKACTIVECOLLAB(T2.OBJECTID, 1003,-2147483544,'-2147483537'), 0,
'SILENT', NULL) FROM FCI_CONTRACT T1, FCI_AGREEMENT T2, FCI_MAS_VALUE_LIST_VALUE T3 WHERE T2.INACTIVE = 0 AND
T2.IS_TEMPLATE=0 AND T2.CONTEXTID = -2147483548 AND T2.STATUS_OBJECT_ID = T3.OBJECTID AND T1.OBJECTID =
T2.PARENT_OBJECT_ID AND T2.PARENT_CLASS_ID = 1004 AND T2.PARENT_COLLN_ID = 1 AND (
FCI_DOC_CHECKCOLLAB(T2.OBJECTID, 1003,-2147483544
PROBLEM: This query is using a Union over the Contract and Sub-Agreements objects.
The error is because the number of columns selected in the first select of the union does
not match the number of columns selected in the second select of the union.
© 2011 SAP AG. All rights reserved. 207
Result:
TEACHER_NAME STUDENT_NAME
ROB JOHN
VIKRAM ALEX
Result:
TEACHER_NAME STUDENT_NAME
ROB JOHN
VIKRAM ALEX
FRANK -
GARY -
Result:
TEACHER_NAME STUDENT_NAME
ROB JOHN
VIKRAM ALEX
- MIKE
- MARY
Agenda
Section 1: Business Rule Designer
Section 2: Introduction to Scripting
Section 3: Integration APIs (IAPIs)
Section 4: Script Definition Details
Section 5: Coding Best Practices
Exercises throughout
Expectations
SAP Sourcing Scripting requires coding in a Java-like language called Beanshell; as a
result, students must be capable with a high-level programming language (Java preferable)
to complete the exercises successfully
What is BRD?
Tool to incorporate simple custom business logic
Intended to be used by business users that understand the business requirement
Business Requirement
Generate an error if the Project risk is red and the reason is not provided
Validate
Create / Update Project is at Project Risk is
REASON is End
Project Risk set to RED
populated
Rule design for Project Validated
Rule checks if risk = red and reason is empty
BRD
Ensure Check for Diversity flag is checked before proceeding to next RFx phase
Rule Designs
Context: Document Lifecycle Event, Field Validation, Toolbar, Field Data Edit, Import
Class
Demo of Rule Design to ensure Risk Reason is provided when Risk is set to Red
Document Lifecycle
Loaded
Created
Duplicated
Pre Phase Change
Post Phase Change
Validated
Saved
Pre-Publish to ERP
Field Validation
Field Data Edit
Toolbar
Import Lifecycle
Process Row
Field Data Edit: Executed when user clicks Save and field has changed; prior to
system and script validation; not called on new document; errors stop execution
of system and script validation.
Validated: Executed when user clicks Save AND there are changes to the
document; after system validation
Field Validation: Executed after system and script validation; only called if field
has been changed (or on a new document).
Saved: Executed after save to database, but prior to transaction commit; only
executed if validations did not result in error.
Created: Executed when a document is created.
Duplicated: Executed when a document is duplicated (NOTE: Create from
Template results in a Duplicated event, not Created)
Loaded: Executed when a document is loaded from the database.
Process Row: Executed on the object before it is validated
Rule Designs consist of individual conditions and actions configured in the Rule
Definition (a Rule Design can have multiple Rule Definitions)
addCompanyCollaborator
addGroupCollaborator
addUserCollaborator
and
changeOwner
changePhase
clear field
endif
generateError
if
or
set
then
Objective
Create a Business Rule Design
Exercise
Create your own Project Type (this will
allow each user to create a similar
validation script)
Use the BRD to create a validation that
ensures that either both the estimated
value and budgeted values are empty or
populated.
An error should be generated if one is
populated and the other is not
The script definition code generated by the BRD should not be used as a
starting point for script definition code. It uses different coding
techniques.
What is Scripting?
A way to add functionality to the system without changing code (NOTE: Source code is not
provided with the system and cannot ever be modified by services, a customer, or a
partner)
The functionality is implemented by adding computer code into the system
Source code fragments are added into the system using the open source BeanShell
Scripting Language (“Lightweight Scripting for Java”)
Custom code interacts with standard Sourcing/CLM objects using Integration APIs (IAPIs)
The custom code is initiated on various “user initiated” events, for example:
Saving a document (user chooses save)
Opening a document (user chooses a document link on a list page)
Creating a document (user chooses the create button)
The custom code is associated with an object class (e.g., Projects) and a even (e.g.,
Validated)
Scripts can be found in: Setup > System Setup > Integration > Script Definition
Validations
Required fields based on some criteria
Field values dependent on other field values
Ensuring field content is valid
Ensuring specific data is populated before transitioning to a new document phase
Integration
Making a call to a web service to push or pull data
Putting data into a specific location for the purposes of integration
User actions
Implement business process or workflow like functionality through “actions” performed by
the user
© 2011 SAP AG. All rights reserved. 236
Scripting should also not be used when the operation requires significant
processing time
Scripts are executed in real-time
Lengthy operations will impact the user experience
Collections can be retrieved, iterated over, added to, and have elements remove
The JavaDocs link is available on the Index page of the Reference Guide
JavaDocs can also be found from within the class information for an object
Example: In the user interface, go to an RFx, choose Reference Guide >
If there is a need for an object not covered in the IAPI JavaDoc, contact
Customer Support to enter a request.
© 2011 SA
SAP AG. All rights reserved. 242
Objective
Familiarize the user with the Sourcing/CLM
JavaDocs
Exercise
What class and method would be used to
set the Product Category value on an
RFx?
What method calls would be required to
get the numeric value of the Estimated
Value of a Project?
What method calls would be required to
get the number of collaborators on an
Auction? What classes would be used?
What class and method would be used to set the Product Category value on an
RFx?
RfxDocIBeanIfc, setIntCategory
What method calls would be required to get the numeric value of the Estimated
Value of a Project?
getEstimatedValue() which returns a PriceIfc
getPrice() on the PriceIfc which returns a BigDecimal
doubleValue() on BigDecimal to get the value
For the most part, using standard procedural Java code is fine
Some minor syntax options:
&& can also be done with @and
|| can also be done with @or
“for” syntax options as well
When a script is created, the “context” for the script must be selected. The choices are:
Document Lifecycle
Loaded
Created
Duplicated
Pre Phase Change
Post Phase Change
Validated
Saved
Pre-Publish to ERP
Collection Validation
Field Validation
Field Data Edit
Toolbar
Import Lifecycle
Init, Pre-Process Row, Should Process Row, Process Row, Ok to Save, Save, Final
Field Data Edit: Executed when user clicks Save and field has changed; prior to
system and script validation; not called on new document; errors stop execution
of system and script validation.
Validated: Executed when user clicks Save AND there are changes to the
document; after system validation
Field Validation: Executed after system and script validation; only called if field
has been changed (or on a new document).
Collection Validation: Executed after system and script validation and after field
validations.
Saved: Executed after save to database, but prior to transaction commit; only
executed if validations did not result in error.
Created: Executed when a document is created.
Duplicated: Executed when a document is duplicated (NOTE: Create from
Template results in a Duplicated event, not Created)
Loaded: Executed when a document is loaded from the database.
Init: Executed at the beginning of file processing. No record or document data is available.
Pre-Process Row: Allows access to the inbound data before the document has been
created
Should Process Row: Gives the opportunity to reject the import of a particular row.
Process Row: Gives the opportunity to manipulate the newly created “doc” before it is
saved. Executed after creation, but before document lifecycle validated script.
Final: Executed at the end of the file processing. No record or document data is available.
Certain variables are made available to the script to provide contextual access to
information and business documents in the system
y Always populated
– doc: the document on which the script is executing
– session: the current users session
y Document Duplication
– otherDoc: the document being duplicated
Collection Validation
collection: the collection object being validated
Objective
Familiarize the user with the Script Definition object
Exercise
Create your own Project Type for this exercise
Create a script definition that sets the description of a
Project to the value “Set from Script Definition” when
the user clicks save
Create a new instance of the object to test the script
The script definition should use the context: Document Lifecycle and the Validated target.
Toolbar scripts are menu items that trigger the script code
Objective
Familiarize the user with toolbar scripts
Exercise
Create your own Project Type for this exercise
Create a toolbar script definition that sets the
description of an object to the value “Set from Script
Definition” when the user chooses the menu choice
Create a new instance of the object to test the script
Common pattern should be used in all scripts for accumulating and throwing
exceptions
Create ApplicationException at the top of the script
Accumulate exceptions using chainAtEnd and doc.createApplicationException
Throw the exception at the end of the script if any exceptions were accumulated
Common pattern should be used in all scripts for accumulating and throwing
exceptions related to collection iterations
y Throw the exception at the end of the script if any exceptions were accumulated
Objective
Work with error messages
Exercise
Create your own Project Type for this exercise
Create a script definition that generates an error when
the description of the object starts with “Set from Script
Definition”
Create a new instance of the object to test the script
When there are errors in the script definition, the message presented to the user
can be confusing an not meaningful
It can be helpful to include a “preceding comment” in the first line of the script
code to provide a slightly better message
/* Error in setting the document description */
import com.sap.odp.api.common.db.metadata.*;
import com.sap.odp.api.common.exception.*;
import com.sap.odp.api.common.log.*;
import com.sap.odp.api.common.platform.*;
import com.sap.odp.api.common.types.*;
import com.sap.odp.api.doc.*;
import com.sap.odp.api.ibean.*;
import com.sap.odp.api.ibean.metadata.*;
import com.sap.odp.api.util.*;
import com.sap.odp.api.common.importer.*;
import com.sap.odp.common.platform.*;
import java.math.*;
Any classes used in packages not imported will need to be explicitly imported in the script
Value list values with the None value will return FALSE (None is not a
valid value)
Example:
if (hasValue(doc.getDocumentDescription()))
Home Class
Used to access Lifecycle methods of a business document
Create
Finders
Save
ChangePhase
Bean Class
Used to access data fields on a business document
All top-level business documents have a Home class and a Bean class
Example:
ProjectIBeanHomeIfc and ProjectIBeanIfc
ContractIBeanHomeIfc and ContractIBean
RfxDocIBeanHomeIfc and RfxDocIBeanIfc
VendorIBeanHomeIfc and VendorIBeanIfc
© 2011 SAP AG. All rights reserved. 269
Example: Using the home interface of suppliers to retrieve the supplier object for a
master agreement (perhaps to lookup some supplier data)
Contracts Module:
Package: import com.sap.eso.api.contracts.*;
Classes:
ContractIBeanHomeIfc – Master Agreement Home
ContractIBeanIfc – Master Agreement Bean
AgreementIBeanHomeIfc – Sub Agreement Home
AgreementIBeanIfc – Sub Agreement Bean
ContractDocumentIBeanHomeIfc – Contract Document Home
ContractDocumentIBeanIfc – Contract Document Bean
Projects Module:
Package: import com.sap.eso.api.projects.*;
Classes:
ProjectIBeanHomeIfc – Project Home
ProjectIBeanIfc – Project Bean
ProjectSchedItemIBeanIfc – Project Schedule Item
Vendors Module:
Package: import com.sap.odp.api.doccommon.masterdata.*;
Classes:
VendorIBeanHomeIfc – Vendor Home
VendorIBeanIfc – Vendor Bean
Important classes
ExtensionFieldIfc
ExtensionCollectionIfc
ExtensionCollectionMemberIfc
IapiDocumentLockManager
Provides methods to lock / unlock entire documents as well as individual fields on a
document
IapiDBHandleIfc
Accessed from the session variable
Provides methods for querying the database
IapiSessionContextIfc
Available via session variable
Access to dbHandle
Access to current logged in user information
IBeanHomeLocator
Provides methods to get Home instance for a given class
Logger / LogMessageIfc
Provides methods for logging to standard E-Sourcing log file
IapiQueryExecIfc
Ability to execute Sourcing / CLM query definitions
IapiQueryResultSetIfc
Query definition results
ImportRecordIfc
Class associated with a record in the import lifecycle script targets
Logging
logMsg = Logger.createLogMessage(session);
logMsg.setLogMessage("*****MSG GOES HERE*****");
Logger.info(logMsg);
IapiDbHandlIeIfc has very specific coding protocols to ensure proper transaction management
finally
// retrieve the handle from the session. {
dbHandle = session.getUserTransaction(); // this try...finally with optional catch blocks is not necessarily
// only way but is by the far the simplest way
// outer non-transaction try block // to meet the requirement to call handle.endTransaction
try // once and only once after a successful beginTransaction
{ // Note: the handle.beginTransaction/endTransaction pair must
// begin a transaction // be coded in the same method. We support the capability to
// if beginTransaction succeeds, that is, returns without // nest matched pairs of begin/endTransaction calls so passing
// throwing an exception we MUST call endTransaction on the // the session used to acquire the handle is sufficient to
// same handle once and only once. Note that there may already be // code multiple methods participating in the same transaction
// an active transaction from an enclosing method call. No matter // their is no need,nor is it desirable to pass around a handle.
// the DbHandle begin/endTransaction methods support nesting of begin/end dbHandle.endTransaction();
// calls provided all of the callers properly implement their begin/end }
// transaction methods. }
dbHandle.beginTransaction(); catch(Exception ex)
try {
{ // you might want to catch more specific exception types
// if you execute non-DbHandle methods such as object lifecycle // in almost all cases you need to re-throw the exception
// operations which can throw exceptions // to inform callers of the failure
// you must use an inner try...catch to indicate that an throw ex;
// application error occurred for proper transaction handling }
try
{
// dbHandle and other coding done here
}
catch(ChainedException ex)
{
// inform the handle that an error occurred and the
// transaction should be rolled back. The handle will
// detect this automatically for SQL and NoConnection
// exceptions
dbHandle.setErrorDetected();
Objective
Develop a useful validation script
Exercise
Create your own RFx Type for this exercise
Develop a script that generates an error
when the name of an RFx starts with
“From template”
Create your own RFx Type for this exercise
so that each student can do their own
script
Create localized resource in “custom” bundle to hold the error message (e.g.,
exception$rfx_must_specify_name)
Alternative
The script context could be Field Validation and the script could be associated specifically
with the DISPLAY_NAME field.
// Do not allow the user to save an RFx when the name begins with From template
if (doc.getDisplayName().startsWith("From Template"))
{
ae.chainAtEnd(doc.createApplicationException("DISPLAY_NAME", "custom",
"rfx_must_specify_name"));
}
Objective
Develop a useful validation script
Exercise
Add an extension to the Contracts module that
specifies the total value of the contract. Add a script
that makes this field required when the contract is in
the Executed status.
Create your own Master Agreement Type for this
exercise so each student can do their own script
Create localized resource in “custom” bundle to hold the error message (e.g.,
exception$total_value_not_specified)
Create extension field using extension definition (best to use Price data type)
Objective
y Develop a useful validation script on a collection
Exercise
y Add an extension collection to the projects module that
has two fields: a year VLV and a monetary amount.
Name the extension collection “Yearly Savings”. Add a
script validation to the projects module that ensures
that each row in the collection is fully specified.
y Create your own Project Type for this exercise so each
student can do their own script
Alternative
The script context could be Collection Validation and the script could be associated
specifically with the YEARLYSAVINGS collection.
Objective
Develop a toolbar script and
use utility IAPIs
Exercise
Add a toolbar script to the
projects module that locks the
savings collection so that no
rows can be added or deleted.
Write the script such that only
the document owner can run
the script. Add a second
toolbar script to the projects
module that unlocks the
savings collection.
// Script 1
// First check that the user is the owner
if (!session.getAccount().getAccountObjectReference().getObjectId().equals(
doc.getDocumentOwnerUserReference().getObjectId()))
{
throw doc.createApplicationException(null, "custom",
"only_document_owner_can_execute");
}
// Script 2
// First check that the user is the owner
if (!session.getAccount().getAccountObjectReference().getObjectId().equals(
doc.getDocumentOwnerUserReference().getObjectId()))
{
throw doc.createApplicationException(null, "custom",
"only_document_owner_can_unlock");
}
Objective
y Develop a useful validation script that also requires
using Home classes
Exercise
y Add a string extension to the contracts module named
“no diversity justification”. Add a script validation to the
contracts module that requires that this field be
populated if the vendor on the contract is not diverse.
y Use the MA Type created in exercise #7
Agenda
Section 1: Introduction to Workflow
Section 2: Configuring Workflows
Section 3: Developing Workflows in XPDL
Exercises throughout
Expectations
SAP Sourcing Approval Workflow requires coding in a Java-like language called Beanshell;
as a result, students must be capable with a high-level programming language (Java
preferable) to complete the exercises successfully
It is expected that students participating in this training have completed the Sourcing
Business Rule Design and Scripting training
Route a project for approval based on the category and the value
Route a contract document for approval based on the contract manager knowing
to whom the document must go
A workflow “engine” that manages and tracks the approval process steps
The engine does not provide the rules by which approvers are selected
Phase configurations are used to model the business process for a business
document
Multiple phase configurations can be configured and each “document type” can
have its own phase configuration
Each phase is a value from the phase value list type (Project Phase, Contract
Document Phase, Supplier Phase, User Defined Phase 1-5)
Accessed from Setup > Document Setup > [Projects, Contract Documents,
Suppliers,
pp UDO]
Objective
Familiarize yourself with configurable phase definitions
Exercise
Create a Project Configurable Phase Definition with
these phases: Under Review, Project Approval,
Strategy Planning, RFx, Awarding. Each phase should
be able to be transitioned backwards to the previous
phase and forwards to the next phase.
Make the Project Approval phase required
Create the Project Configurable Phase Definition from Setup > Document setup >
Projects > Project Configurable Phase Definition
WF Step 1
Reject
WF Step 2 Approve
WF Step 3
© 2011 SAP AG. All rights reserved. 308
Workflow definitions are used to define a specific approval workflow process (Setup >
System Setup > Workflow > Workflow Definitions)
Each Workflow definition includes a name, a description, and a collection of “process
templates”
The process template must always be an “approval workflow”
Process Owner Role: Collaborator role of background process user executing workflow
Active Approver Role: Collaborator role used for the active approver(s)
Inactive Approver Role: Collaborator role used after a user has completed
approval/rejection (typically “Collaborator” or “Reviewer”)
XPDL Source: .xpdl file
Workflow
Definition
XPDL
Prescript
Value List Conf. Phase
Type Definition Postscript
Document
Type Extension
Definition
User
Groups
Objective
y Familiarize yourself with workflow definitions
Exercise
y Using the attached XPDL, create a new Workflow
Definition
y Update the configurable phase definition created in
exercise 1 so that the “Project Approval” phase uses
the workflow definition
y Create a new Project Type that uses the configurable
phase definition
y Create a new Project from the Project Type and
execute the workflow approvals
Always start with a known working XPDL file from (use the empty.xpdl from the earlier
exercise, for example)
Each workflow process step typically has a “Prescript” that includes the
Beanshell logic to “add approvers” to the business document
Workflow process steps also may have a “Postscript” that includes Beanshell
logic performed after an approval or rejection
This is typically used in the final workflow step to manage phase transition
Variables available
doc: The doc variable is available to access the business document on which the
workflow is executing
session: The session variable is available to access the current session
Adding a specific user group as an approver where any user can approve
Adding a specific user group as an approver where all users must approver
Can not add a Workflow to the first phase (it can never be re-submitted
if it is cancelled)
Parallel threads of approval are not possible. Within a single process step, a
group may be used for parallel approvals, but separate threads of process steps
may not be executed in parallel.
There is no view that shows all of the approvers that will be required.
Problem: Approver is assigned at run time by the user getting the document
approved
Solution:
Add user account (or user group) extensions to the object type being approved
At run time, the user would populate the values of these fields
The values are used in the “addApprover” call
Objective
Develop a complete workflow scenario
Exercise
Add 3 user account extensions to the project type
object: Level 1 Approver, Level 2 Approver, and Level 3
Approver. Develop a project workflow that involves a
serial approval of the 3 approvers listed on the project
type associated with the specific project.
Duplicate the phase configuration created in exercise 1
and use it as the basis for this exercise
Ensure the workflow moves forward upon all approvals
being received; the workflow should move the phase
backward if a rejection is received.
Objective
Develop a complex workflow scenario
Exercise
Add an extension collection to the Internal Category object that has 2 fields: an integer and
a user group. This extension collection is used to identify approvers required for projects
based on the category and the value of the project. If the value of the project is greater than
the value specified within a row in the collection, the group specified in that row will be a
required approver (any user from the group can approver). Each row in the table should be
considered a separate step in the workflow (i.e., that is, each row represents 1 step in a
series of serial approvals). For this exercise, the collection should be populated with 4
rows: 50,000, 250,000, 1,000,000, and 5,000,000 such that an approver can be specified
for the 4 possible tiers. However, to ensure the solution is flexible, allow up to 6 tiers.
Implement a workflow on the projects module that uses this collection extension and adds
the appropriate approvers based on the estimated value of the project.
EXTRA CREDIT: Identify and implement the necessary validations on the Internal Category
and Project objects to ensure that the workflow will always work in a valid way.
Add 3 user account extensions to the project type object: Level 1 Approver, Level
2 Approver, and Level 3 Approver. Develop a project workflow that involves a
serial approval of the 3 approvers listed on the project type associated with the
specific project. Ensure the project phase consists of 3 phases: Draft, Approval,
Approved, and associate the workflow with the Approval phase. The workflow
should move the phase forward upon all approvals being entered; the workflow
should move the phase backward if a rejection is received.
SOLUTION:
Step 1 pre-script:
import com.frictionless.api.common.exception.*;
import com.frictionless.api.common.log.Logger;
import com.frictionless.api.common.platform.*;
import com.frictionless.api.common.types.*;
import com.frictionless.api.doc.collaboration.*;
import com.frictionless.api.doccommon.masterdata.*;
import com.frictionless.api.ibean.*;
import com.frictionless.api.util.*;
import com.frictionless.api.workflow.*;
import com.frictionless.api.projects.*;
import com.frictionless.api.common.log.*;
import com.frictionless.api.ibean.*;
import com.frictionless.api.usermgmt.masterdata.*;
import com.frictionless.api.doc.collaboration.*;
// doc is a ProjectIBeanIfc
typeHome = IBeanHomeLocator.lookup(session, doc.getDocTypeReference());
typeBean = typeHome.find(doc.getDocTypeReference());
// Level 1 Approver
principal = typeBean.getExtensionField(level1ApproverExtName).get();
if (hasValue(principal))
{
// Add the user account as the approver
addApprover(principal);
// log details
logMsg.setLogMessage("Added user: " + principal.getDisplayName() + " as
approver");
Logger.info(logMsg);
}
Step 2 pre-script:
import com.frictionless.api.common.exception.*;
Change management
Importing Data
Data Migration
Managing changes
Each change should have a change request or control number assigned to it. All
work for that change should be kept in a directory for that customer and request.
Any import to the target system should reference that change request.
Unlike SAP ERP, E-Sourcing does not have extensive built-in versioning control
and there is no “undo” option.
Getting a copy of the workbooks… Reference Guide (Index) > Select workbook and
save locally.
Benefits
Has the correct import
order (dependency built in)
Can turn on or off pages
No need to select proper
data type at import time
Getting a specific template.. Reference Guide > Class Reference > pick the class in
question Then select csv view
After selecting your seed file click next, pick the object you want the template for and
check the “Preview The Import” checkbox.
You will now have the visual layout of the object and a link called template.csv. Click
on this link and save it to your desktop rename the file with the target object name.
After save, click cancel.
Effectively you can implement periodic imports by configuring the source system
to send a correctly configured csv/xls file to a specified location on the
Application server.
Spreadsheet
Extensions
Page Customizations
OMA
Entire packages, lists of objects, single objects
Scripts, Templates, LR’s
Manual
Security settings, Mail configurations document security template changes etc.
Export Example
Export continued
Note multiple export packages. What this means is once the package is created
and the contents change you just need to add a new export and save it. The new
OMA file is then generated.
Have to decide on which objects and how to produce the proper list. All is easiest
but not always the best idea….
All migration queries end in –OML. Suggest making copies that end in –OML
going forward.
Object Migration
Export Example
Need to migrate a Script called “GJB Project Script”
Backup and start again we will eventually make this a Object List item.
First we need to create a query that will select exactly what we want. By default, the Object
Migration List query would select all Scripts. That might be a bad idea from a development
environment where we may have done some experimenting….
Let’s locate the Script export query… We know all Migration Queries end in –OML.
In the copied Query, modify the where clause to return only the ”GJB Project
Script” Script.
Usually can use AND UPPER(DISPLAY_NAME) LIKE ‘%some text%’ in the
existing WHERE clause.
Beware of inactive objects… may need to add “AND INACTIVE = 0” to the where
clause to not include inactive objects. Or you may have to make something
“active” to see it and migrate it.
Use Actions->preview to test the results of your new query
By convention you should make the internal name of this query XXX- ***-OML
Now create the export as Object List. And include this query.
Either close and reopen or use Refresh option to see export result
Save the file as XXXXXX_export.oma with “all files” as type. If you leave it as a zip
file, import won’t read it. Place this file in your change control document. XXXXXX
should be a meaningful name either utilizing a change control number or other
useful naming convention.
Select Import Data from Setup > System Administration > Import and Export Tools
Click New then Select upload to the Server Click Next
Using Spreadsheets
Reasons..
Modifications are large but coherent subsets of a much larger set of modifications.
Extensions and Page Customizations are really good examples of this. They will be used
to implement in DEV, QA and ultimately PROD.
Manual Migration
Reasons why..
Modification is a very small targeted change that would be difficult to do any other way.
Single page customizations, security changes are good examples. Minor changes to a
single template may also qualify. This is a judgment call and it is the responsibility of the
developer to choose wisely and document accordingly.
Reasons why not…
It might be easy to do, but not to document. Too many steps may be error prone. OMA is
easy to document. Attach OMA to the Change Control and say load this OMA….
Caveats
Object Migration requires that each landscape is running the same version of software,
otherwise it fails.
Object Migration also relies on supporting objects to be present. Therefore there are
dependencies that need to be followed.
I.e. Workflows, Configurable Phases, Types, Templates,
There are rare circular dependencies, in these cases rerunning the import usually does the
trick.
System settings
Make sure System property doc.numbering_table.token.deployment is set uniquely on
each landscape so no object collisions occur. Also make sure if production refreshes occur
this property is reset.
Potential problems:
Source and destination systems don’t match
Context cluster and directory id’s need to be the same
Object dependency not considered
Use the log to help debug the problem.
Objective
Familiarize yourself with the process of
creating a custom object list export.
Exercise
Export N scripts as assigned by the
instructor. This will require modifying a
query to return the specific result set. Keep
in mind, Dates, Display Names, and or
other status can be used to modify the
result set.
Verify the content of the export.
General
Used to manipulate navigation menus and
document toolbars
Buttons and other actions can qualify as
“toolbars”
Some examples:
navigation
toolbar
button
Setup > System Setup > User Interface > Toolbar Customization
Using The system Toolbars list tool find the Project Document toolbar.
Each of the “IDs” must be kept. Eventually they will be combined to form the
toolbar Customization
Target Toolbar ID.
Navigate to the Tool Drop down area and grab the Action ID
These are all the ID’s saved along the way. They just need to be combined
and separated with “.” to create the complete Toolbar ID
Success !
System Properties no longer needed to set, just attach logo file to Company
record
Open the Enterprise Company for edit and attach the logo to the company only
the enterprise company will have the controls to add a logo or a theme override.
In past releases, login screen and other pages would incorporate the customer
logo
Step 1: As the Enterprise user, Duplicate the existing default Theme and rename it
Step 3: Edit the Theme and add the Text, Logo or pictures you want
This screen is displayed while logging in. This is a single image in the branding
area
Image 1 – In Theme terms this is called Splash Screen
BEFORE
AFTER
BEFORE
AFTER
Using your image editor of choice scale and or crop the image to fit the expected
image size. Each image has the expected size in pixels default size in pixels
specified.
Project Request - A simple form to request some work that may end up as a
project. (Wizard supports “Create From”)
NDAs - We have customers that really want to keep these segregated from their
Master Agreements
Self Service work – Some customers have certain business users do simple
contracts (it is kind of like a project request, but it is configured to provide a
template for the user and have them complete the contract negotiation outside of
Contract Management).
Login as the Enterprise user and enable access to the UDO by modifying the
appropriate Security
Do NOT skip this step. If you do, anything created will not provide the document
creators access by default
RESOURCE_
BUNDLE RESOURCE_ID KIND DEFAULT_VALUE CUSTOM_VALUE
userdefined.bizdoc1.e Application Enable Buy-Side User Defined BizDoc 1 Enable Buy-Side Request Form
doc nable.buy Text (TRUE or FALSE) (TRUE or FALSE)
userdefined.bizdoc1.e Application Enable Sell-Side User Defined BizDoc 1 Enable Sell-Side Request Form
doc nable.sell Text (TRUE or FALSE) (TRUE or FALSE)
userdefined.bizdoc1.cl Application
doccommon ass_name Text User Defined BizDoc 1 Request Form
userdefined.query.all_ Application
doccommon bizdoc1.label Text All User Defined BizDoc 1 All Request Forms
userdefined.query.biz Application
doccommon doc1.label Text User Defined BizDoc 1 Request Form
Security profile must be chosen to give user access rights to application resources
Collection of supervised companies and OUs replaces manager mapping in business
unit records
Add collection of user groups
Document security templates are rules that govern how business documents handle
collaborators in the case of new collaborators and in the case of new business documents
When a new collaborator is added, the default collaborator role determines what role that
collaborator gets. The new collaborator also gets the default department representation
declared in the security template
When a new business document is created, the collaborator role and principal user type
defined in the security template are added to the collaborator list
These are all customizable
© 2011 SAP AG. All rights reserved. 450