Application Development and Automation 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: 
Read only

delet data from standard table

Former Member
0 Likes
2,520

hi , my rquirement is , i want to delect some record from database table MCHB

10 REPLIES 10
Read only

Former Member
0 Likes
1,636

use delete statement with proper conditions

DELETE FROM <ZTABLE> -> All hits'll be deleted.

You can also indicate some conditions if you don't need to delete whole table.

DELETE FROM <ZTABLE> WHERE .....

Read only

Former Member
0 Likes
1,636

delte MCHB where <condition>

COMMIT WORK.

Read only

Former Member
0 Likes
1,636

Hi

DELETE table WHERE conditions

Regards

Gregory

Read only

Former Member
0 Likes
1,636

Ypou should use a BAPI or batch input for this, not direct table deletes. What transaction normally deletes records from this table?

Rob

Read only

Former Member
0 Likes
1,636

Hello,

After deleting do use the statement COMMIT Work and WAIT.Otherwise the deleted entries will not be reflected in the table..

Thank's

Rakesh

Read only

Former Member
0 Likes
1,636

Hi,

Firstly, you should not delete any record from standard SAP tables using direct database statements. There are proper methods for every activity to be performed on data in standard SAP system.

This is table for Batch Stocks. This is not a direct transaction table in SAP. Data is added or modified in this table through various transactions mainly of MM, PP & SD. Hence BAPI or BDC cannot fulfill the requirement.

If your requirement is to withdraw batch stocks, then cancel the material documents that have posted the stock. If your material period is already closed and you are not able to cancel the material documents, then withdraw your stocks by posting it to scrap with permission from management. If it is uploaded stock, withdraw it using 562 movement.

Never ever try to delete records from standard tables directly. It will lead to inconsistencies and lot of confusions in the system.

Regards,

Hema

Read only

0 Likes
1,636

To chime in on the advises of using a BAPI instead of directly deleting standard table entries:

When someone else currently works with a table entry and you try delete that data, you will be in trouble and generate inconsistencies that prolly can't be repaired. That's the advantage of a BAPI, because it will take care of the locking mechanism which avoids 2 users accessing and manipulating the same data. (every standard table has corresponding standard BAPI's to maintain the data)

Say "No!" to direct table manipulations!

kr,

Walter

Read only

0 Likes
1,636

If ever a direct table update is necessary, (and yes, there are cases, when no BAPI is available) at least foresee the table locking. In SE11, lookup the lock object for the corresponding table. Each lock object has 2 FM's: one for locking and one for unlocking --> call them in your code. This will avoid the locking issues.

Read only

Former Member
0 Likes
1,636

Lalith,

MCHB is a standard SAP table for Batch Stocks. It is always a bad idea to delete directly from SAP tables. Use an appropriate SAP transaction to delete data from this table.

Read only

Former Member
0 Likes
1,636

Lalith,

Its not advisable to delete the date directly from the data base table.... rather you can over write some data for the important field.

Like if you take LFA1 table if you make LIFNR field data to 'do not use' then in the table all those records are kind of deleted...

so I can suggest you this way..... you can do it with the mass maintanance