34
BOPF Creating BOs, Nodes & Associations SAP AG, 2012

BOPF Creating BOs, Nodes & Associations - abap-blog.ru

  • Upload
    others

  • View
    26

  • Download
    4

Embed Size (px)

Citation preview

BOPF Creating BOs,

Nodes & Associations

SAP AG, 2012

© 2012 SAP AG. All rights reserved. 2

Disclaimer

This presentation outlines our general product direction and should not be relied on in

making a purchase decision. This presentation is not subject to your license

agreement or any other agreement with SAP. SAP has no obligation to pursue any

course of business outlined in this presentation or to develop or release any

functionality mentioned in this presentation. This presentation and SAP's strategy and

possible future developments are subject to change and may be changed by SAP at

any time for any reason without notice. 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.

SAP assumes no responsibility for errors or omissions in this document, except if

such damages were caused by SAP intentionally or grossly negligent.

© 2012 SAP AG. All rights reserved. 3

Agenda

Introduction

Creating a Business Object

Creating a Node

Creation of the Node

Creation of the Data Model

Generation of DDIC Elements and Database

Node-Database Mapping

Constant Interface Generation

Locking

Node Types

Creating an Association

Introduction

© 2012 SAP AG. All rights reserved. 5

Example of a Business Object Instance

Address

(association with business

partner)

Header Data

Invoice no., customer no., etc.

Invoice Items

Product and Product Description

Calculated Price per Item

Calculated Net Amount

Calculated Tax Amount

Calculated Gross Amount

The CUSTOMER_INVOICE business object was developed for this workshop.

Creating a Business Object

© 2012 SAP AG. All rights reserved. 7

Creating a Business Object

New

To create your business object within BOPF, proceed as follows:

1. Start BOPF Design Workbench (transaction /BOBF/CONF_UI).

2. Create a new business object by pressing the ( ) icon.

3. Enter the BOPF name and description.

© 2012 SAP AG. All rights reserved. 8

Open a Business Object

Open and configure existing business objects using Business Object Browser.

Open

Creating a Node

© 2012 SAP AG. All rights reserved. 10

Creation of a Node

Select the node that needs a new

subnode in the “ Node Structure” section

Enter the subnode name and its description.

Hint: The root node is created automatically after a business object is created and thus cannot

be created manually.

© 2012 SAP AG. All rights reserved. 11

Creation of the Data Model

Data Structure: Each node has an internal data structure containing persistent fields

Data Structure (tr.): Data structure containing the transient fields of this node

(Transient fields: Fields that are not stored in the database and exist only in the buffer)

Combined Structure: Consists of the data structure, the optional transient data structure, and a

technical key include (necessary, for example, for buffering)

Combined Table Type: Table type for storing the data of multiple instances of a node

(necessary for mass-enabled access). The row type corresponds to the combined structure.

© 2012 SAP AG. All rights reserved. 12

Propose Repository Names (1)

BOPF provides naming proposals for various dictionary objects

Option to select entities and to specify namespaces and prefixes for generated names

Check whether proposed names comply with naming conventions (truncations etc.)

© 2012 SAP AG. All rights reserved. 13

Propose Repository Names (2)

Result of the execution of the “ Propose Repository Names” function

© 2012 SAP AG. All rights reserved. 14

Generation of DDIC Elements (1)

BOPF can generate DDIC elements after

their names are specified in the model

Option to select the elements to be generated:

Combined data structure includes manually created internal data structure and adds

framework specific fields

Combined table type uses combined data structure as the row type

© 2012 SAP AG. All rights reserved. 15

Example of Naming Proposals and DDIC Generation

Create the data structures manually (create the data structure for the transient fields only if there actually are any transient fields)

Propose repository names for the combined structure and the combined table type

Generate dictionary elements for the combined structure and the combined table type

ID

QUANTITY

QUANTITY_UNIT

PRICE_AMOUNT

NET_AMOUNT

GROSS_AMOUNT

TAX_AMOUNT

CURRENCY_CODE

CONSISTENCY

.INCLUDE

CREA_DATE_TIME

CREA_IDENT_UUID

LCHG_DATE_TIME

LCHG_IDENT_UUID

.INCLUDE

.INCLUDE

KEY

PARENT_KEY

ROOT_KEY

ZCI_S_ROOT_D ZCI_S_ROOT ZCI_T_ROOT

Data Structures Combined Structure

ZCI_S_ROOT_DT

.INCLUDE

© 2012 SAP AG. All rights reserved. 16

Creation of the Database Table

Mark

Database table name can be proposed by BOPF (“Extras” -> “ Propose Repository Names“)

Database table can be generated (“ Extras” -> “ Generate Repository Objects” -> “ Generate

Dictionary Elements”) or created manually

Remark: Database Index for Parent Key is only generated for Database Systems <> Hana DB (On Hana DB: please compare to DB guidelines, if manual creation of DB Index makes sense, e.g. > 500k entries expected)

Mark

© 2012 SAP AG. All rights reserved. 17

Node-Database Mapping

Storage in Database Table

Field names in the database must correspond to the internal data structure or a named

include can be used and specified in the database mapping

Internal fields that do not exist in the database table are called “ transient”

Example: The item node is a child of the root node, thus we can map both fields (ROOT_KEY

and PARENT_KEY) to one database attribute because they always have identical values.

© 2012 SAP AG. All rights reserved. 18

Constants Interface Generation (1)

1. Enter

2. Generate

© 2012 SAP AG. All rights reserved. 19

Constants Interface Generation (2)

Each configuration element (e.g. nodes, actions) is uniquely identifiable within BOPF at design

time, as well as during runtime, by a GUID.

Application-specific content that uses internal model information has to use these GUIDs (e.g.

reuse of implementations).

BOPF provides the option of generating a constants interface containing all GUIDs.

Hint: You need to regenerate the constants interface after the creation of new configuration

elements or just activate the object.

© 2012 SAP AG. All rights reserved. 20

Locking Overview

Mark

BOPF is used to lock business object instances

Explicit locking request only using RETRIEVE calls (with EDIT_MODE parameter)

Implicit locking using modifications

Option of locking each individual node is pointless.

BOPF’s Approach: Locking Groups

Consists of one node marked as lockable and its child nodes that are not lockable themselves

Strategy when a lock is requested for a non-lockable node: Lock closest lockable ancestor

Lockable nodes also have to be loadable

© 2012 SAP AG. All rights reserved. 21

Locking Using Groups

Rule: All nodes belonging to one loading group must belong to the same locking

group.

Locking Group A

Locking Group B

© 2012 SAP AG. All rights reserved. 22

Node Types

BOPF supports different types of nodes in the

internal model.

Standard Nodes

Framework Nodes (not shown by default)

contain information about the instances:

Property nodes (suffix _PROPERTY):

Store dynamic properties

Lock nodes (suffix _LOCK)

Buffer lock information

Message nodes (suffix _MESSAGE)

Contain messages from validations

Delegated nodes (representation of dependent

object)

Business object representation nodes

© 2012 SAP AG. All rights reserved. 23

Property Node

Message Node

Lock Node

Framework Nodes Overview

Framework core does not hold any instance specific data, thus framework nodes are used for

storing this data.

Framework nodes not accessible for service consumers, but from BO content

Framework nodes are not stored in the database (exception: message nodes can be stored

optionally in the database)

Framework node structure:

Exactly one property node for each node

Exactly one message node for each node

Exactly one lock node for each lockable node

© 2012 SAP AG. All rights reserved. 24

Framework Nodes How to display them

Mark

Framework nodes are not visible by default.

To make them visible, go to “Utilities” > “Settings” > “Business Object”.

© 2012 SAP AG. All rights reserved. 25

Framework Nodes Example

Framework-

defined

internal data

types

Not in database

Creating an Association

© 2012 SAP AG. All rights reserved. 27

Creation of an Association

Select the node to which the association is assigned in the “ Node Elements” section and follow the guided procedure.

© 2012 SAP AG. All rights reserved. 28

Association Type and Category

BOPF offers two different types of associations in the internal model

Composite associations: From parent to child nodes

Categories:

Regular composition association

Specialization (not the same as the “specialization” from object orientation)

Association with delegated node (dependent object)

Framework associations (link to framework nodes)

General associations: Linked across the composition tree

Categories:

Foreign key association/reverse foreign key association

Reverse specialization

Association To_Parent

Association To_Root

Cross-BO association

Regular association (implementation-specific)

© 2012 SAP AG. All rights reserved. 29

Association Configuration Overview

Implementation

class for

associations

© 2012 SAP AG. All rights reserved. 30

Association Configuration Cardinality and Resolving Node

Cardinality of an association: Number of node instances that are connected to

one source instance.

Resolving Node: Associations can be distinguished according to the node that is

used to resolve the association

Source-resolved associations

Source node contains information necessary for resolving the association

Target-resolved associations

Target node contains information necessary for resolving the association

© 2012 SAP AG. All rights reserved. 31

Association Configuration Implementation vs. Binding

The association’s logic can be deposited in two different ways:

Implementation

Needed for associations with specific business logic that is not covered by existing association bindings

Implementation of the IF_FRW_ASSOCIATION interface necessary (not part of this training course)

Example: Association that links hierarchically ordered items

Association Binding

Can be easily modeled without any implementation work

Binding is resolved by the buffer implementation

Association types supported by binding: o Compositions (no binding necessary)

o Specialization/reverse specialization

o Foreign key associations/reverse foreign key associations

o To_Parent

o To_Root

o Cross-business object associations

Recommendation: If possible, use association binding to refine the BO model.

© 2012 SAP AG. All rights reserved. 32

Association Configuration Binding

Specify

binding details

Specify binding

pattern

Thank you

© 2012 SAP AG. All rights reserved. 34

© 2012 SAP AG. 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 AG. The information contained herein may be

changed without prior notice.

Some software products marketed by SAP AG and its distributors contain proprietary

software components of other software vendors.

Microsoft, Windows, Excel, Outlook, PowerPoint, Silverlight, and Visual Studio are

registered trademarks of Microsoft Corporation.

IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x,

System z, System z10, z10, z/VM, z/OS, OS/390, zEnterprise, PowerVM, Power

Architecture, Power Systems, POWER7, POWER6+, POWER6, POWER, PowerHA,

pureScale, PowerPC, BladeCenter, System Storage, Storwize, XIV, GPFS, HACMP,

RETAIN, DB2 Connect, RACF, Redbooks, OS/2, AIX, Intelligent Miner, WebSphere, Tivoli,

Informix, and Smarter Planet are trademarks or registered trademarks of IBM Corporation.

Linux is the registered trademark of Linus Torvalds in the United States and other countries.

Adobe, the Adobe logo, Acrobat, PostScript, and Reader are trademarks or registered

trademarks of Adobe Systems Incorporated in the United States and other countries.

Oracle and Java are registered trademarks of Oracle and its affiliates.

UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.

Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin

are trademarks or registered trademarks of Citrix Systems Inc.

HTML, XML, XHTML, and W3C are trademarks or registered trademarks of W3C®,

World Wide Web Consortium, Massachusetts Institute of Technology.

Apple, App Store, iBooks, iPad, iPhone, iPhoto, iPod, iTunes, Multi-Touch, Objective-C,

Retina, Safari, Siri, and Xcode are trademarks or registered trademarks of Apple Inc.

IOS is a registered trademark of Cisco Systems Inc.

RIM, BlackBerry, BBM, BlackBerry Curve, BlackBerry Bold, BlackBerry Pearl, BlackBerry

Torch, BlackBerry Storm, BlackBerry Storm2, BlackBerry PlayBook, and BlackBerry App

World are trademarks or registered trademarks of Research in Motion Limited.

Google App Engine, Google Apps, Google Checkout, Google Data API, Google Maps,

Google Mobile Ads, Google Mobile Updater, Google Mobile, Google Store, Google Sync,

Google Updater, Google Voice, Google Mail, Gmail, YouTube, Dalvik and Android are

trademarks or registered trademarks of Google Inc.

INTERMEC is a registered trademark of Intermec Technologies Corporation.

Wi-Fi is a registered trademark of Wi-Fi Alliance.

Bluetooth is a registered trademark of Bluetooth SIG Inc.

Motorola is a registered trademark of Motorola Trademark Holdings LLC.

Computop is a registered trademark of Computop Wirtschaftsinformatik GmbH.

SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer,

StreamWork, SAP HANA, and other SAP products and services mentioned herein as well

as their respective logos are trademarks or registered trademarks of SAP AG in Germany

and other countries.

Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal

Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services

mentioned herein as well as their respective logos are trademarks or registered trademarks

of Business Objects Software Ltd. Business Objects is an SAP company.

Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybase

products and services mentioned herein as well as their respective logos are trademarks or

registered trademarks of Sybase Inc. Sybase is an SAP company.

Crossgate, m@gic EDDY, B2B 360°, and B2B 360° Services are registered trademarks

of Crossgate AG in Germany and other countries. Crossgate is an SAP company.

All other product and service names mentioned are the trademarks of their respective

companies. Data contained in this document serves informational purposes only. National

product specifications may vary.

The information in this document is proprietary to SAP. No part of this document may be

reproduced, copied, or transmitted in any form or for any purpose without the express prior

written permission of SAP AG.