Formatting CDS Source Code to Improve Readability
You might know the formatter (a.k.a. pretty printer) in the core development scenario. It aligns the source code in accordance to predefined rules. Consequently, it adds/removes, for example, tab stops, line breaks, spaces and improves readability.
As of SAP NetWeaver AS for ABAP 7.51 innovation package SP00, you can also use the formatter for CDS entities. Open your CDS entity and choose Source Code > Format from the context menu.
Formatting is then performed directly in the editor.
Predefined Profiles
SAP provides you a predefined default configuration. But, you can also define your own formatting behavior for specific use cases. You can even share this profile with your team by exporting or importing it from them. Not bad!
You configure the DDL Formatter using a profile for each ABAP project in the Preferences. Open the ABAP Development > Editors > DDL Formatter Preferences page.
Here you find SAP’s standard profile. To create your own choose New or Edit to adapt the default profile.
The Profile dialog is then opened. From here you can open several tabs to define specific formatting behavior.
An integrated preview helps you to check the outcome of your configuration when typing.
For more information, look here Formatting DDL
Hello,
Very good blog 🙂
I try to do what you explained but I have an error :
DDL formatter is not available in project 'blablabla'
What do you think ?
Regards
Hi Joseph,
I am sorry for my late response.
On which SAP NetWeaver release is your S01 system based?
Formatting is supported as of SAP NetWeaver AS for ABAP 7.51 innovation package SP00
Kind regards,
Wolfgang
Thanks for your response... and sorry for the delay. At least with my S/4Hana system I have retreive the file that anyone can import into eclipse :
Copy it into a file without specific extension and then import the file in eclipse.
Regards,
Joseph
Hello Wolfgang,
DDL Formatting is a great feature for CDS Views. Thanks for this blog.
We are on the NetWeaver ABAP release 7.50 SP07 (SAPK-75007INSAPABA) and it says DDL formatter is not supported. Do we require BW 7.51 for the formatting to work or is there an equivalent 7.50 Patch or note that we can apply to get this working? Any help is greatly appreciated.
Thanks,
Sundeep
Hi Sundeep,
thank you for your kind feedback.
Formatting is supported as of SAP NetWeaver AS for ABAP 7.51 innovation package SP00
So, NW7.50 SP07 does not yet support CDS formatting. I think the issue does not relate with BW 7.51.
Kind regards,
Wolfgang
Hey guys, I work with Eclipse and an S/4 system. The DDL Formatter is not available for me. Is it available for S/4 systems or only for NetWeaver 7.51?
Thanks!
Hi Rene,
The ABAP CDS DDL Formatter is supported as of SAP NetWeaver AS for ABAP 7.51 innovation package SP00 and higher. This means, your S/4 system (in the context of on-premise) should support this formatter.
Please provide me more information what do you mean with "not available". Please also see here my latest ADT documentation.
Kind regards,
Wolfgang
hi Wolfgang Woehrle,
i didn't find option to convert names to lower case and keywords to upper case when format is applied on CDS DDL source code.
can you help me how to convert keywords to upper case and non keyword to lower case (Like ABAP Pretty printer)
regards,
Balu.
Hi Balu,
I am sorry, there is no DDL formatter to convert element names or keyword in upper or lower case.
It was decided to keep the keywords in ABAP CDS source code in lower case. Identifiers are converted to original case (=> as it is written in the definition of the data source/element).
Kind regards,
Wolfgang