SAP Custom Code Inventory ABAP Query Generator (TADIR)
Every S/4HANA custom code estimate starts with an honest inventory. This generator produces ABAP that counts and lists your Z and Y objects from TADIR, the central directory of repository objects.
Fill in
Use Z% or Y%, or your namespace such as /ACME/%
Count by object type
REPORT ZCUSTOM_CODE_INVENTORY.
START-OF-SELECTION.
SELECT object, COUNT(*) AS cnt
FROM tadir
WHERE pgmid = 'R3TR'
AND obj_name LIKE 'Z%'
AND delflag = @abap_false
GROUP BY object
ORDER BY cnt DESCENDING
INTO TABLE @DATA(lt_types).
LOOP AT lt_types INTO DATA(ls_type).
WRITE: / ls_type-object, ls_type-cnt.
ENDLOOP.Count by package
* Add after the first block.
SELECT devclass, COUNT(*) AS cnt
FROM tadir
WHERE pgmid = 'R3TR'
AND obj_name LIKE 'Z%'
AND devclass LIKE 'Z%'
AND delflag = @abap_false
GROUP BY devclass
ORDER BY cnt DESCENDING
INTO TABLE @DATA(lt_pack).
LOOP AT lt_pack INTO DATA(ls_pack).
WRITE: / ls_pack-devclass, ls_pack-cnt.
ENDLOOP.Detailed list of programs, classes and function groups
* Core executable code objects, the usual remediation scope.
SELECT object, obj_name, devclass, author, created_on
FROM tadir
WHERE pgmid = 'R3TR'
AND object IN ('PROG', 'CLAS', 'FUGR')
AND obj_name LIKE 'Z%'
AND delflag = @abap_false
ORDER BY object, obj_name
INTO TABLE @DATA(lt_obj)
UP TO 10000 ROWS.
LOOP AT lt_obj INTO DATA(ls_obj).
WRITE: / ls_obj-object, ls_obj-obj_name, ls_obj-devclass, ls_obj-author.
ENDLOOP.TADIR lists repository objects, not whether they are used. Combine this inventory with SCMON and SUSG usage data and ATC results before estimating remediation. Needs ABAP 7.40 or later. Run in a non-production system with read access to TADIR.
Build an effort model from your inventory
Send object counts and ATC finding categories and we will suggest a way to estimate remediation days.
Optional. The tool and every export work without this. No spam.
How to use the generated code
Enter your naming pattern and package pattern, copy the code into SE38 and run it. The first block gives counts per object type such as PROG, CLAS, FUGR, TABL and DTEL. The second gives counts per package so you can see where the code lives and who owns it. The third lists programs, classes and function groups, which are the objects that usually need code remediation. Export the output to Excel for triage.
- Include namespace patterns, not only Z and Y
- Add owners per package after the first run
- Mark packages as retire, keep or rewrite
Turning the inventory into scope
A raw count overstates the work because many objects are unused. Join the list with SCMON and SUSG usage data to drop code that never ran in the observed period, then run ATC with the S/4HANA readiness check variant on what remains. Remaining findings can be grouped by type, such as table access to changed structures, obsolete statements, and unsupported function modules. That grouped list is the basis for an effort estimate.
Common mistakes
Do not count only programs. Dictionary objects, enhancements, BAdI implementations and Smart Forms or Adobe forms all create work. Do not trust author names as ownership, since many objects were created by people who left years ago. Do not assume that a package with few objects is low risk, because one interface program can carry the whole business process.
Frequently Asked Questions
What is TADIR?
TADIR is the SAP table that stores the directory of repository objects, with fields such as program ID, object type, object name, package and author. It is the standard starting point for custom object inventories.
Does this show unused code?
No. TADIR lists objects that exist. To find unused code you need usage data from SCMON and SUSG collected in production over a representative period.
Why filter on delflag?
Objects marked for deletion remain in TADIR for a time. Filtering them avoids counting code that is already retired and prevents inflated estimates.
Can I run this in production?
It is read-only and light, but follow your own policy. Many teams run it on a recent production copy, which also gives representative object counts without touching live systems.
If you want help joining inventory, usage and ATC data into an effort model, Netray can work through it with your team.
Related Tools
SAP S/4HANA Conversion and Migration Tools Reference
A lookup of the SAP tools used at each phase of an S/4HANA conversion or migration, what each does and when to use it.
SAPSAP CVI Business Partner Gap Report ABAP Generator
Generates an ABAP report that finds customers and vendors without a Business Partner link, the first check before a CVI conversion.
SAPSAP ECC Obsolete Transactions and S/4HANA Replacements
A lookup table of common ECC transaction codes and the transaction or app that replaces them in S/4HANA, for training and role design.
SAPSAP Clean Core Extensibility Assessment
A short scored assessment of how well your SAP system follows clean core principles, and what to do about the gaps.