ABAP Console Output in ADT
Did you know that you can run executable programs with F9 instead of F8 in recent versions of ADT (SAP NetWeaver Application Server ABAP 7.52)?
Running a program with F9 redirects WRITE outputs to an “ABAP Console” in ADT. No SAP GUI is needed any more.
But hello? Who who on earth is still willing to use WRITE?
Good to know, that CL_DEMO_OUTPUT also writes to the ABAP Console after F9!
You can also reach the console by implementing a special interface in your classes (from ABAP 7.51 on). But for small pieces of executable test code CL_DEMO_OUTPUT might be an option.
After having discovered this feature in the ADT release notes before 7.51 dev edition was out, I was really optimistic about it. I thought this would be a "java style"-console for ABAP (finally!).
Unfortunately there are some things which disappointed me going in with that expectation:
The last point is more annoying than deal breaking and I didn't know about the WRITE redirection until now which might fix it (feels really weird to add write statements in global classes though, is that even syntactically allowed o0).
I still had some fun with it 🙂
https://github.com/flaiker/abap-log/blob/master/src/zcl_alog_adt_logger.clas.abap
Hi Horst,
"in recent versions of ADT"
Which ADT/backend version is exactly required? Just tested with ADT 2.83.1 and ABAP 7.40 and nothing happened when I pressed F9. I guess I need 7.5x, right?
Thanks,
Peter
Added in the blog.
Thanks.
Hey Horst,
How are the chances that those fancy new ABAP/ADT features are ported back to 7.50? Since we can't just change the platform, we're stuck to 7.50 for the foreseeable future. It's unfortunate to see amazing new features come and not being able to use them.
Cheers,
Johannes
We are on 7.51 SP03 and ADT 2.83.0 (Exclipse Oxygene). Unfortnatelly after pressing <F9> nothing happens 🙁
Shouldn't there also be a context menu item? (or is there a newer ADT version already?)
It seems that 7.52 is needed.
It definitely works on AS ABAP 7.51 SP1 developer edition. Though I saw some modifications in SPAU by SAP in the default installation of it regarding the exact REST endpoint for the ADT console integration, so maybe they backported it in afterwards?
Hm, not for me for programs. I'm on 7.51 SP02 developer edition.
But it works for classes! There's the entry in the context menu, for programs not. Strange...
Ah thats it! I didn't even notice that in this blog it's a report.
In the documentation I think it also clearly states you need a class and implement IF_OO_ADT_CLASSRUN for the logging and then use the out-parameter of the main method.
Just having it implicitely done in a report seems to be a newer 7.52 only feature then.
(cannot edit my previous comment "We are unable to complete your request. You may have been logged out from your session. Please re-login and try again.")
What about running ABAPUnit with Console Output?
Basically everything I would like to see in the Console are variables returned frome my production code inside my unit tests.
Like
Is there a way to display an entire itab while running the unit tests?
I currently use a method which loops over the itab and asserts it to '' using the quit = no flag.but thats quite an ugly hack.