Skip to Content
Technical Articles
Author's profile photo Enno Wulff

SM30 Rant And Mass Data Input Idea

Recently there was a question in the german DSAG Community if there is a trick to insert more lines at once into the table maintenance dialog than there are on the screen. Short answer: There isn’t any easy way to do this.

Before I dig deeper into this topic and provide some solutions and workarounds, I would like to state that the lack of this – and other – functions is really a shame!!

SAP has become famous by Customizing. Nearly all of the customizing in an SAP-System is done by the generated table maintenance dialog. It hasn’t changed for years. IMHO there is so much potential to improve data input.

Missing functionality

The missing possibility of copying endless lines of data into a view is really annyoing. And there are some more functionalities that I am missing seen from users perspective:

  • Filtering data is very old-fashioned. You will have to select the fields you want to filter from a very small popup where the columns are sorted by name instead of using the sort order in table itself
  • it is not possible to sort data by column
  • it is not possible to move columns easily

From point of generating a table maintenance view there the following issues:

  • it is not possible to pre-define options
    • the visible size of a field
    • the type of field (checkbox, listbox)
  • fields of type decimals or integer will be moved from the overview screen to the detail screen even though there is no need for it
  • There is no place where modifications of the screens can be documented within the application. If you change the screen than you only can mark the dialog as “user changes are made – make sure to add them after generating the screens”

The only thing I recognized that has been fixed by SAP is the following:

  • Generating a table maintenance view created a table control with 80 characters in width so that many columns of wide tables are not directly displayed. The maxmimum possible value of 255 characters was not used. SAP changed that in some S/4HANA Release.

Events

The selection of data and the behaviour of some standard functions can be enhanced or replaced by events. This is a good way to add customer specific behaviour.

But there are a lot of things that cannot be done by events because the event is executed at an unfavorable spot or it is even missing.

The data itself is stored in several data containers where EXTRACT and TOTAL are the most important ones. It is not clear when which data exists in these containers. The containers contain the data in a single character value. Therefore the data must always be assigned to a fitting data structure. Furthermore, there are two extra fields which should be considered when manipulating data.

I am sure that there are better ways to provide customer exits with a better API.

History and special features

I am aware that there are circumstances that make it hard or maybe impossible to replace such a central functionality like the table maintenance views. But I also think that SAP could have put some efforts to renew or modernize this medieval way of that entry.

The following functions come to my mind that are not so obvious and kind of hidden in the maintenance dialog:

  • Table comparison across systems
  • BC-Sets
  • Usage in view clusters

Table comparison

It is possible to compare the current data with the data of remote systems. Data can also be taken over to update the current data.

The table comparison is not inseparable connected to the maintenance dialog so it should be possible to add this function easily to any other maintenance dialog.

BC-Sets

BC-Sets are a powerful tool to define predefined data. You can save specific data as a BC-Set. This data can still be changed in the dialog but can also be recovered in the original version. Or data can be activated for special processes by getting the relevant data settings from a BC-Set.

As the BC-Sets refer to just data of a table it might be easy to adapt this function to any different working maintenance view.

Usage in View clusters

All table maintenance views can be used in a view cluster. In a view cluster there can be dependencies defined of how two or more tables are related to each other.

I believe that the current way of embedding maintenance views in a view cluster is way more complicated than it should be. In my opinion it should be a lot easier to define and implement dependencies using an ALV Grid.

BOPF

I know that there is this BOPF-thing (Business Objects Processing Framework) and I thought, that this would replace the SM30-dialog, but Martin Fischer answered in a question if BOPF could be used for customizing:

BOPF is not build to access (read and write) customizing tables. BOPF is built to work with transactional data, so only tables containing transactional data or master data should be accessed with BOPF. For customizing tables SM30 views are still the right tool.

So, we are still in need of SM30 dialogs…

Ideas for mass data entry

Back to main topic: how to add many lines of data into a maintenance view dialog. The way we all use to copy data into a maintenance dialog is the following:

  • Copy table data from another dialog by pressing CTRL+Y, marking entries, CTRL+C to copy the data.
  • Data can also be copied from Excel if the columns have the correct order
  • Inserting data by positioning the cursor in the first entry field of the first liine of the table control and pressing CTRL+V

Using this technique, you can only copy as many lines as there are shown on the dynpro. Mostly this is okay, because the essence of a customizing table is that there are not thousands of lines. But it is also common that customizing tables have hundreds of entries. And before I think of copying 20 times a block of data and inserting it to another table, I would be thankful for any other technique.

Here they are:

  • GUI-Scripting
  • SE16N
  • A program

GUI scripting

The SAPGUI provides the possibility of recording data input and automate it. This is nearly the same than Batch-Input. The difference is, that the scripts can be controlled by the user; there is no need to have an SAP report to insert the data. Another difference is, that the existence of dynpro elements can be checked. This makes it possible to only enter data in a field that is visible and ready for input.

You can read more about this topic here: https://blogs.sap.com/2020/12/16/sap-gui-scripting-mass-updates/

The disadvantage of this solution is: It must be created for every new maintenance view. It is not generally usable.

There is a great (chargeable) product of the german company Ersasoft where recording can be done very easily: SimDia²

SE16N

The table display transaction SE16N is the swiss knife of every SAP consultant. If you have the appropriate authorizations, you may enter data into a table by using transaction SE16N. If function code &SAP_EDIT works, then you simply can switch to edit mode. If not and you have the right to change values in debugging mode, then you can change the variables GD-EDIT and GD-SAPEDIT to “X” to achieve the same.

I hope that in most companies this only works in development and quality assurance systems and not in the production environment…! 😀 Even if it works, there are some circumstances where it might not work:

  • the foreign key might not me defined properly on dictionary level and only programmed be the dialog. in this case you might be able to enter data that are not valid
  • special checks that might be defined in the table maintenance view are not respected. Again, it’s possible to enter invalid data
  • Dependent tables are not respected. sometimes it is important to fill dependent entries in another table. The maintenance dialog will inform you – SE16N will not.

A Program

At least I come to the most sensible option: A program! 😉 I am a developer and rarely do customizing. But the lack of mass data input in a customizing table triggers me from time to time. The forums question in the DSAG community now made me think of how a program should work to overcome this restriction.

The Program

The program can be used for every table where a table maintenance view exists for.

You have two choices:

  • import data from a CSV-file (not fully implemented; use of demo data)
  • import data from the clipboard (copied by Excel)

Mode of Operation

My solution needs to know the name of the table view of course. It will dynamically create an internal table with the tables structure. Additionally it adds the two fields ACTION and MARK. MARK is used by the table maintenance view for marking selected data. We do not need this. Important is the field ACTION where we define if the data entry should be inserted (N = new) or modified (U = update).

The data will be read from the desired source (file or clipboard) and split at the desired delimiter.

The created internal table with the imported data will be passed to function module VIEW_MAINTENANCE_GIVEN_DATA which displays it in the generated table view maintenance dialog.

My solution makes sure that only valid data can be inserted.

Github

Thanks to Lars Hvam you can download the sources via abapGit from: https://github.com/tricktresor/sm30-mass-data-input

Assigned Tags

      22 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Lars Hvam
      Lars Hvam

      I've previously used https://www.autohotkey.com to do mass data entry from CSV in SM30, no changes needed in the system, it runs locally.

      https://github.com/open-abap/open-table-maintenance is my (very simplified) take on a SM30, it works on 702 and up, plus on Steampunk, plus with preview deployments.

      Author's profile photo Lars Hvam
      Lars Hvam

      autohotkey: actually remembered, I have some sample code at https://gist.github.com/larshp/ee23a6e5d3ddb6038da9a705b0238ea1

      Author's profile photo Chaouki Akir
      Chaouki Akir

      Thank you. I tried it with autohotkey version 1. I used your file and I updated it (the number of lines of the 1st page is not equal to the lines of the following pages.

      Author's profile photo Lars Hvam
      Lars Hvam

      yea, it must be adjusted a bit to work on different screen sizes, as the number of rows is different in SM30 depending on screen size

      Author's profile photo Enno Wulff
      Enno Wulff
      Blog Post Author

      Hey Lars,

      sorry, I omitted your open Table Maintenenance . I knew, there was something I wanted to mention...

      Thanks for the hint with Authotkey. I will check betimes.

      Author's profile photo Matthew Billingham
      Matthew Billingham

      The table display transaction SE16N is the swiss knife of every SAP consultant.

      Not quite. It isn't a BASIS transaction - it started life in ERP and essentially has stayed there. If you check the attributes of the program behind it (RK_SE16N), you'll see it's assigned to Cost Accounting. And the package, WUSL, is assigned to software component SAP_FIN, and is a subpackage of APPL - Structure Package: Logistics/Accounting!

      TL;DR - BI consultants (for example) won't have it on their systems.

      Author's profile photo Sandra Rossi
      Sandra Rossi

      I use the transaction code S416N in SRM systems. It's SAP_BASIS. There's a SAP note about S416N* family.

      Author's profile photo Matthew Billingham
      Matthew Billingham

      Ah, note 2124497.  Valid for 740 upwards.

       

      Thanks for the hint!

      Author's profile photo Enno Wulff
      Enno Wulff
      Blog Post Author

      Thanks for the hint to Transaction S416N Sandra!

      Thanks Matthew for the SAP-note! there are also some other interesting transactions mentioned... 🙂

       

      Author's profile photo Shai Sinai
      Shai Sinai

      Regarding a successor tool in the S/4HANA / Fiori era, the solution may be Business Configuration Apps and a RAP Generator utility created by Andre Fischer .

      Author's profile photo Enno Wulff
      Enno Wulff
      Blog Post Author

      Thanks for the hint, Shai Sinai

      Author's profile photo Chaouki Akir
      Chaouki Akir

      Thank you Enno Wulff

       

      There is a dump when there is a field with type RAW. There is no dump with transaction sm30.

      sm30%20display%20without%20dump

      sm30 display without dump

       

      ST22%20pgm%20dump

      ST22 pgm dump

       

      se11%20table%20definition

      se11 table definition

      Debugging SM30 and the program at the instruction of the dump, you will see that TOTAL table is not the same (some "binary" format for sm30 and some "text" format in your program)

      Author's profile photo Enno Wulff
      Enno Wulff
      Blog Post Author

      Thanks for reporting this, Chaouki Akir !

      In my opinion it is an error that the fm VIEW_MAINTENANCE_GIVEN_DATA does not support RAW data types.

      I have no idea how to solve this issue... 🙁

      Author's profile photo Ryan Fleischmann
      Ryan Fleischmann

      RAP Generator is nice for this - but has a few kinks in its setup that need to be addressed. Generally, SM30 table maintenance generation to me still seems the faster and easier way to go. So how deal with this UX issue?

      CDS views have this neat feature built into ADT where you can generate a CSV file output of your data selection.

      Has to be a way to leverage this to automate the very task described.

      Author's profile photo Paul Hardy
      Paul Hardy

      First off, I am glad that the table maintenance generator now has the SM30 view filling the screen rather than just a tiny bit on the left. That would have taken someone at SAP ten seconds to fix. I have been manually increasing the generated screen length for the last 20 years at least. In another five or ten years I will be on an S/4HANA system and will not have to do this anymore - HOORAY!

      The next cab off the rank is that after you create the SM30 function via the table maintenance generator, you then create a variant transaction to maintain that table. Whilst creating the variant transaction you put in SM30 at the top, and then scroll down to the bottom of the screen where there is a postage stamp sized area where you can add variables e.g. VIEWNAME = Z_MY_TABLE.

      The trouble is the area is so small you cannot enter everything at once. You have to use an electron microscope to even see that area, and then constantly scroll up/down and left.right to enter the data. I have been cursing this for 20 years, as I imagine every single ABAP developer has. Has it been fixed yet?

      Someone is going to say - in that 20 year period have you complained to SAP about these two problems - the answer is YES.

      Moreover both issues were mentioned in Jelena's blog "stuff that SAP could easily fix"

      Cheersy Cheers

      Paul

      Author's profile photo Shai Sinai
      Shai Sinai

      Imagine you could even generate a new transaction automatically in a click of a button...

      Author's profile photo Paul Hardy
      Paul Hardy

      20 odd year ago someone somewhere may have suggested that during the SM30 table maintenance process that maybe an SM30 variant transaction should be created, and you could choose the name of the transaction...

      But no-one ever made such a suggestion did they? Or did they?

      Author's profile photo Paul Hardy
      Paul Hardy

      And if you are alluding to the RAP generator then that is a wonderful tool, In ten years' time most people will be able ti use it. Until hen it is still SM30 for most of us....

      Author's profile photo Paul Hardy
      Paul Hardy

      And while I am on the subject, when you are entering a list of SELECT-OPTIONS you get an option to upload a CSV file of values, that could be ten billion lines long.

      I gave my users a SE16N equivalent for a very small set of Z tables, where they could do the same so they did not have to cut and paste data 20 lines at a time, five hundred times.

      in the IMG that sort of option might be nice for adding new entries to customising tables. In shipment costing for example, if you have one hundred plants, adding SM30 entries to the IMG node takes ten billion weeks.

      Cheersy Cheers

      Paul

      Author's profile photo Bärbel Winkler
      Bärbel Winkler

      Belated thanks for this blog post, Enno!

      I have a somewhat related question and am wondering whether it's worth a distinct question in Q&A or not as searching for an answer didn't really provide really helpful results. I may need to "convert" what is currently a simple VIEW_MAINTENANCE_CALL for a Z-table to a "proper" maintenance program with all the functionality to display, update, insert and delete entries. It should also contain locking logic to allow users in different sales-orgs to update the table concurrently. We looked a bit into using the available event-logic but are not really sure about its viability in the longer term.

      Current thinking is to do this in our NW 750 (SP25, EHP8) system via a module pool program with screen logic like PAI & PBO processing. At a guess, this is something which has been created very often, so I'm curious if there's something like a "template program" out there which could be used as a starting point and simply be adapted as needed to the Z-table's specifics.

      Or are there other options, I'm not even thinking about?

      Thanks for any pointer anybody might have!

      Cheers

      Bärbel

      Author's profile photo Shai Sinai
      Shai Sinai

      May you elaborate on what are you missing in the standard SM30?

      Author's profile photo Enno Wulff
      Enno Wulff
      Blog Post Author

      Yes, concurrent maintenance is also a feature that I am missing in SM30.

      You might try the follwing workaround:

      • create a view where you mark the desired key fields as "Subset"
        • When calling the maintenance, the system will show a popup where you have to specify the key values
      • use events AA and 14 to read the selected values and enqueue the selected key values. I am not sure how to overcome the main locks of the table maintenance. Maybe you will have to explicitely dequeue the main lock.

      You can also use a report where the user has to select the desired key values and then call function module VIEW_MAINTENANCE_CALL to display the data (including the modifications by the mentioned events).