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: 

delete all the objects in a package

Former Member
0 Kudos

Hi Guys,

My requirement is that i need to write a program to delete all the objects in a package. In the selection screen i enter the package name and then i get all the objects in the package from TADIR table and display them in an ALV.

There when i select a object and press the delete button ,the object (program ,table, domain,data element etc..) should be deleted .

For this i tried to DEBUG in SE80 and tried to know how SAP is trying to delete the object. But i couldnot unterstand which Function Module or which Class and Method it uses to delete an object.

Guys please let me know how it can be done.

Regards,

Chaithanya.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

As you are getting the objects from TADIR program, you need to delete the objects from this table.

So, when you select a record and press delete...get the property of the line so as that you will have the object name in your cursor which can be used to delete the object from TADIR table..

7 REPLIES 7

Former Member
0 Kudos

HI,

Refer to the link.

Regards

Sumit Agarwal

Former Member
0 Kudos

Hi,

Sumit the above link is not the solution.

i should not delete the package from the table but i should delete the objects when i click on the delete button.

Guys its urgent plaese help me.

Regards,

Chaithanya.

Former Member
0 Kudos

As you are getting the objects from TADIR program, you need to delete the objects from this table.

So, when you select a record and press delete...get the property of the line so as that you will have the object name in your cursor which can be used to delete the object from TADIR table..

0 Kudos

Hi,

I donot want to delete the object record in the table but i want to physically delete the program.

In SE38 how you give the program name and press on the delete button then that program will be deleted from all the tables where ever it has an entry.

In se80 a can delete only one object at a time but with this program i want to delete multiple objects at a time.

Regards,

Chaithanya.

0 Kudos

> In se80 a can delete only one object at a time but with this program i want to delete multiple objects at a time.

No, you can mark multiple objects (holding down the CTRL- or SHIFT-keys) and delete them in one go.

Thomas

ThomasZloch
Active Contributor
0 Kudos

Just wondering what is the added advantage of this custom development compared to deleting via SE80 or SE90?

Former Member
0 Kudos

hi

check this ...

REPORT zxxxxxx.

TYPE-POOLS: slis.

DATA: x_fieldcat TYPE lvc_s_fcat,

it_fieldcat TYPE lvc_t_fcat,

g_grid TYPE REF TO cl_gui_alv_grid,

x_layout TYPE lvc_s_layo,

g_custom_container type ref to cl_gui_custom_container,

g_container type scrfname value 'I_CONTAINER'.

types: BEGIN OF ty_itab ,

check(1) TYPE c,

PGMID LIKE TADIR-PGMID,

END OF ty_itab,

data:itab type standard table of ty_itab,

itab1 type TADIR.

call screen 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


module STATUS_0100 output.

SET PF-STATUS 'ZSTATUS100'.

if g_custom_container is initial.

create object g_custom_container

exporting container_name = g_container.

create object g_grid

exporting i_parent = g_custom_container.

SELECT PGMID

FROM TADIR

INTO CORRESPONDING FIELDS OF TABLE itab where DEVCLASS = selection screen package

x_fieldcat-fieldname = 'CHECK'.

x_fieldcat-seltext = 'CHECK'.

x_fieldcat-checkbox = 'X'.

x_fieldcat-edit = 'X'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = 1.

APPEND x_fieldcat TO it_fieldcat.

CLEAR x_fieldcat.

x_fieldcat-fieldname = 'PGMIDt'.

x_fieldcat-seltext = 'PGMIDt'.

*x_fieldcat-edit = 'X'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = 2.

APPEND x_fieldcat TO it_fieldcat.

CLEAR x_fieldcat.

CALL METHOD g_grid->set_table_for_first_display

EXPORTING

IS_LAYOUT = x_layout

CHANGING

it_outtab = itab

IT_FIELDCATALOG = it_fieldcat.

endif.

endmodule. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


module USER_COMMAND_0100 input.

DATA: ls_outtab LIKE LINE OF itab.

DATA: l_valid TYPE c,

ok_code like sy-ucomm,

r_ucomm LIKE sy-ucomm,

ls_celltab TYPE lvc_s_styl,

lt_celltab TYPE lvc_t_styl,

l_index TYPE i.

CALL METHOD g_grid->check_changed_data

IMPORTING

e_valid = l_valid.

IF l_valid EQ 'X'.

case sy-ucomm.

when 'DELETE'.

LOOP AT itab INTO ls_outtab where check = 'X'.

move ls_outtab-object to itab1.

delete TADIR from itab1.

ENDLOOP.

endcase.