SE54 – Table maintenance – Event AA – read data
Note: Something is still missing from the program – I don’t know what – but in this state “delete” function doesn’t work. 🙁
I have spent way too much time with SE54 – I won’t fix it, creating a table maintenance program takes about 8 hours only and my program works, what is a big advantage.
Any idea is appreciated. 🙂
I have read through a lot and I mean a tonn of documentation here on scn and on other web site too and couldn’t find a working example for the event AA – read data. I have found a lot of discussions and tutorials up to the point where the code is needed. Than nothing or not working codes.
To add an event, go to SE54, environment events. There are other way of navigation.
Create a new entry, select AA for data read, add a FORM routine and push “Editor”.
Here select an existing or create a new include.
You can encounter a problem – SAP doesn’t create the include or doesn’t add it to your main program.
You can check that by clicking “Editor” again. If you are asked for a new include than things didn’t work out.
In this case logout/login and try again. Eventually it will work.
The include is leer, the following working program will first read the table from the database using the standard data read routine, convert it to an internal table.
Here you can work with your internal table. My program sorts it.
Than the program writes the internal table back to the SAP table.
The whole program is quite simple but it took a lot of work, research and debug to get it working.
BEGIN OF lty_total.
INCLUDE STRUCTURE YOUR_TABLE.
INCLUDE STRUCTURE vimflagtab.
END OF lty_total.
ls_total TYPE lty_total,
lt_total TYPE TABLE OF lty_total.
* Execute standard read and move data from table total to our internal table.
PERFORM table_get_data. “Execute standard database read
LOOP AT total.
IF <vim_total_struc> IS ASSIGNED.
ls_total = <vim_total_struc>.
APPEND ls_total TO lt_total.
* Now we can sort the table
SORT lt_total BY matkl ekorg bsart werks frgco sequence frgsx.
* Clear table total and copy our changed data to it.
LOOP AT lt_total INTO ls_total.
<vim_total_struc> = ls_total.