This blog I will show how to create a association in BOBF T-code from scratch. I hope it will definitely help developers to learn and understand how to create a BOBF object and creating association.
BOBF (BOPF: Business object Configuration (Internal Use): using BOBF T-Code we can create and display the objects.
-> We can change the mode of object from display to edit by giving ‘DEBUG’ in command field.
Steps to Create Business Object:
-> click on create business icon or function key f5.
-> Provide Business object name and description
Creating Business Object
Create Constant Interface:
Def: It contains all constants of a business object or business object enhancement.
Use: Keys present in the constant interface are used for enhancement,
-> Each entity of business object or a business object enhancement can be identified.
-> Provide name ‘zif_demo_constant_interface’ in constant interface field then go toExtras->Generate Repository Object->Create Constant Interface.
-> It will create the constant interface with ‘zif_demo_constant_interface’
-> Inside this constant interface by default a Set of attributes will be created.
Create a Global table with DB as mandatory key TYPE /BOBF/CONF_KEY.
Create global structure for this table.
Table For Business Object
Add Mandatory Fields to Root
When we create a BOPF project the root node is automatically generate,
To this root node, add DDIC structure, combined structure, combined table type, and DDIC table, as shown below.
Create Combined Structure:
Create combined structure as shown below
Now the BOPF Object is created with all the required and manditary Structuers.
-> Inside root node 6 Node elements generate by default.
Hear I will show how to create Association and Conditional association.
-> In BOPF, an association is used to define a direct and unidirectional relationship between two nodes.
-> You can use an association to navigate from a source node to a related target node
-> You can define associated nodes in one or more business objects or business object enhancements.
-> If you define associated nodes in more than one business object, you define cross-business-object associations.
Hierarchy Structure Of Node
-> Above diagram Root Node is Node A, root node child is Node B, B child Node is Node c.
-> DB_KEY, PARENT_KEY, ROOT_KEY all are type RAW16.
Root Node A:
In root node key , Root key generated by default Parent key is empty because Root Node only first node no parent for root node .
Root Node A
Child Node B:
In child node B key generate automatically, parent key is same as root node of key and root key same as root node of root key
Child Node B
Child Node C:
In child node C key generate automatically, parent key is same as Child node B of key and root key same as root node of root key
Child Node C
DB_KEY (as KEY)
|Sub node of ROOT||
DB_KEY (as KEY)
|Sub Node of Sub node (third level)||
DB_KEY (as KEY)
Creating Association In BOBF:
-> Heare i will show association b/w two tables.
-> First create a TABLE with MANDT, DB_KEY, AND PARENT KEY AND global structure.
-> Create Root note, after go to Node Structure->Root->Right click on root->Create Sub node->Standard Node.
-> Create Sub node with the node name, description, structure, combined structure, combined table type And DDIC Table name.
Table for child node:
Creating Association in Root Node:
Association In Root Node
Now the association is created.
Create association first as shown above.
Creating Filter structure:
-> we associate the ITEM to the ROOT node in a cardinality of 1:0…n. The condition is defined on the target – the ITEM – node
-> we need to define the input parameters for the condition. This can be done by creating a Data Dictionary structure and referencing them in the association definition.
So, enter the name of your structure ‘ZFILTER_DEMO1’ in the input field Filter Structure and navigate to the Data Dictionary with double-click and Create structure with ID.
Creating Association Parameter:
Right click on Association parameter value->Create code value set
->After that below showed screen will appear in that fill value set name, description, class/interface, this are the mandatory fields we should fil.
Creating Association Attribute binding:
-> Right click on association ->Maintain Attribute Binding->Switch to the Association Binding tab. we start the definition by selecting the binding pattern Specialization in the dropdown list box. This creates an entry in the table with binding the keys of the parent and child node.
-> We create a new entry with the New button and select Association Parameter Attribute as Association Binding Category in the dropdown list box.
Now the conditional association is created.
Testing the BO in BOBT:
In BOBT TCODE first fetch data from header node as shown below, then select the association.
-> Once you select association one popup box appear as shown below and enter the Parameter ID value.
Passing Parameter Value
-> The conditions maintained in the association definition are joined with AND. So, the result list displays only the items that exceed 00002.
-> This Is the out put in Child Node.
-> We execute a second test and enter the limit 00004.
-> The result list is empty, as record is not precent in the item table.
Like this we create a BO object and association we can test in bobt.