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

'DD_DATABASE_UTILITY'

aidan_mulcahy
Active Participant
0 Likes
1,995

Hi,

I want to use DD_DATABASE_UTILITY to delete the contents of a table but it seems to cause difficulties:

call function 'DD_DATABASE_UTILITY' 
  EXPORTING 
    fct                     = 'MDF' 
    obj_name                = 'ZDELLIST' 
    obj_type                = 'TABL' 
    exec_modus              = 'S' 
  IMPORTING 
    subrc                   = sl_subrc 
  EXCEPTIONS 
    unexpected_error        = 1 
    unsupported_function    = 2 
    unsupported_obj_type    = 3 
    table_is_locked_by_tcnv = 4 
    authority_check_failed  = 5 
    abort_function          = 6 
    conversion_error        = 7 
    others                  = 8
...... 

*Insert new values: 

modify zdellist. 

The <i>modify</i> causes a short dump:

<i>The data type "ZDELLIST" was reloaded from the database while the program was running. However, the system found a version of the type that was newer than the one required.</i>

Any thoughts? Am I allowed add entries to the table after deleting the entries?

Thanks.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,305

For example.....



  delete from ZDELLIST client specified where mandt = sy-mandt.


Regards,

Rich Heilman

7 REPLIES 7
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,305

Hi, why do you want to use this function module to delete the contents, simply get rid of them with the DELETE statement, then you will not have any problems.

Regards,

Rich Heilman

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,306

For example.....



  delete from ZDELLIST client specified where mandt = sy-mandt.


Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,305

A shot in the dark, but did you commit your deletion?

you could also use SQL:

delete from ZDELLIST where ...

Warren

Read only

Former Member
0 Likes
1,305

Hi,

can you try this one ....

call function 'DD_DATABASE_UTILITY'

exporting

fct = 'MDF'

obj_name = 'TABLE_NAME'

obj_type = 'TABL'

exec_modus = 'S'

importing

subrc = sl_subrc

exceptions

unexpected_error = 1

unsupported_function = 2

unsupported_obj_type = 3

table_is_locked_by_tcnv = 4

authority_check_failed = 5

abort_function = 6

conversion_error = 7

others = 8.

if sl_subrc = 0 and sy-subrc = 0.

write:/ '&1', '- Table Deleted OK'.

commit work and wait.

else.

sl_status = 1. "Deletion Failed

write:/ '&1', '- Table Deletion FAILED'.

endif.

Regards

Sudheer

Read only

Former Member
0 Likes
1,305

what i mean by the commit is :

call function 'DD_DATABASE_UTILITY'

EXPORTING

fct = 'MDF'

obj_name = 'ZDELLIST'

obj_type = 'TABL'

exec_modus = 'S'

IMPORTING

subrc = sl_subrc

EXCEPTIONS

unexpected_error = 1

unsupported_function = 2

unsupported_obj_type = 3

table_is_locked_by_tcnv = 4

authority_check_failed = 5

abort_function = 6

conversion_error = 7

others = 8

......

COMMIT WORK.

*Insert new values:

modify zdellist.

COMMIT WORK.

Read only

0 Likes
1,305

Thanks All,

I know about

DELETE FROM Zdellist CLIENT SPECIFIED WHERE mandt EQ sy-mandt.

but was under the impression that it was slow. I tried it out and the performance was fine so I will use that method. I only have about 13000 entries at the moment and that's only going to decrease so should be fine going forward.

FYI:

I did <i>commit work</i> as well but still dumped.

Does anyone know when it is a good idea to use the 'DD_DATABASE_UTILITY' FM?

Thanks.

Read only

ferry_lianto
Active Contributor
0 Likes
1,305

Hi Aidan,

Please use standard program RADCVBTC instead of delete statement for deleting

all contents of a custom table due to volume and performance issue.

It worked for me when I tried to delete over 25 million records in a custom table.

It took less than 5 seconds. So please give it try.

You can pass the following parameters.

OBJ_NAME = 'ZDELLIST'

OBJ_TYPE = 'TABL'

FCT = 'MDF'

Hope this will work for you.

Regards,

Ferry Lianto