1 1 1 1 1 Rating 0% (0 Votes)

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 ...

1 1 1 1 1 Rating 0% (0 Votes)

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 ...

4.66666666667 1 1 1 1 1 Rating 93% (3 Votes)

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 ...

5 1 1 1 1 1 Rating 100% (5 Votes)

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-methodscreate_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(itdatatype standard table

      returning value(r_xstringtype xstring.

Add a comment
Read more ...

4.93103448276 1 1 1 1 1 Rating 99% (29 Votes)
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 :-)
 
 
Read more ...

4.93333333333 1 1 1 1 1 Rating 99% (30 Votes)
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.
Read more ...

5 1 1 1 1 1 Rating 100% (32 Votes)
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.
Read more ...

4 1 1 1 1 1 Rating 80% (2 Votes)
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 ...
Page 1 of 5

ABAP Favorites Eclipse plugin

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