2.business object repository

3,394 views

Published on

Published in: Education, Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,394
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

2.business object repository

  1. 1. BUSINESS OBJECT REPOSITORY
  2. 2. Business Object Repository <ul><li>Business object repository is a collection of business objects. Business objects integrate the data and functions of business applications into your workflows. They enable the communication with business applications with all the flexibility and robustness required for a production environment. </li></ul><ul><li>Business objects are also the main interface between SAP workflow and business applications in SAP components. </li></ul><ul><li>Business objects helps to minimize development and maximize return on investment you have already made in implementing your SAP component. </li></ul><ul><li>Business objects give the SAP workflow access to the data and functions in business applications. </li></ul><ul><li>A directory of all object types defined in the SAP System is managed in the business object repository. These object types are each assigned to a business application component. </li></ul><ul><li>In addition to the business object types, the business object repository also contains structural object types, such as company code, plant, or sales organization, and technical object types, such as text, note, work item, or archived document. Customers can define their own object types. </li></ul><ul><li>Object types and their elements can be found quickly by accessing this business object repository with the appropriate search functions (either via the component hierarchy or with a generic search using parts of a name). </li></ul>
  3. 3. Business Objects <ul><li>Business data can be used : </li></ul><ul><li>In control steps (including conditions, loops, container operations) </li></ul><ul><li>In bindings (including event to workflow, workflow to task, task to method, workflow to rule) </li></ul><ul><li>In texts (including work items texts and user instructions) </li></ul><ul><li>In start conditions used to determine which workflow will be started and whether a workflow will be started. </li></ul><ul><li>Business functions can be used : </li></ul><ul><li>In methods, within tasks, within workflows </li></ul><ul><li>In agent determination rules and XML rules. </li></ul><ul><li>In event linkages with start conditions, check function modules or receiver type function modules. </li></ul><ul><li>In secondary before and after methods within workflow step definition. </li></ul>
  4. 4. Business Objects <ul><li>Business objects provide you with an object oriented view of business applications. </li></ul><ul><li>They organize the business data and functions into the reusable components that can be accessed throughout the workflow. </li></ul><ul><li>From a workflow perspective, the main advantage of object-orientation are : </li></ul><ul><li>Reusability : Each piece of business data and business function defined is potentially available to all workflows. Business data is available as an attribute of an object and Business function is available as a method of an object. </li></ul><ul><li>Encapsulation : Each piece of business data and business function is defined once and only once for the most relevant business object. </li></ul><ul><li>Inheritance : SAP provides many business objects with data and functions, instead of starting from the scratch, you can inherit the SAP- provided business objects to your own business objects. You can even replace provided data and functions with your own. </li></ul><ul><li>Polymorphism : Business objects allow generic programming. </li></ul>
  5. 5. Relationships Between Object Types or Business Objects <ul><li>A business object type can have various relationships to other business object types. </li></ul><ul><li>Relationship between attributes are extremely useful throughout workflow. </li></ul><ul><li>Relationships are as follows : </li></ul><ul><li>1 . Inheritance : (inherits from) </li></ul><ul><li>Relationship between object types allowing common attributes and methods to be passed automatically from supertypes to subtypes. </li></ul><ul><li>The object type which passes on attributes and methods is the supertype. The subtype takes on (&quot;inherits&quot;) the attributes and methods from the supertype. The supertype program coding connected with the attributes and methods is referenced. Inherited attributes and methods can be redefined for the subtype. The interface, however, may only be enhanced. </li></ul><ul><li>If the attributes and methods of the supertype are known, it is only necessary to describe the differences (changes and enhancements) in the relevant subtype. All other attributes and methods defined once are used again which reduces the implementation work involved. The error probability when changes are made later also decreases. </li></ul><ul><li>In inheritance, the subtype usually has the same key fields as its supertype, but enhanced functionality. </li></ul>
  6. 6. <ul><li>Composition : </li></ul><ul><li>&quot;Is part of&quot; relationship between object types. </li></ul><ul><li>The object type order item &quot;is part of&quot; the object type order . </li></ul><ul><li>The object type order is then the aggregate type of the object type order item . </li></ul><ul><li>In composition, the ‘is part’ object type usually has an extended key when compared to the aggregate type (for example, order key + item) and a completely different functionality . </li></ul><ul><li>Composition relationships are implemented by creating an attribute that links one object to another. </li></ul><ul><li>Interface : </li></ul><ul><li>Relationship expressing which object types support an interface. </li></ul><ul><li>To maintain this relationship, the relevant interfaces must be entered as components of the object type. </li></ul><ul><li>Association : </li></ul><ul><li>Relationship between object types resulting from an object type being referenced as an object attribute of another object type. </li></ul><ul><li>The object type customer is referenced in the attribute ordering party of the object type sales order . </li></ul>Relationships Between Object Types or Business Objects
  7. 7. Business Object Tools <ul><li>There are two main tools that you can use to work with business objects: </li></ul><ul><li>1. Business Object Builder : </li></ul><ul><li>Transaction SWO1 or Definition Tools ->Business object builder. </li></ul><ul><li>Use the Business Object Builder to display, test, create, generate, change, delete, delegate, and change the status of business objects. </li></ul><ul><li>You can see all the relationships between object types using Utilities -> Relationships on the initial screen. </li></ul><ul><li>To access a business object type in the Business Object Builder use its technical ID </li></ul><ul><li>2. Business Object Repository Browser : </li></ul><ul><li>Transaction SWO1 or Definition Tools ->Business object Repository. </li></ul><ul><li>Business object Repository browser presents a hierarchical view of all the business objects available, by SAP application module. </li></ul><ul><li>Each object type is assigned to an SAP application module indirectly via its package. </li></ul><ul><li>You can inspect the definition of existing object types, but you cannot create new object types here. </li></ul>
  8. 8. Business Objects : Some Basic Terminology <ul><li>While using business objects you may be referring some of the following terms: </li></ul><ul><li>1. Object type : </li></ul><ul><li>It is a design and implementation of the access to data and functions i.e. the object types contains the program that reads or calculates data and calls business functions. </li></ul><ul><li>2. Object Instance : </li></ul><ul><li>It is a single runtime copy of its object type that holds the data or accesses the functions relevant to that particular instance of the object. </li></ul><ul><li>3. Object reference : </li></ul><ul><li>It holds the technical ID of object type, the object key, and other technical information needed by the system to access an object instance. </li></ul><ul><li>Each object of business object type has the following components. </li></ul><ul><li>Key Field. </li></ul><ul><li>Attributes. </li></ul><ul><li>Methods. </li></ul><ul><li>Events. </li></ul>
  9. 9. Key Field <ul><li>Fields for unique identification of an object. </li></ul><ul><li>The key defines each object instance uniquely. For e.g. for the Customer object type the key is customer ID. </li></ul><ul><li>The definition of the key fields of an object type determines the structure of the identifying key, via which the system can access a specific object, that is, an instance of the object type. </li></ul><ul><li>The key fields of an object type are usually also the key fields in the table containing the header data for the object type. </li></ul><ul><li>Only character-based data types are allowed as key fields. The total length allowed for all key fields is 70 characters. Each key field refers to a field in the ABAP Dictionary. </li></ul><ul><li>Key fields are simply declared within the object and are filled when the object is instantiated. </li></ul><ul><li>Each key field must have a reference to a ABAP Dictionary table/field. This is used to define the data type and length of a key field. </li></ul>
  10. 10. Creating Key Fields <ul><li>Steps for creating the key field : </li></ul><ul><li>Key field is provided by calling workflow, task, method, attribute or event whenever the object is used. </li></ul><ul><li>The object instance instantiated from the object type and key, give you access to all the attributes and methods of that object. </li></ul><ul><li>Example: </li></ul><ul><li>We will add the Material ID as a key field of some object called ZWIDGET1. If you are not using BUS1001 object type, we can create the same fields with the same data type references as your example object type. </li></ul><ul><li>Bring the ZWIDGET1in change mode to add the key field by choosing the component title “Key” and choosing ‘create’. </li></ul><ul><li>Base the key field on the dictionary table MARA field MATNR. </li></ul><ul><li>Once the key field has been created, go back to the object type program and see that the object declaration has changed. </li></ul><ul><li>Regenerate and test your new changed object. </li></ul><ul><li>Attempt to add a new key field to ZWIDGET2. Key will not be added since ZWIDGET2 is a subtype. </li></ul>
  11. 11. Attributes <ul><li>Attributes provide access to business data. </li></ul><ul><li>This may be data extracted from the database or calculated values. </li></ul><ul><li>Attributes may reference a single value or multiple values. </li></ul><ul><li>Attributes can in themselves be references to other business objects, setting up relationships between objects. </li></ul><ul><li>Attributes can be used to formulate conditions in the workflow definition. </li></ul><ul><li>The system reads or establishes the attribute values at runtime and controls the workflow with them. </li></ul><ul><li>A object attribute can return data as follows: </li></ul><ul><ul><li>The value of a field of the ABAP Dictionary (database field attribute) </li></ul></ul><ul><ul><li>An object reference to an object defined in the Business Object Repository . </li></ul></ul><ul><li>The attributes of an object are defined and implemented as components of an object type in the Business Object Repository. </li></ul><ul><li>Attributes are passed on from the supertype to its subtypes. </li></ul>
  12. 12. Creating Attribute <ul><li>Bring the ZWIDGET1 in change mode to add a new attribute by choosing the component title “Attributes” and choosing ‘Create’. </li></ul><ul><li>Click on yes to the question “Create with ABAP Dictionary field proposals?”. Base your new component on dictionary table MARA field MTART (Material type). Accept system’s proposal for names and descriptions of an attribute. </li></ul><ul><li>Notice what checkboxes and values have been set for you in the attribute details screen. You will see that the attribute ID, name, description, database flag, and data-type reference have all been set for you. Notice that the attribute is only in modeled status. </li></ul><ul><li>Save your object and regenerate it. Try testing your object. Can you use the new attribute in modeled status? No. </li></ul><ul><li>Go back to your object, choose your new attribute and choose Program. The system will ask you if you want it create an implementation for your attribute. Click on Yes. </li></ul><ul><li>Do not change the code generated at this stage, just inspect it. Note that status of your attribute is automatically changed to implemented. </li></ul><ul><li>Regenerate your object and test it again with the valid material number. This attribute will show the material type for material chosen. </li></ul>
  13. 13. Methods <ul><li>Method provide access to business functions. </li></ul><ul><li>Method is also known as operation that can be performed on an object. </li></ul><ul><li>The methods of an object are defined and implemented as components of an object type in the Business Object Repository. </li></ul><ul><li>Methods and their interfaces are passed on from the supertype to the subtypes. </li></ul><ul><li>A method generally refers to ABAP/4 functionality which is already available (function module, transaction, dialog module, ...) and is called via an interface determined mainly by the method name and method parameters. </li></ul><ul><li>The actual implementation of the method therefore remains abstract. It is not visible externally and does not need to be known to the calling program of the method. </li></ul><ul><li>If you want to use a function in a workflow, it must be first defined as a method of an object. </li></ul><ul><li>A method is usually a single activity that can be performed on an object instance. </li></ul><ul><li>A method may involve a combination of business functions or even call other methods within its program code. </li></ul>
  14. 14. Synchronous and Asynchronous Methods <ul><li>Methods can be subdivided as follows depending on their response characteristics: </li></ul><ul><li>Synchronous methods </li></ul><ul><ul><li>Synchronous object methods assume process control for the duration of their execution and report back to the calling program once they have been executed. </li></ul></ul><ul><ul><li>Synchronous methods can accept import parameters and a result, export parameters, and exceptions. </li></ul></ul><ul><li>Asynchronous methods </li></ul><ul><ul><li>Asynchronous methods do not report back to the calling program directly after their execution. The response is made via events which are used to report the processing results of the methods. </li></ul></ul><ul><ul><li>Asynchronous methods can only accept import parameters; they cannot return any results to the workflow directly. Results can be returned indirectly via terminating events. </li></ul></ul><ul><li>Synchronous and asynchronous methods can be distinguished according to the way in which they are used in single-step tasks: A single-step task which refers to an asynchronous method must be completed by an event. </li></ul>
  15. 15. Method Parameters and Result <ul><li>Method Parameters </li></ul><ul><li>Parameters are used to exchange information between the calling program of a method and the method. </li></ul><ul><li>Parameters of a method are values which are either passed to the method at runtime (import parameters) or are returned from the method (export parameters). </li></ul><ul><li>When the parameters are defined, the interface of the method call is also defined. </li></ul><ul><li>A method need not necessarily have parameters; many methods can be used without parameters. </li></ul><ul><li>Method Result </li></ul><ul><li>The result of a method is different to the export parameters. </li></ul><ul><li>Possible values for the result can be fixed or contained in a check table. They are therefore known in a workflow definition and can be taken into account during process modeling. </li></ul><ul><li>The various follow-up steps can be modeled in a workflow definition according to the results. A method can only ever have one result, although there is no limit to the number of export parameters. </li></ul><ul><li>A method need not necessarily have a result. </li></ul>
  16. 16. Events <ul><li>Events transmit the status change of an object (e.g. Created, Changed). </li></ul><ul><li>Events should always be seen in connection with the object they are &quot;reporting&quot; on. The events belonging to an object are therefore specified in the object type definition. </li></ul><ul><li>Events are published without the application, the event creator, knowing whether a receiver is interested in this event and whether it will respond. </li></ul><ul><li>Potential receivers of an event are listed in the event receiver linkage table, where receivers can make and remove their entries as required. </li></ul><ul><li>This allows the events created to be responded to flexibly. </li></ul><ul><li>Events are used in the SAP Business Workflow environment. </li></ul><ul><li>to start tasks (multistep tasks and single-step tasks). The events are therefore defined as the triggering events of the respective tasks. </li></ul><ul><li>to complete single-step tasks which refer to an asynchronous object method. The events are therefore defined as the terminating events of the respective single-step tasks. </li></ul><ul><li>Events are linked to runtime-dependent data (event parameters) which is available to the event receiver and can be used for event-driven control and communication mechanisms. </li></ul>
  17. 17. Creating Events <ul><li>Steps for creating events: </li></ul><ul><li>Bring the ZWIDGET1 in change mode to add a new event by choosing the component title “Events” and choosing ‘Create’. </li></ul><ul><li>Give your event a name. </li></ul><ul><li>Regenerate your object and test it. </li></ul>
  18. 18. THANK YOU

×