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

Adjust data declaration

Former Member
0 Likes
682

Hello,

If I created some data elements that I do not use anylonger is there a way to find out which are no longer used in my program (not manually)? I might have 50 of them and it is not efficient to go through each manually.

Just like JavaWD has ADJUST IMPORTS feature that deletes imports that are not used.

Thank you.

5 REPLIES 5
Read only

Former Member
0 Likes
649

If you are referring to declared variables that are not used in the program, you can obtain a list using the extended program check. From SE38, go to Program->Check->Extended program check. Deselect all options except "Field attributes" and execute.

Read only

0 Likes
649

Hi Michael,

This is exactly what I am referring to. However, it is not a program but a method of a class. Also, I do not want to simply display them but to delete them. Is there a feature that will delete them automatically by my request?

Thank you

Read only

Former Member
0 Likes
649

Hi Georgy,

You can perform the <b>Extended Program check</b> which reveals the details of the Data elements which are declared but not being used anywhere in the program.

In the SE38 editor Menu , Program -- > Check ---> Extended Program check.

There in the <b> Field Attributes</b> --> <b>Warnings</b> section you can find all such fields with the following messge.

<i><b>Field "fieldname' is not referenced statically in the program</b></i>

Read only

0 Likes
649

Hi Vinod,

Yes, thank you. As Michael pointed out I can do that. Unfortunately, this is not what I need. I do not want to look at them but rather delete them by request.

Please have a look at my post above.

Thank you.

Read only

0 Likes
649

Not quite what you are looking for, but you could write your own program for this. The following call will pass the class and method, returning the program name of the source code:


call method convert_type_and_name
     exporting mtdkey = mtdkey
               section_limu = seok_limu_method
     importing incname = program_name
     exceptions not_converted = 1.

mtdkey is defined as type SEOCPDKEY.

You could call this and then use "READ REPORT program_name INTO itab" to import the source code into an internal table. Form "checkDataFields" in include LSLINF09 has the code used for the standard extended program check and you could use some of this logic as a template.