In my previous blog ‘How to get the new ABAP editor in LSMW’ I described how a single enhancement enables the new ABAP editor in SAP’s LSMW. While that solution only takes one implicit enhancement spot, it has a few (minor) limitations. In this next blog I will describe another approach to enabling the new ABAP editor in LSMW. This new solution is slightly more invasive, but gives us much more flexibility.
The solution
This solution involves an enhancement spot and a new function group with a screen. The big advantage of this solution is that almost all limitations of the first approach are gone. Also you will have full control of the screen and its functions. For this implementation I have added a set of much used LSMW functions directly on the toolbar (as buttons). You are free to add, remove, change those to your liking!
The solution
This solution involves an enhancement spot and a new function group with a screen. The big advantage of this solution is that almost all limitations of the first approach are gone. Also you will have full control of the screen and its functions. For this implementation I have added a set of much used LSMW functions directly on the toolbar (as buttons). You are free to add, remove, change those to your liking!
Features
- New ABAP editor for all ABAP coding within LSMW (field mappings, events, user defined routines and form routines)
- Code completion
- Pretty printer
- ABAP Syntax checker
- Use of LSMW-specific inserts (mapping source fields, global variables, global functions)
- Use of ABAP statement templates
- Use of (almost) all new-editor features such as Edit buffers, up- and download of source, etc.
- Automatic use of 72-character version of the new editor, irrespective of your global setting in SE80
Limitations
- Code completion is not aware of globally defined variables.
Implementation
By far the easiest way to implement is by using SAPlink. This will install the function group, screen and enhancement spot implementation in one go.
The implementation comprises
- A custom function group ZLSMW_NEW_EDITOR with one function module and one screen
- An implicit enhancement spot at the start of Subroutine EDITOR_START of Function group /SAPDMC/LSMW_AUX_080
- (optional) A user parameter to switch the solution on or off per user.
I added ample comments in the code, so it is easier to understand what is happening.
Implementation using SAPlink
I will assume you have installed- and are familiar with SAPlink.
- Install the .NUGG file attached to this post. It will upload and install the following components
- Development package ZLSMW
- Function group ZLSMW_NEW_EDITOR
- Implicit enhancement spot ZLSMW_NEW_EDITOR @ Subroutine EDITOR_START of Function group /SAPDMC/LSMW_AUX_080
- Check and activate the new objects. You might need to assign them explicitly to the new package ZLSMW (as they all end up in your $TMP)
- Manually create User Parameter ZLSMW_NEWEDITOR (how-to, scroll all the way down) and assign the parameter with value ‘X’ to each user that wants to use the new editor. All other users will not be affected.
- Done! Start LSMW and check out the new features!
Manual implementation
Alternatively you can implement it manually;
1. Package ZLSMW
Create a development package ZLSMW. Save and activate.
2. Function group ZLSMW_NEW_EDITOR
Create function group ZLSMW_NEW_EDITOR and assign it to the newly created package ZLSMW
3. Function module ZCALL_ABAP_EDITOR In the new function group create function module ZCALL_ABAP_EDITOR with the following interface
IMPORTING
REFERENCE(IV_EDITMODE) TYPE CHAR4
CHANGING
REFERENCE(CT_SOURCE) TYPE RSWSOURCETFor the implementation paste in the FM code from the attached text file code2.txt and save.
4. Include LZLSMW_NEW_EDITORTOP
Create a new include called LZLSMW_NEW_EDITORTOP in the function group and paste in the include code from the attached text file code2.txt. The include holds both the global variables, form routines and PAI/PBO Modules. I know, it is not as it should be done, but it limits the number of includes. If the new PAI and PBO modules etc do not appear in the SE80 tree you need to rebuild the object list. You do this by right clicking on the function group name in the SE80 tree on the left, then go to Other Functions –> Rebuild Object List.
5. Screen 3000
Create a new screen 3000. Add a custom container called EDITOR over the full size of the canvas and save. In the screens flow logic uncomment the PAI and PBO modules MODULE STATUS_3000 and MODULE USER_COMMAND_3000.
6. Pf-status EDITOR
Copy pf-status EDITOR from function group /SAPDMC/LSMW_AUX_080 to your new function group. Name it also EDITOR. Next you need to remove a few items from the menu bar. Remove the items in yellow:
Change the toolbar functions such
that it resembles below screenshot.
Optionally you can change the function keys to your liking.
7. Enhancement spot
Create an Implicit enhancement spot (how-to) at the start of Subroutine EDITOR_START of Function group /SAPDMC/LSMW_AUX_080. Paste in the enhancement code from file code2.txt attached to this post & activate.
8. User Parameter
Create a user parameter ZLSMW_NEWEDITOR in SE80 (how-to scroll all the way down). Assign the parameter with value ‘X’ to each user that wants to use the new editor. All other users will not be affected. This is optional. If you want all users to use the new editor, omit this step and remove the check in the enhancement spot implementation.
9. Done! Activate all and start LSMW.
No comments:
Post a Comment