AMDP Pretty Printer
Maybe you know the blog post from Thomas Fiedler Where to hell is the Pretty Printer?
Since 2019 I am wondering where to hell is the Pretty Printer for AMDPs.
The SAP standard Pretty Printer (ABAP Source Code Formatter) does not really format the AMDP source code.
Therefore, I developed in my spare time an AMDP Pretty Printer. It is not an SAP product.
It has the following main features:
- Write key words upper case and the rest lower case
- Indent the AMDP (SQL) source code of the class
- Leave the ABAP part of the class as it is
Here is a short demo:
The AMDP Pretty Printer consists like the SAP ABAP Development Tools of a Rest Service in the SAP Development System that contains the Pretty Printer logic and an Eclipse Plugin that calls the Rest Service and adjust the coding.
You can find it with an installation manual on my github account (MIT license).
It saves me a lot of time during the development of AMDPs and it makes the source code more legible. I’m sure it will help you, too.
I’m looking forward for your feedback.
Really a great work Frank. Thanks for bringing this.
Thank you AjeethKumar R.
Thanks Frank for this add-on.
It's a pity that it's not part of standard, but I like the idea that the ABAP community is implementing such useful functionalities as an add-on.
I don't work much with AMDB yet. However I've installed on our S/4HANA sandbox system. It works fine and it's very useful.
Report ZAPP_PRETTY_PRINTER_TEST is very nice, too.
Thank you Peter. The ABAP community is great. Unfortunately, is the ADT SDK not so well documented like for example SAPUI5. I think there would be much more great community tools, if SAP would invest in it.
I tried the pretty printer in Eclipse version 2022-03, but it doesnt work. If i click on the pretty printer button i am getting the below error, can you please advice.
sorry for the late reply.
A colleague of me had a similar issue. Therefore, I added more details to the error message.
See also here: https://github.com/fmabap/AMDP_Pretty_Printer/issues/7
As he tried the new version then the error did not appear again (whyever).
So please try the new version.
Thanks, its working after installing the ABAP program from git. There is one issue with the pretty printer, when we have an in line code in the sql statement, the pretty print is taking the code next to the comment to the next line and it produces incorrect results, can you please check and correct this in your next version.
lt_Result = select * from employee
where eid = '101'; -- and ename = 'John';
After Pretty Print
lt_Result = select * from employee
where eid = '101';--
and ename = 'John';
I tested your issue with the test program ZAPP_PRETTY_PRINTER_TEST. The issue did not occur in my system.
Screenshot Test Program
Can you please check, if you have installed the latest version of the AMDP Pretty Printer and if the issue occures in this test program in your system.
If it occures, then please post here your example as coding block. So that there are no formatting issues.
Please post also, which configuration you chose in the transaction ZAPP_SETTINGS. You can find more details regarding the configuration here:
You can find further information regarding the test program at the end of this page (older version).
Thanks and best regards
I found the issue, its happening when there is no space between ; and the comment(--). Please check the below screenshot. Is there any resolution for this.
great, thank you.
I think I could fix it.
I created the github issue 19 for it.
Can you please check it?
The coding with the fix is in the new branch "#19-comment-after-;-without-space".
When you checked it successfully, then I will merge it to the main branch.