Editing SAP Tables with SE16 and SE16N

DevWorkbench 17 de abril de 2013

When working as developers with SAP ERP®, we sometimes need to change a value in a table – maybe just for testing purposes, maybe permanently. But in most cases, it’s not possible or not worth the effort to create a maintenance dialog or write a small program that does the job. There are other possibilities to change data in tables that I’d like to show you in this article.

Using SE16 to change table data

It’s possible to trick transaction SE16 to think you’re in editing mode. To do this, however, you have to have authorizations for debugging and for changing data during debugging (authorization object S_DEVELOP, fields ACTVT = 1 and OBJTYPE = DEBUG).

Enter /h in the command field to enable debugging.

If you have this, enter transaction SE16 and select the data you want to change. Once you’re in the list display, make sure you are using the SE16 standard list. If you’re in ALV grid or list display, this will not work. You can change this by opening your user settings via Settings -> User Parameters or pressing F8 directly in the list display.

Once you have the correct list, insert /h in the command field to enter debugging mode manually. The system will tell you with a prompt whether you did it right.

After this is done, double-click the entry you want to change. The debugger will open. Now look for this piece of code:

if code = 'SHOW'.

Hint: It’s in the include LSETBF01 in the form set_status_val. If you have authorization for SE80 or something similar, you can also set a breakpoint there beforehand. Now change the value of the variable code to whatever you want to do: INSR to insert new entries, EDIT to edit the data, DELE to delete the row. Afterwards, press F8 to give control back to the program.

You will now be able to make changes to the data. Don’t forget to save afterwards!

Using SE16N to change table data

It’s even easier if you have access to transaction SE16N. After having entered the table you’d like to edit, enter the command &SAP_EDIT in the command line. The system will, again, prompt you if you did it right. You will now be able to make changes to the data. Be careful, though: if you’re on release 5.0 or higher, changes you do here are logged and can be viewed with program RKSE16N_CD.

If you’re really sure what you’re doing, you can even switch of the foreign key check in SE16N by entering the command &SAP_NO_CHECK in the command line. Be careful! You can really screw up your data if you do this incorrectly.