skip to Main Content

Dev Tip: Use descriptive property names in OData entities

In case you’ve missed our dev tips in past weeks, we will be posting them in the blog moving forward. To sign up and get your dev tips delivered to your inbox each week, click here!

OData entities

Tip of the Week

Use descriptive property names in OData entities. This will make your service self-documenting and much clearer for consuming applications. An example is naming your property “SalesOrderNumber” rather than “VBELN”.
When I first started in the SAP development world many years ago, my mentor told me that when the table and field names started making sense, I could consider myself a “real” ABAPer.  If you’re reading this, you likely agree!  That being said, the SAP development world has changed, and we now find ourselves writing Gateway services for developers who have never logged into SAP.  We can easily eliminate the learning curve for our front-end developer brethren by using better property (field) names in our OData entities.

Which of these is easier to understand to a non-SAP person?  Both return the same data.

Option 1:  SAP Table and Field Names Used

Option 2:  Descriptive Names Used
Option 2 is definitely the winner.  There are multiple advantages to using this strategy.

  1. Your service is self-documenting.  If a developer sees the entity SalesOrderHeader and property CreatedByName, there is little doubt on what information will be returned.
  2. Front-end programs become self-documenting, in terms of the data shown.
  3. It is kind to the developer who changes the service after you.  Descriptive names are like program comments – they let the next person know the intent of each entity and property.

 

If you have an interest in viewing similar content, visit our blog, here

View our LinkedIn, here

Mike Berg is a Senior SAP Developer at Mindset. He leverages his 18+ years of experience across various SAP technologies and functional areas to bring optimal solutions for customers to light. Mike focuses on bringing the best user experience possible to users, which in turn maximizes ROI for the organization. He does this by emphasizing the correct technology, be it Fiori, Personas, or other, and by optimizing application performance and ease-of-use. Mike is a regular contributor to Mindset’s blog and development tips newsletter, as well as a speaker at SAP Sapphire and ASUG events.

Back To Top