Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
kammaje_cis
Active Contributor

Hi Friends,

I thought of sharing the naming conventions I follow to improve the readability of my OData service for UI developers and other consumers.

General rules for all artefactsNo "ALL CAPS"
Use Camel case
No Underscores
Use English Names
No SAP technical names
Entity NamesOnly Nouns
Only Singulars
Not to contain operation names
:smile: examplesSalesOrderHeader, SalesOrderItem, Address, CostCenter
:cry: examples:SALES_ORDER, PO_CREATE, Orders, CostCenterF4, Bukrs, PurchaseOrderList
Complex TypeWhenever you have too many fields in your entity, improve the readability of your Entity by grouping fields into Complex Types
:smile: examples

Complex Type "Address" for complex properties "DeliveryAddress", "PostalAddress"

Complex Type "CompensationDetail" for complex properties "OldCompDetail", "NewCompDetail"

Entity SetsPlural of Entity name. Or add 'Set' at the end of Entity name
:smile: examples:SalesOrderHeaders, SalesOrderItems, Addresses, CostCenters, Currencies, CurrencySet
NavigationsSame as Entity name if the target cardinality is 1
Same as EntitySet name if the target cardinality is M
Reasoning:

Consider two self explanatory, related entities, SalesOrderHeader and SalesOrderItem. Consider the navigation between them named as "SalesOrderItems". Now, to navigate from header to item, we canuse a self explanatory URL as below.

..............<ServiceName>/SalesOrderHeader('DummyKey')/SalesOrderItems

If you had named the Navigation as say "Header_Item", then you would have called URL

..............<ServiceName>/SalesOrderHeader('DummyKey')/Header_Item

which is not at all consumer friendly.

Function ImportsName should clearly Indicate the operation getting performed
:smile: examples:ReleasePO, ApproveLeave, BlockSalesOrder, GetReleaseStatus

Let me know your views and if you follow any other best practices.

1 Comment
Labels in this area