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

Deleting records from database table

Former Member
0 Likes
2,503

Hi

I got a requirement that in one case I have to delete a records from db

So I suppose to do like

Loop at itab.

Delete stko where IDNRK = it_itab1-matnr.

Endloop.

Is it suggestible for my requirement?

Please help me out

Thanks in Advance.

Regards

Rao

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,382

Hi,

You can create BDC or LSMW for CS02 transaction and delete the BOM.

In the second screeen MATERIAL BOM menu you have an option to delete the BOM.

You also require Change number for do this activity or you can request authoriztion to basis team

to delete BOM without change number.

Regards,

Shan

Hi

I got a requirement that in one case I have to delete a records from db

So I suppose to do like

Loop at itab.

Delete stko where IDNRK = it_itab1-matnr.

Endloop.

Is it suggestible for my requirement?

Please help me out

Thanks in Advance.

Regards

Rao

20 REPLIES 20
Read only

Former Member
0 Likes
2,382

Its Not advisable to delete standard table records other than from standard transactions.

Regards

Karthik D

Read only

Former Member
0 Likes
2,382

If you can tell us that why you want to delete the data from BOM Header table that will be more helpful. Because deleteing data in this way is not supported by SAP. A BDC can be a better option.

Read only

Former Member
0 Likes
2,382

Hi

The standard tables are always inter related. So, you should check the consequences you would have to face.

Check where all this table is used, what is the effect it is going to take?

Also, check if the table is client independant or dependant.

Do some research about the table first and then delete.

Regards,

Vishwa.

Read only

0 Likes
2,382

i want to change the item category of BOM. its not possible to change the item category of BOM, so first i am deleting the item category aft tht i ll re-insert the item category again.

Read only

0 Likes
2,382

Your approach is not going to work in the way you are trying, i suppose you will end up crashing the system.

My suggestion is to do a BDC recording or BAPI to delete BOMs and then re-upload again with the correct Item category...

Regards

Karthik D

Read only

0 Likes
2,382

Hi Karthik

Can u tell me BAPI name or in BDC how we do for deleting

Read only

0 Likes
2,382

any ideas?

Read only

0 Likes
2,382

Hi,

see if u can use the BAPI 'CAVC_I_CHANGE_BOM_ITEM_DATA'.

Regards,

Nagaraj

Read only

Former Member
0 Likes
2,383

Hi,

You can create BDC or LSMW for CS02 transaction and delete the BOM.

In the second screeen MATERIAL BOM menu you have an option to delete the BOM.

You also require Change number for do this activity or you can request authoriztion to basis team

to delete BOM without change number.

Regards,

Shan

Read only

0 Likes
2,382

Hi Shan

i want to delete the item category of BOM only not whole BOM, for deleting this we will use IB02 Tcode.

So can u give some idea for writing this program

Thanks in Advance.

Read only

matt
Active Contributor
0 Likes
2,382

Before writing a programmatically deleting records from a SAP standard Database table, consider this thread: This poor chap has at least not caused an business problems.

Now think about what you will do if your program doesn't quite work as expected, and you end up with a corrupted production system that means the business can no longer do their work.

Read only

0 Likes
2,382

i will delete in BOM Item Category only aft tht i ll update with new values in single program only i will do this.

Read only

0 Likes
2,382

Go ahead by all means and write your code.

And dont forget to put your experience afterwards when the executives and Audit come after you and your team for doing that

Read only

matt
Active Contributor
0 Likes
2,382

There could be all sorts of processing that has already taken place that depends on the bom item category. There's a reason it isn't changeable by SAP supplied transactions. When you do more processing using that bom, you could end up with inconsistencies. Are you sure you won't. 100%, bet your life sure?

Are you planning on running this in production?

Read only

0 Likes
2,382

Hi Matt

i am 100% sure that its my requirement only

its not possible to change item cateegory of BOM for tht we have to do delect that one aft tht i ll reinsert again in single program only

Read only

matt
Active Contributor
0 Likes
2,382

See OSS note 901730

Read only

matt
Active Contributor
0 Likes
2,382

>

> Hi Matt

>

> i am 100% sure that its my requirement only

> its not possible to change item cateegory of BOM for tht we have to do delect that one aft tht i ll reinsert again in single program only

Then make 100% sure that you cover yourself as Ajay Tiwari says. When it goes wrong, if you've not pointed out the risks, you could be the scapegoat.

Read only

0 Likes
2,383

>

> Hi Matt

>

> i am 100% sure that its my requirement only

> its not possible to change item cateegory of BOM for tht we have to do delect that one aft tht i ll reinsert again in single program only

If you are 100% sure then instead of Delete & insert do Update.

Regards

Karthik D

Read only

Former Member
0 Likes
2,383

Hi,

In the worst case, if you have to do this...make sure you document everything properly and take the nec essary approvals so as to save yourself in case a issue raised on the approach being followed.

Don't forgot to include the risk of this solution apporach in your formal documents, and approvals.

Read only

Former Member
0 Likes
2,383

HI Rao,

You are trying to delete the record from STKO table with the key field.

please note that this IDNRK field along with its value is updated in many tables, so if you delete this way you end up with data inconsistency.

so please contact your FC to take required action not you as an ABAPER.

regards

Ramchander Rao.K