although I'm still in Barcelona and the event just finished, I'd like to share with you some first thoughts I have about SAP TechEd 2016 event.
This year in July I received an email from SAP Developer Relation team that I was nominate for one of thirty SAP TechEd Developer Heroes 2016.
This was quite unsuspected but at the same time very pleasure information. I was nominated for Contributing to ABAP and OS projects, I guess because of FALV project ( my part in abap2xlsx is too small ). To be honest there are many other developers who should get the Developer Hero title and I hope they will do next year, just don't be afraid to vote for them ( I'll not ).
If you follow my blog, then you probably noticed that I'm not keen of SALV class, as it's not editable and you cannot handle all events that you can in cl_gui_alv_grid class. With a small trick you can make your SALV editable and you can handle all the events you want from underlying cl_gui_alv_grid object.
What you need to do, is to set handler for event after_refresh for all instances of cl_gui_alv_grid and to force refreshing of SALV just after creation of the object. Then inside the handler for after_refresh event you can set up handlers for other events just for current instance and you can modify layout or field catalog settings to make it editable.
Please check following code to see example of usage:
Why I like to code ABAP in Eclipse?
I was receiving this question very often in the past, but I really thought that most of the developers who can use AiE, are using it. But seems that I was wrong. Still a lot of you use SE80. I don’t mind it, I also use it myself in some circumstances, but sooner or later you’ll need to switch to AiE, for example when you work with HANA.
That’s why I’ve decided to write about why I use AiE. What I like in it and what I dislike. AiE is not perfect (yet) but there are some advantages which you should consider.
1. My first touch with ABAP in Eclipse
It was not the love from the first sight. Although I liked very much the idea of using Eclipse for developing in ABAP. When I’ve read about it, I said – “Finally, a proper development environment for ABAP”. But the reality at least for me was not that bright at the moment. Eclipse was working quite slow at the time or at least at the system installation I was using. I’ve been trying Eclipse Juno at that time, and after 2-3 days I gave up.
I’ve return to Eclipse after month or two, when Kepler release was out together with new version of AiE. I’ve said at the time: “I’ll try to work with Eclipse for one month, if it will not convince me, then I’ll not try it at least to the next Eclipse version (they appear regularly each year)”.
But after one week of working with Eclipse and ABAP OO, I was sure that this is the correct way of working, although there were still some improvements to do.
3. AiE Support and development
Before I will write about the tool itself, I’d like to mention whole AiE development team with Thomas Fiedler on the top of it. Whole team is doing really good job and they are really open on all suggestions and remarks. It happened not once that after a suggestion on SCN or Twitter some new option was added. And when you face a bug in Eclipse, they are also there to help and solve the issue.
Cannot say more than BRAVO!
Please be aware that accessing private or protected data may have unpredictible consequences! Use it at your own risk.
From time to time, it happens that you want to access private data or methods from CL_GUI_ALV_GRID, which is normally not possible.
When you look into the class definition you'll notice that there is only one global friend - interface IF_ALV_RM_GRID_FRIEND which has no attributes or methods declared. Quite strange, isn't it?
When you'll search were this interface is used then you'll notice that it's helping to get access to private grid data. So why not to use it the same way?
Everybody sends mails from SAP, some are still using old FM SO_NEW_DOCUMENT_ATT_SEND_API1 but some CL_BCS class. This class is really powerful but it has one disadvantage - it does commit work, and not only when sending emails but also during adding of attachments. In this case it's really not safe to use this class in BADIs or User-Exits, but there is one replacement for CL_BCS -> CL_BCS_MESSAGE. This class only collects the data, and when send method is run then calling a FM SBCS_SEND with destination NONE, or SBCS_SEND_UPDATE in update task, depending what attributes are passed to the class. It means you can use it also in BADIs or User-Exits where commits are not welcomed.
I was lately trying to find an HTML WYSIWYG editor for ABAP, but I failed. I though or this was not needed so far, or the solution was not posted anywhere. So I've tried several times and thanks to NICEdit and this tread on SCN I found the way to make HTML WYSIWYG editor for ABAP.
My editor use CL_GUI_HTML_VIEWER to display NICEdit in container, and then thanks to POST method I put changes back to SAP. ZCL_HTML_EDITOR class, which is attached to this post, raises an event whenever someone click on save button in the editor, so you can easily handle it and then use new HTML for your purposes. Video bellow shows the demo of usage.
Finally I've finished to work under FALV. You can find FALV classes in attachment and description under the links. But firstly let's go through few following points:
- Why I've created FALV although SALV classes are provided by SAP?
I know SALV classes although I haven't used them often. The main reason was that they don't provide edit mode. So at the end I've always worked with cl_gui_alv_grid class so then whenever users decided that they need one of the field to be editable then I can do it in few seconds/minutes.
- But there is a way to make SALV editable!
Yes, I know the solutions of Naimesh Patel (found here) and Paul Hardy (in his ABAP to the Future book) and some other folks to make SALV editable. But In my own opinion, especially when you're at least on 7.40 with SP5 making SALV editable is not needed as you can fast create ALV Grid which does everything you want. To be clear the big advantage of SALV, to call grid output of table in two, three lines when you goes to the code you'll see it's nothing more than call of REUSE_ALV_GRID_DISPLAY... really old FM, which at the end use CL_GUI_ALV_GRID.
- Direct reasons
As I used CL_GUI_ALV_GRID so often then I came up with an idea to do some class which will make the creation faster, but I never had time to do it at work. You may know it, because of the time pressure you choose to create report/program/solution in the way you're doing from years ... and then comes another task....and another....
So I've decided to do it at home.... yeah I'm crazy. But at least some of you can also use it.
I've worked on this on 7.40 SP8 but this should work also on SP5 as well. Sorry for the users bellow that versions but I'm so used to use new syntax that I couldn't force myself to use old way of coding.
UPDATE: Thanks to Santi Moreno we have now 7.31 version, you can find it here as an attachment ZFALV_V1.1.0.zip. Also GitHub repository is now available here https://github.com/fidley/falv so if you'd like to join us, you're more than welcomed.
The outcome of this work is following:
- Package ZFALV
- Function Group
- ZFALV - screens, GUI STATUSES, TITLE, FMs for ZCL_FALV, local classes
- Demo Programs
- ZDEMO_FALV01 - FALV: Demo Simple Full Screen Call
- ZDEMO_FALV02 - FALV: Demo with Redefinitions
- ZDEMO_FALV03 - FALV: Demo Full Screen GUI Status Dynamic Partly
- ZDEMO_FALV04 - FALV: Demo Full Screen GUI Status Dynamic Fully
- ZDEMO_FALV05 - FALV: Demo Full Screen ALV Toolbar
- ZDEMO_FALV06 - FALV: Demo Full Screen Layout
- ZDEMO_FALV07 - FALV: Demo Full Screen Columns
- ZDEMO_FALV08 - FALV: Demo Mass Replace Function
- ZDEMO_FALV09 - FALV: Demo Cell Settings
- ZDEMO_FALV10 - FALV: Demo Colors
- ZDEMO_FALV11 - FALV: Demo Editable
- ZDEMO_FALV12 - FALV: Demo Error Log
- ZDEMO_FALV13 - FALV: Mix Demo + own screen and container usage
- ZDEMO_FALV14 - FALV: Popup calls
I really encourage you to try it and give me your feedback about FALV.
On one of my last tweets I have mentioned, that I'm working currently on some fast ALV Grid creation class. I know that we have SALV classes which does many of this what I'm trying to achieve here but, many doesn't mean everything. Especially that I really like CL_GUI_ALV_GRID class and this that without any tricks I can make it editable in easy way.
My class in not yet finished but it has already some basic functions available, that's why I'm presenting you just short demo and some screen-shots of the code. I will of course put a nugget here as fast as I'll finish more than alpha release.
Basically what I try to get from this class:
- Fast CL_GUI_ALV_GRID creation
- Replacement of REUSE_ALV_GRID_DISPLAY and REUSE_ALV_GRID_DISPLAY_LVC for a simple editable reports to omit screen creation
- All events should be already handled and with redefinition of method I can faster use it
- Faster setting of layout and field catalog attributes
- Easy switch and copy between popup, full screen and container version
- Easy toolbar handling (in grid and in full screen/popup using Dynamic GUI STATUS & TITLE with ABAP code )
- One place to handle user commands of full screen/popup call -> event user_command
At the end of the work I'll be able to say: "I've made really good, unnecessary work! " :-)
This question seems to be funny as usually you rather read "How can I learn ABAP?". But how to teach? Should we follow any rules ? Should we keep to some path of teaching, special sequences or guides? Well I don't know the answer to all this questions but my experience in teaching ABAP gives me possibility to share with you what and how to do with your "apprentice".
Before I start I'll just mention that persons I've learnt/I'm learning have always at least basic skills in programming but in other languages, therefore I didn't mention here any points about teaching the basic programming stuff here.
1. Start with basic info about ABAP
When you switch to new programming language you firstly check what types are built-in, what is the syntax to create a function or method and this is what you should start with when you teach ABAP. I have created some basic description about types, basic syntax, tables, etc. for my master’s thesis and give it always to newcomers to read it as a first step. I have there also small description about main development transactions. So if you know that you'll learn more than one person, then it's really useful to have such document. If you don't have it, then create it. It will take a while, but once done it's done.
After such lecture your young Padawan should be able to write "Hello World" programs and should be familiar with really basics of the ABAP.
Just as remark, as long as you don't have really trusted and up to date source, don't use ready documents of someone else in here, as this can bring you headache from the beginning of this long way.