• Home
  • About me
  • FALV
  • ALV Grid in the nutshell
    • Basic Information
    • Field catalog
  • Articles
    • Tricks
    • FALV (Fast ALV Grid)
    • ALV Grid in the nutshell
    • Tips
    • How to...
    • For beginners
    • Thoughts
  • By Topic
    • ALV
    • ALV OO
    • SALV
    • GOS
    • Selection screen
    • Purchase Requisitions
    • Purchase Orders
    • Attachments
    • Others
    • Characteristics
    • Sample Programs
    • ZIP
    • OLE
    • Mails
    • Routings
    • EWB
    • Excel
  • Keywords
  • RSS
  • Download
  • Home
  • Articles
  • Tricks

Selection-Screen Function Key in Form, Function Module or Method

Details
Łukasz Pęgiel
Tricks
21 November 2018
Hits: 17068
Tags: SELECTION-SCREEN FUNCTION KEY , RSDBRUNT

Have you received someday an error from your ABAP object saying that "The statement SELECTION-SCREEN is not allowed within FORM routines and function modules." and you wondered why it is blocked to manipulate the five custom function codes on selection-screen? Well, definitely I have and it was really annoying as I wanted to be able to dynamically assign the slection-screen function key depending if it's already used by program or not.

 

To make long story short - I was correcting one day an old-style written code to include two additional function keys on selection-screen, which were "Favorite variants" and "Clear All fields". They are quite useful but you always had to attach an include(s) to your program and then call specific forms from it. One of the include contained the lines with statements SELECTION-SCREEN FUNCTION KEY 1 & 2, the other defnition for TABLES: sscrfields. I've move the logic to class instead of includes so I could get rid of the need of having them in the programs but I couldn't do anything with this statement as it's not possible to use it within the method. So I've let this statement to be added manually always while using the "Favorite" and "Clear All Fields" function.

Few days ago I've started to work on the created class again while users wants the favorite function to be extended, so after some refactoring and cleaning of my old bad programming, I've decided to check again if there is no really possibility to show or hide the function key on the selection-screen dynamically from method call. 

 

I knew already that whenever you handle selection-screen then program RSDBRUNT is called which is manipulating the output of the selection screen and also the GUI status. 

After some debugging I found interesting global variables there: CURRENT_SCREEN and CURRENT_SCR. 

CURRENT_SCREEN contained the information about active function keys and CURRENT_SCR together with lots other information - the table which is used to exclude function codes from GUI Status.

Add a comment
Read more ...

Unlock yourself on the DEV system

Details
Łukasz Pęgiel
Tricks
15 November 2018
Hits: 8482
Tags: ABAP4_CALL_TRANSACTION , CL_IDENTITY

This is funny story, I tend to lock myself many times on the DEV system because of the wrong typing of the password. Mainly it happened when I switch the layout of the keyboard in Windows from Polish to German.

Normally it would not be a problem to ask your colleagues which is sitting next to you, to unlock your user, but because of the company policy, we cannot manage other IT colleagues accounts in SAP. So I was asking always Basis team to unlock me, but as I do it often, then I said to myself, that there need to be an option to unlock myself without bothering my Basis colleagues.

And there is one.

But there are two prerequisites - you need to have access to other system that has trusted RFC connection to the DEV system and you have to have debugging rights with possibility to make changes during debugging. In most cases I think this is standard for developer :)

 

OK, so here are the steps:

1. On system to which you have access go to SE37/SE80 and run ABAP4_CALL_TRANSACTION FM with proper RFC target of your DEV system and transaction SU01.

Add a comment
Read more ...

How to extend the time between SAP license installations on NPL

Details
Łukasz Pęgiel
Tricks
03 August 2018
Hits: 5381
Tags: VIRTUALBOX , SLICENSE , SAP NPL

This time it will not be about ABAP but about the way how to extend the time between installation of new license for you NPL instance that is run using Virtualbox and OpenSuse. 

 

Normally it's not a big deal to instal the license, but if you don't use your instance for a while and in the meantime the license has expired, the before you can do anything you need to login to your instance with SAP* user and update the license in SLICENSE transaction. This sometimes makes me a bit nervous. That's why I've setup my installation this way, that the time between OpenSuse and Windows host is not synchronized. This makes that instead of 3 months between installing new license you can extend this time even to year or more. 

Below you can find the way and prerequisites that are needed to achieve this.

Add a comment
Read more ...

Create XLSX file from internal table in background v2

Details
Łukasz Pęgiel
Tricks
01 June 2018
Hits: 102930
Tags: CL_SALV_CONTROLLER_METADATA , CL_SALV_BS_LEX , CL_SALV_TABLE

You may saw before the article Create XLSX/MHTML file from internal table in background and you may have use it without any issues before, but it seems that in newer releases of SAP (definitelly >= 7.50) this way makes corrupted XLSX files. 

So I've rechecked again how it is done in ALV grid in the new NW releases and I've updated the code, so now the issue with corrupted file is solved.

The mothod is simplified as much as possible at the moment, at the end all you must pass to a method is your internal table, but you can also pass sorting, filter and layout criteria using ALV grid structures.

The definition of the method should look like this:

    class-methods: create_xlsx_from_itab
      importing
                it_fieldcat      type lvc_t_fcat optional
                it_sort          type lvc_t_sort optional
                it_filt          type lvc_t_filt optional
                is_layout        type lvc_s_layo optional
                it_hyperlinks    type lvc_t_hype optional
        value(itdata) type standard table

      returning value(r_xstring) type xstring.

Add a comment
Read more ...

Re-explode or delete purchase order line subcontracting BOM

Details
Łukasz Pęgiel
Tricks
04 February 2017
Hits: 15724
Tags: ME_COMPONENTS_MAINTAIN , ME_COMPONENTS_UPDATE_PREPARE , CL_PO_HEADER_HANDLE_MM , IF_PURCHASE_ORDER_MM , ME_COMPONENTS_REFRESH , MEREQS_EBAN_LOOKUP , ME_COMP_REQUIREMENT_DATE
To continue previous two posts about re-exploding and deleting subcontracting BOM of purchase requisition item, let me describe you how to do the same thing with subcontracting BOM of purchase order line.
 
The main part is again to use FM ME_COMPONENTS_MAINTAIN and ME_COMPONENTS_UPDATE_PREPARE , but this time there is no easy way to fill MDPA and MDLB structures which are needed here.
So I had to use CL_PO_HEADER_HANDLE_MM and IF_PURCHASE_ORDER_MM to fetch all data from purchase order and to move them to MDPA and MDLB structures. Once it was ready the rest was peanuts and I could get rid of using this two buttons :-)
 
 
Add a comment
Read more ...

Deletion of subcontracting BOM in Purchase Requisition

Details
Łukasz Pęgiel
Tricks
03 February 2017
Hits: 10083
Tags: ME_COMPONENTS_UPDATE_PREPARE , ME_COMPONENTS_MAINTAIN , IF_PURCHASE_REQUISITION , IF_BOM_MM , ME_COMPONENTS_REFRESH , ME_FILL_MDPA_FROM_EBAN , ME_FILL_MDLB_FROM_EBAN , CL_MESSAGE_HANDLER_MM
In previous post I've shown how to re-explode subcontracting components of purchase requisition using FM ME_COMPONENTS_MAINTAIN and ME_COMPONENTS_UPDATE_PREPARE . Using very similar code you can delete completly it's BOM. 
 
You may wonder why would need to delete subcontracting BOM? This is not possible in standard transaction ME52N and in most cases it makes no sense to have the subcontracting item without BOM. But in the case that you don't want that components are taken into consideration by MRP until you really need this then it could be helpful.
 
The code is 99% same like during the re-exploding the BOM, the difference is that FM ME_COMPONENTS_MAINTAIN is called with parameter i_vorga = 'D'  and message check at the end is bit different.
Add a comment
Read more ...

Re-explosion of subcontracting BOM in Purchase Requisition

Details
Łukasz Pęgiel
Tricks
02 February 2017
Hits: 14920
Tags: ME_COMPONENTS_UPDATE_PREPARE , ME_COMPONENTS_MAINTAIN , IF_PURCHASE_REQUISITION , IF_BOM_MM , ME_COMPONENTS_REFRESH , ME_FILL_MDPA_FROM_EBAN , ME_FILL_MDLB_FROM_EBAN , CL_MESSAGE_HANDLER_MM
I faced lately a small issue in one of the process in our company, I needed to re-explode the BOM of subcontracting item in purchase requisition. Normally users goes to ME52N and press "Explode BOM" button, but I needed to do this from ABAP side. 
 
I started with IF_PURCHASE_REQUISITION but although there is a method "explode_bom" for item, then it was calling the screen with the results instead of selecting and updating components in the database. IF_BOM_MM didn't helped as well.
 
I started to dig in the standard transactions and local classes of ME52N and finally I have figure out how to do this in backgroud. The solution was to run FM ME_COMPONENTS_MAINTAIN and ME_COMPONENTS_UPDATE_PREPARE in correct way together with message handler to not interrupt whole process.
Add a comment
Read more ...

How to handle CL_GUI_ALV_GRID events in SALV

Details
Łukasz Pęgiel
Tricks
09 October 2016
Hits: 51281
Tags: CL_GUI_ALV_GRID , CL_SALV_TABLE , IF_ALV_RM_GRID_FRIEND
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:
Add a comment
Read more ...

More Articles ...

  1. How to access private or protected data and methods of CL_GUI_ALV_GRID
  2. Send mail in BADI or User-Exit without commiting
  3. WYSIWYG HTML Editor in ABAP
  4. The SIN of progress indicator
  5. Dynamic GUI STATUS & TITLE with ABAP code
  6. GOS - How to add business documents at creation of object
  7. GOS - Link Business Documents from PR to PO
  8. ESDUS, ESRUO - MM settings table - Part 3/3
  9. ESDUS, ESRUO - MM settings table - Part 2/3
  10. ESDUS, ESRUO - MM settings table - Part 1/3
  11. Enhanced MB51 Part 6 - ZMB51 program
  12. Enhanced MB51 Part 5 - Export from MB51
  13. Enhanced MB51 Part 4 - Call MB51
  14. Enhanced MB51 Part 3 - Get selection parameters
  15. Enhanced MB51 Part 2 - Structure for data
  16. Enhanced MB51 Part 1 - Goal and prerequisites
  17. Range to search in lower case fields
  18. Extend allowed runtime of a program
  19. Copy routing (create on a base of existing one)
  20. Create XLSX/MHTML file from internal table in background
  21. Subtotal lines of ALV GRID OO as content separator
  22. Refresh ALV GRID and keep position and current cell
  23. Save message with attachment in Outlook's Drafts
  24. Zipping in IZArc with ABAP directly on PC
  25. Link Attachments of Purchase Requisition to Purchase Order
  26. Free global data of a program at once
Page 1 of 5
  • Start
  • Prev
  • 1
  • 2
  • 3
  • 4
  • 5
  • Next
  • End


Łukasz Pęgiel
LVC FCAT FIELDCATALOG GUI ALV GRID SALV CONTROLLER METADATA GTGET GOS MANAGER PRAGMA BAPI OBJCL GETDETAIL ISOLATE SELSCREEN CLASS READ ALINK CONNECTION GTINSERT ALV GRID IN THE NUTSHELL FALV COMPONENTS REFRESH CONVEXIT SLIN UTIL How to copy BOM using CEWB Function Modules FREE SESSION CHECK AUTHORITY-CHECK Load variant to single subscreen selection screen PERIOD AND DATE CONVERT OUTPUT SAVE USER OBJECTS SET SELECTED ROWS GOS - Link Business Documents from PR to PO RECEIVE RESULTS FROM FUNCTION Custom selection-screen fields for MD07 MS07 ALV Grid in the nutshell Field catalog - no sum ALV GRID VARIANT CATALOG ZDEMO FALV10 - Color Settings SBCS SEND UPDATE AiE Copy routing create on a base of existing one Endless loop in BADI ME PROCESS CUST Field catalog - cfieldname SETTINGS SERVICE TOOLS PURCHASE ORDER Field catalog - datatype TRANSFER SLIS FROM SELECTOPTIONS ITM PROVIDE FALV08 - Mass replace function ECLIPSE BOM ESRUO - MM settings table - Part 2 IXML STREAM FACTORY FALV11 - Editable Grid settings ESRUO - MM settings table - Part 1 Field catalog - do POPUP PARAMETERS SUM PREPARE ABAP IN ECLIPSE How to teach ABAP Create a nice looking chart with CL CHART
  • Laserowe usuwanie blizn Tychy
  • Laserowe usuwanie zmarszczek Tychy
  • Salon Kosmetyczny Tychy
  • Trycholog Tychy
  • Wypadanie włosów Tychy
Tweets by abapblog

Eclipse Plugins for ABAP

ABAP Favorites

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client

ABAP ADT Extensions

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client

ABAP Quick Fixes

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client

 

Latest Articles

  • ABAP in Eclipse - Install, Configure, Use, and Enhance Your ADT
  • ALV Grid in the nutshell: Field catalog - col_id - ALV control: Column ID
  • ALV Grid in the nutshell: Field catalog - dfieldname – Fieldname for column group
  • ALV Grid in the nutshell: Field catalog - Hotspot - ALV control: SingleClick-sensitive
  • ALV Grid in the nutshell: Field catalog - sp_group - Group key
  • ALV Grid in the nutshell: Field catalog - domname - Domain name
  • ALV Grid in the nutshell: Field catalog - reprep - ALV control: Value is selection criterion for rep./rep.intf.
  • ALV Grid in the nutshell: Field catalog - reptext – Heading
  • ALV Grid in the nutshell: Field catalog - lowercase - Lowercase letters allowed/not allowed
  • ALV Grid in the nutshell: Field catalog - intlen - Internal Length in Bytes
  • Downloading Exchange Rates from NBP (National Bank of Poland)
  • Downloading Exchange Rates from Central Bank of Turkey
  • ABAP Extensions - Automatic Logon
  • ALV Grid in the nutshell: Field catalog - inttype - ABAP data type (C,D,N,...)
  • ALV Grid in the nutshell: Field catalog - datatype

Most Read

  • Create XLSX/MHTML file from internal table in background
  • Refresh ALV GRID and keep position and current cell
  • Create XLSX file from internal table in background v2
  • FALV (Fast ALV Grid)
  • ATC Pseudo Comments list
  • Call standard F4 search help with customized parameters
  • Dynamic GUI STATUS & TITLE with ABAP code
  • Create fieldcatalog from internal table
  • Link Attachments of Purchase Requisition to Purchase Order
  • GOS - How to add business documents at creation of object
  • Endless loop in BADI ME_PROCESS_PO_CUST
  • Create a nice looking chart with CL_GUI_CHART_ENGINE - Part 3 - Chart Data and render
  • How to access private or protected data and methods of CL_GUI_ALV_GRID
  • Subtotal lines of ALV GRID OO as content separator
  • Popup with multi-select ALV
feed-image Feed Entries

Latest Comments

ABAP code and articles provided on http://abapblog.com, if it is not statet otherwise, were created by Łukasz Pęgiel. You can use the code in your SAP instance for commercial and non-commercial use without any warranty from side of the author. You cannot sell the code as a full program or a part of it.
Replicating of the articles and code is prohibited unless the agreement of the author is given to you. 

Bootstrap is a front-end framework of Twitter, Inc. Code licensed under MIT License. Font Awesome font licensed under SIL OFL 1.1.