You all know the
AddressInformation nodes in the SAP Business Objects which hosts detailed address information, especially country and language dependent.
This can also be achieved in a very easy way with a Custom Business Object.
All you need is an association to the SAP Business Object
AddressSnapshot and the Embedded Component
Public_Address.
No further definitions in the BODL of your Custom Business Object, no ABSL coding.
The complete data handling is covered by the Embedded Component!!!
The only disadvantage is that the Embedded Component is also the only way to maintain the data.
Let me show you the single steps.
Step 1: Association to AddressSnapshot
Add an association like this to your Custom Business Object in any node.
This is not restricted to the Root node.
association Address to AP.FO.Address.Global:AddressSnapshot;
You can have even more than one:
association DeliveryAddress to AP.FO.Address.Global:AddressSnapshot;
association BillingAddress to AP.FO.Address.Global:AddressSnapshot;
association MainContact to AP.FO.Address.Global:AddressSnapshot;
Step 2: Add the Embedded Component Public_Address
After you have created your UI open it in the UI Designer.
Make sure that the
NodeID of the node(s) in which you have defined your association(s) is/are part of the UI Model.
Let's call this node the HostNode and the resp.
NodeID the
HostNodeID.
Add the Embedded Component "/SAP_BYD_APPLICATION_UI/Reuse/Address/Public_Address_EC.EC.uicomponent" to your UI.
Maintain the Binding
Click on the "Bind" button inside the Embedded Component.
In the "Embedded component binding" window select the
HostNodeID from your Data Model on the left and the
AddressSnapshotHostNodeID from the interface on the right and bind them together.
Maintain the Parameters
Mark the Embedded Component and have a look at the Parameters in the Properties tab.
You need to provide these parameters:
Parameter |
Value |
---|
AddressSnapshotHostAddressSnapshotUUIDFieldName |
Internal name of the element which defines the association.
You need to prefix the name of the association with "SAP_" and - as the GDT is structured - suffix it with "/content".
E.g.:
• SAP_Address/content
• SAP_DeliveryAddress/content"
• SAP_MainContact/content |
AddressSnapshotHostBOName |
The name of your Custom Business Object |
AddressSnapshotHostBONamespace |
The namespace of your solution.
You may copy it from the Properties window of the
SDK after selection the solution
E.g.: http://123456-one-off.sap.com/YABCDEFGY_ |
AddressSnapshotHostNodeName |
The name of the HostNode. |
The other parameter describe the look-and-feel of the Embedded Component, like the title, visibility, and edit mode.
Step 3:Use it
You can now enter any address data in the Embedded Component.
The Embedded Component itself takes care that this data is persisted and updated on save.
Even more: It takes also care that the association is set in the HostNode of your Custom Business Object.
This means you can access the address data also via ABSL.
That's all, folks.
Horst