Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to enter a record in SAP table using SE16

Former Member
0 Kudos
13,796

Hi,

I want to know what is there a simple way to maintain an entry in a SAP standard table.

Basically it is one of the CRM table. Where there was only one entry was available.

By mistake I went and deleted the 1 record from the table using debugg and CODE = DELE.

Now I realized that I need to maintain back that entry in that table. However I realized that

using debug mode it is not possible. Debugg method is possible only when atleast one

record exist in the table.

Could some one suggest a simple way to maintain the entry. However I want to mention

that I don't have developer access.Which will take another 1 week to get.So pl. don't suggest

to write a program for inserting the record.

I know there is another complex method available using SAP - Query and Infoset(we can write the ABAP

program). Using that we can mange this situation without developer access. However I am not good in that.

So if some know how to do , it will be good.

I really appreciate if any one who can suggest simple and nice solution.

Thanks & Br

mathi

1 ACCEPTED SOLUTION

Former Member
3,705

Hi,

Vishnu your recommendation seems to be ok. for me. However I am working in CRM 7.0 , I could not find this select statement in SE16 debugg mode. Can you pl..tell me which include name or program name this getting called.

I just want to mentioned one point for others recomending SE16N solution. SAP removed this t.code with latest version of ECC , CRM7.0. So we can't use that option.

Thanks & Br

mathi

6 REPLIES 6

edgar_nagasaki
Contributor
0 Kudos
3,705

Hi Mathivanan,

Not really recommended at all but once damage is done, try to use SE16N and, before run selection, type &sap_edit at command field and hit enter (then run), it will open you this possibility (depending on your system settings maybe you won't be allowed to).

Edgar


Former Member
0 Kudos
3,705

Well, deleting entries in SE16 on standard tables using debug mode is dangerous as it can compromise consistency of relational tables. So it is better to exercise caution.

To insert a new entry in a table, you need to do is select and display an existing entry and set the variable CODE = 'INSR' in debug mode similar to what you did while using CODE = 'DELE'.

However, if there are no entries in the table already, you need to use some tricks

This is what you need to do

1. Goto SE16 -> Enter table name -> Press enter. Once the selection screen displays goto -> System -> Status -> Double Click on Program name, so it opens in ABAP editor. This is the program automatically generated by SE16 specifically for displaying records in your table

2. Once inside the ABAP editor, search for SELECT as a word and find the SELECT statement that fetches rows from your table, it will be a statement like below

SELECT * FROM <your table name>  "client specified

  APPENDING TABLE I<your table name>

  UP TO RSEUMOD-TBMAXSEL ROWS BYPASSING BUFFER

    WHERE <field name> IN I1.

3. Put a session break point on the above SELECT statement, come back to SE16, open your table by pressing enter and press F8, so that the debugger stop at the above statement. Execute the SELECT statement and manually enter a record into the internal table named "I<your table name>". Change sy-subrc value to ZERO and press F8. By doing this you are fooling the system as if there is a record in the table that the SELECT statement fetched.

4. The above will display the record that you manually entered in the next screen. You can display this record by clicking the check box besides it and clicking the display button (F7)

5. Once the record displays in the subsequent screen, you can type /h in the command field, press enter twice, go into debug mode and change the variable CODE to value 'INSR', to insert a new record

6. Press F8 and you will get back to the screen where you can enter the new record. It looks like the manually entered record values are displayed, however you can change it and SAVE and a new record will be created.

0 Kudos
3,705

Just want to add that atleast in my case, session breakpoints did not work. I had to set external breakpoints.

Former Member
3,706

Hi,

Vishnu your recommendation seems to be ok. for me. However I am working in CRM 7.0 , I could not find this select statement in SE16 debugg mode. Can you pl..tell me which include name or program name this getting called.

I just want to mentioned one point for others recomending SE16N solution. SAP removed this t.code with latest version of ECC , CRM7.0. So we can't use that option.

Thanks & Br

mathi

0 Kudos
3,705

Right now, I don't have access to a CRM 7.0 box but since SE16 belongs to basis component, its behavior should be uniform whether it is CRM 7.0 or ECC 6.0

I created a test table ZTV_TEST in my ECC 6.0 sandbox with two fields MANDT and VKORG and when I enter this table in SE16, it automatically generated a program with name /1BCDWB/DBZTV_TEST. Inside this program, there is this SELECT statement

SELECT * FROM ZTV_TEST
   APPENDING TABLE IZTV_TEST

   UP TO RSEUMOD-TBMAXSEL ROWS BYPASSING BUFFER
     WHERE VKORG IN I1.

So in your case, there should be a program by name similar to /1BCDWB/DB<your table name>. You can open this program in SE38 put a break point on this SELECT statement and execute SE16 to trigger the debugger and follow my instructions as above.

Former Member
0 Kudos
3,705

Hi Vishnu

You are the man. Thanks a lot I really appreciated your help.

It worked.

Thanks & Br

mathi