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: 

Deleting entries from ztable in Produciton

kiran_k8
Active Contributor
0 Kudos

Hi Folks,

I have a requirement of deleting the entries from a ZTABLE which is in Production.Can anyone here let me know what is the best way.

Thanks,

K.Kiran.

11 REPLIES 11

Former Member
0 Kudos

Hi Kiran,

the best way is to write a report which has the logic of deleting the entries from the specified table........

If the table is maintained you can directly delete the entries using the transaction SM30............

But make sure by deleting the entries you are not affecting any other data or any master data which will be a huge loss to business.......

Reward points if this helps...........

Regards,

Ravi G

Former Member
0 Kudos

Hi Kiran ,

Could you please illustrate your requirement a bit more.

Regards

Arun

0 Kudos

Arun,

We have a ztable which is having more 90 lakh records.So,they decided to take a back up of data in a range of dates and then delete.As it is more having considerably large amount of data it is slowing down the process.

By the way no Table Maintenance for this Ztable.

K.Kiran.

0 Kudos

Hi Kiran,

Did you tried the way I suggested thro' SE16N?

0 Kudos

Jayanthi,

Just gone through your reply.Does this process of deleting then entries using SE16N should be done in Dev and then move the TR consequently to Production?What are the consequences.

K.Kiran.

0 Kudos

Hi,

If you are using SE16n,it will delete entries only in that table.No other related tables will taken care while deleting.You need to do it in the corresponding system.I don't think you can trasnport from development to prodcution.But if you are using table maintenance, you can do in development and then transport it to other system.

0 Kudos

Jayanthi,

tables ztable.

select-options s_date for vbrk-fkdat.

delete ztable where fkdat IN s_date.

Will this suffice if it is done programatically?

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

As suggested, if table maintenance is generated you can use SM30.

Otherwise, go to tcode SE16N and enter the required table name and then required conditions.

Then put &sap_edit in command bar.You will get the message Editing function activated.Then enter.Click execute button.You can the data related to the condition you specified.Select the appropriate data and then select minus button in ALV display.Then press save button in the top.But be careful while doing.

Former Member
0 Kudos

Hi Kiran,

You can use the following set of code if you have a date field in your ztable and you want delete the entries based on date specification .


Tables : ztable,anek.
select-options : so_date for anek-budat.
delete ztable where budat IN so_date.
 

You transport the above given set of code to production system from you development and execute the program.

<i>Caution : specify the correct ztable name in 'Delete' statement.</i>

Message was edited by:

P Sreenivasulu

Message was edited by:

P Sreenivasulu

0 Kudos

Hi Kiran ,

Even though Ztable dependencies on other table wud be less , but still deleting data in production has to be done with extreme caution .

Its advisable if u r writing a script for deletion to be thorughly checked in ur testing enviornment first .

Some points which u should remeber is .

If u r selecting data first and deleting those records from an internal table Its always advisable to meke few checks

1. Alwyas before writing the DELETE statement check if the table is not initial .

IF gt_tab[] is not initial .

DELETE Tab from gt_itab

ENDIF .

2. Also in prior selections if you are using for all entries , then also the table

initial check is to be done

If gt_tab[] is not initial .

select * from tab1

into gt_tab1

for all entries in gt_tab

where elementx = gt_tab-elementx.

ENDIF.

As in ur case u want to delete the records on the basis of date

so inspite of deleting all the records in 1 go , its better to delete records in chunks

Have some date field on the selection-screen using select option or parameters.

Then delete the records .

I wud suggest to work it out in the debugging mode and just before deleting the data check what u are going to delete , once you are satisfied , go on for the further delete action .

I hope I haven't raised much concern in u , but its advisable .

I have learnt it the harder way .

It it helps you anyhow I will be glad .

Regards

SureshP

0 Kudos

Hi Folks,

With respect to the above query,Can I go for Archiving the Ztable?

Kindly let me know about the following:-

1.On what basis we will come to conclusion that we need to go for archiving.

2.How the concept of Archiving differs from SAP Standard Table to Ztable?

3.Can we copy the program which is used for Archiving the SAP standard table and modify so that we can use it for Archiving Ztable?

Thanks,

K.Kiran.