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

Mass delete abap reports

Former Member
0 Likes
5,749

Hi

I want to delete around 50 z-developments, all starting with ZCF. Please suggest how to acheive this

Regards

Harshada

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,208

Hi,

one better way is, write a simple BDC program. get the req entries which needs to be deleted, from Table 'TADIR' with OBJECT as 'PROG' and OBJ_NAME as 'ZCA*'.

now LOOP the internal table with the above entries. for each loop call se38 initial screen pass the OBJ_NAME in program field, now select menu Program--> delete.

another way is, debug and find it in SE38 how the program is getting deleted when we click on DELETE.

kindly let me know if u need any further help!!

Hope it helps!!

regards,

Pavan

Hi

I want to delete around 50 z-developments, all starting with ZCF. Please suggest how to acheive this

Regards

Harshada

17 REPLIES 17
Read only

Former Member
0 Likes
4,208

Hi,

In SE80 you can select the objects that you want to delete and delete them manually. This is teh safest way as it will also inform you about the dependent objects which you should delete along with the z-objects..

Regards,

Deepti

Read only

0 Likes
4,208

Thanks for the reply. But I would like to know about faster method of deletion.

Read only

0 Likes
4,208

Use TADIR table and delete programs according to your requirement.

Read only

Former Member
0 Likes
4,209

Hi,

one better way is, write a simple BDC program. get the req entries which needs to be deleted, from Table 'TADIR' with OBJECT as 'PROG' and OBJ_NAME as 'ZCA*'.

now LOOP the internal table with the above entries. for each loop call se38 initial screen pass the OBJ_NAME in program field, now select menu Program--> delete.

another way is, debug and find it in SE38 how the program is getting deleted when we click on DELETE.

kindly let me know if u need any further help!!

Hope it helps!!

regards,

Pavan

Read only

0 Likes
4,208

Thanks Pavan.

Could you please elaborate the BDC option?

Read only

0 Likes
4,208

HI,

Execute the following code.

DELETE FROM TADIR

WHERE PGMID = R3TR AND

OBJECT = PROG AND

OBJ_NAME = 'ZCF%'.

Regards

Arindam

Read only

0 Likes
4,208

Hi,

first get the required data from TADIR to an internal table and loop for that table, do the recording for SE38 using SHDB like below.

TABLES : tadir.

DATA : gs_ctu_params TYPE ctu_params,

itab TYPE tadir OCCURS 0 WITH HEADER LINE,

gt_bdcdata TYPE STANDARD TABLE OF bdcdata WITH HEADER LINE.

----


  • I N I L I T I A L I Z A T I O N *

----


INITIALIZATION.

  • Parameter string for runtime of CALL TRANSACTION USING...

CLEAR gs_ctu_params.

gs_ctu_params-updmode = 'S'.

gs_ctu_params-defsize = 'X'.

gs_ctu_params-dismode = 'A'.

----


  • S T A R T O F S E L E C T I O N *

----


SELECT obj_name FROM tadir

INTO CORRESPONDING FIELDS OF TABLE itab

WHERE object = 'PROG'

AND obj_name = 'ZTEST_2'.

LOOP AT itab.

PERFORM bdc_dynpro USING 'SAPLWBABAP' '0100'.

PERFORM bdc_field USING 'RS38M-PROGRAMM' itab-obj_name.

PERFORM bdc_field USING 'BDC_OKCODE' '=DELP'. "OK-CODE for selecting delete in SE38 initial screen.

PERFORM bdc_dynpro USING 'SAPLSEU2' '0201'.

PERFORM bdc_field USING 'BDC_OKCODE' '=BACK'.

CALL TRANSACTION 'SE38' USING gt_bdcdata

OPTIONS FROM gs_ctu_params.

ENDLOOP.

&----


*& Form bdc_dynpro

&----


  • Populate Screen Name

----


FORM bdc_dynpro USING program TYPE any

dynpro TYPE any.

CLEAR gt_bdcdata.

gt_bdcdata-program = program.

gt_bdcdata-dynpro = dynpro.

gt_bdcdata-dynbegin = 'X'.

APPEND gt_bdcdata.

ENDFORM. " bdc_dynpro

&----


*& Form bdc_field

&----


  • Populate Screen Field

----


FORM bdc_field USING fnam TYPE any

fval TYPE any.

IF fval <> space.

CLEAR gt_bdcdata.

gt_bdcdata-fnam = fnam.

gt_bdcdata-fval = fval.

APPEND gt_bdcdata.

ENDIF.

ENDFORM. " bdc_field

i have just wrote this, and ran for one program and its working fine.....

let me know if u need any further help!!

Hope it helps!!..

Regards,

Pavan

Edited by: vishnu Pavan on Jan 2, 2009 9:34 AM

Edited by: vishnu Pavan on Jan 2, 2009 9:51 AM

Read only

0 Likes
4,208

This code only deletes the TDIR entry, but object is still visible.

Read only

0 Likes
4,208

Could you plz send ur code. i will test it myself...

Read only

0 Likes
4,208

Hi,

i have just tested the below and its working fine for program.

so, you just change the SELECT statement for ur req programs...

TABLES : tadir.

DATA : gs_ctu_params TYPE ctu_params,

itab TYPE tadir OCCURS 0 WITH HEADER LINE,

gt_bdcdata TYPE STANDARD TABLE OF bdcdata WITH HEADER LINE.

----


  • I N I L I T I A L I Z A T I O N *

----


INITIALIZATION.

  • Parameter string for runtime of CALL TRANSACTION USING...

CLEAR gs_ctu_params.

gs_ctu_params-updmode = 'S'.

gs_ctu_params-defsize = 'X'.

gs_ctu_params-dismode = 'A'.

----


  • S T A R T O F S E L E C T I O N *

----


SELECT obj_name FROM tadir

INTO CORRESPONDING FIELDS OF TABLE itab

WHERE object = 'PROG'

AND obj_name = 'ZTEST_2'.

LOOP AT itab.

PERFORM bdc_dynpro USING 'SAPLWBABAP' '0100'.

PERFORM bdc_field USING 'RS38M-PROGRAMM' itab-obj_name.

PERFORM bdc_field USING 'BDC_OKCODE' '=DELP'. "OK-CODE for selecting delete in SE38 initial screen.

PERFORM bdc_dynpro USING 'SAPLSEU2' '0201'.

PERFORM bdc_field USING 'BDC_OKCODE' '=BACK'.

CALL TRANSACTION 'SE38' USING gt_bdcdata

OPTIONS FROM gs_ctu_params.

ENDLOOP.

&----


*& Form bdc_dynpro

&----


  • Populate Screen Name

----


FORM bdc_dynpro USING program TYPE any

dynpro TYPE any.

CLEAR gt_bdcdata.

gt_bdcdata-program = program.

gt_bdcdata-dynpro = dynpro.

gt_bdcdata-dynbegin = 'X'.

APPEND gt_bdcdata.

ENDFORM. " bdc_dynpro

&----


*& Form bdc_field

&----


  • Populate Screen Field

----


FORM bdc_field USING fnam TYPE any

fval TYPE any.

IF fval <> space.

CLEAR gt_bdcdata.

gt_bdcdata-fnam = fnam.

gt_bdcdata-fval = fval.

APPEND gt_bdcdata.

ENDIF.

ENDFORM. " bdc_field

hope it helps..

try with the above code and let me know for any help...

Regards,

pavan

Edited by: vishnu Pavan on Jan 2, 2009 9:55 AM

Read only

Former Member
0 Likes
4,208

Hi.

Since you have to delete just 50 objects, a manual delete would be better.

That will be safe too and won't take much time.

Developing a BDC for this purpose will not be justified. Prefer to delete the programs through se80 or even se38.

Read only

Former Member
0 Likes
4,208

Hi,

try this code. I have tested this it is working fine.

report Z_PROG_DELETE

no standard page heading line-size 255.

include bdcrecx1.

data: g_name type RS38M-PROGRAMM.

select-options: s_name for g_name.

data: itab like tadir occurs 0 with header line.

start-of-selection.

select PGMID OBJECT OBJ_NAME from tadir into table itab

where PGMID EQ 'R3TR'

and OBJECT eq 'PROG'

and OBJ_NAME in s_name.

loop at itab.

perform bdc_dynpro using 'SAPLWBABAP' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RS38M-PROGRAMM'.

perform bdc_field using 'BDC_OKCODE'

'=DELP'.

perform bdc_field using 'RS38M-PROGRAMM'

'ZPROGDELETE'.

perform bdc_field using 'RS38M-FUNC_EDIT'

'X'.

perform bdc_dynpro using 'SAPLSEU2' '0201'.

perform bdc_field using 'BDC_OKCODE'

'=BACK'.

perform bdc_field using 'BDC_CURSOR'

'WITH_INCLUDES_GLOBAL'.

perform bdc_field using 'WITH_INCLUDES_GLOBAL'

'X'.

perform bdc_dynpro using 'SAPLWBABAP' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RS38M-PROGRAMM'.

perform bdc_field using 'BDC_OKCODE'

'=BACK'.

perform bdc_field using 'RS38M-PROGRAMM'

itab-OBJ_NAME.

perform bdc_field using 'RS38M-FUNC_EDIT'

'X'.

perform bdc_transaction using 'SE38'.

endloop.

regards,

Venkatesh

Read only

Former Member
0 Likes
4,208

HI,

A small change in my previous program

report Z_PROG_DELETE

no standard page heading line-size 255.

include bdcrecx1.

data: g_name type RS38M-PROGRAMM.

data: g_cla(10) type c.

select-options: s_name for g_name.

data: itab like tadir occurs 0 with header line.

start-of-selection.

concatenate '$T' '%' into g_cla.

select PGMID OBJECT OBJ_NAME from tadir into table itab

where PGMID EQ 'R3TR'

and OBJECT eq 'PROG'

and OBJ_NAME in s_name

and DEVCLASS like g_cla.

loop at itab.

perform bdc_dynpro using 'SAPLWBABAP' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RS38M-PROGRAMM'.

perform bdc_field using 'BDC_OKCODE'

'=DELP'.

perform bdc_field using 'RS38M-PROGRAMM'

'ZPROGDELETE'.

perform bdc_field using 'RS38M-FUNC_EDIT'

'X'.

perform bdc_dynpro using 'SAPLSEU2' '0201'.

perform bdc_field using 'BDC_OKCODE'

'=BACK'.

perform bdc_field using 'BDC_CURSOR'

'WITH_INCLUDES_GLOBAL'.

perform bdc_field using 'WITH_INCLUDES_GLOBAL'

'X'.

perform bdc_dynpro using 'SAPLWBABAP' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RS38M-PROGRAMM'.

perform bdc_field using 'BDC_OKCODE'

'=BACK'.

perform bdc_field using 'RS38M-PROGRAMM'

itab-OBJ_NAME.

perform bdc_field using 'RS38M-FUNC_EDIT'

'X'.

perform bdc_transaction using 'SE38'.

endloop.

regards,

Venkatesh

Read only

Former Member
0 Likes
4,208

Hi,

Do you want to delete the programs which are also transported?

Any how use this FM RS_DELETE_PROGRAM to delete , and pass all your programs in a loop.

This FM will delete one main program or one include program with all dependant subobjects such as text elements, documentation in all languages, screens, menus, and variants.

All indexes in the ABAP Workbench will be deleted and in case of a development class ne $xxx or Txxx a correction number is needed.

Hope this helps you

Raj

Read only

ThomasZloch
Active Contributor
4,208

Why not use the repository infosystem SE90, list all programs starting with ZCF, mark them all, choose "Delete" from the context menu, then press the "Delete all" button??

Thomas

Read only

0 Likes
4,208

Thanx Thomas...

This seems to be the best option.

Read only

0 Likes
4,208
Thanx Thomas...
This seems to be the best option.

Than R(e)ward accordingly instead randomly.

But why all ZCF* program have been created, since they are no longer in use!!

And rather than deleting them if we change their Devclass from Z* package to $TMP they cannot be transport to PRD or QA anymore.

If they were already transported than only deleting their correspond Z transaction would be enough.

And By not executing them (ZCF*) anymore would treat same as idle, will not cause any harm to your SAP.

PS: Please After couple of months don't come back with the thread

"What is the best way to retrieve all deleted ZCF* in one shot?"

All the way i mean What would be the harm if we keep them,and will treat as idle!?

Thank you,

Amit.