Technical Articles
DDIC-objects that miss an enhancement-category – part 2.1 – CDS view more Info (dd02l-sqltab)
You know what: I have to push in an intermediate chapter (2.1), as I did enhance my CDS view.
So the series as of now is:
https://blogs.sap.com/2020/08/31/task-find-ddic-objects-that-miss-an-enhancement-category-part-1/
https://blogs.sap.com/2020/08/31/ddic-objects-that-miss-an-enhancement-category-part-2-use-cds-views/
[this – part 2.1]
https://blogs.sap.com/2020/09/01/ddic-objects-that-miss-an-enhancement-category-part-3-fix-it-to-what/
Problem:
I started setting the missing enhancement categories for APPENDS, and it – deciding what to set it to – was not as easy as it might seem.
As you know, I gave myself the this general rule:
1. By default, set it to “Can be enhanced (character-like or numeric)”
2. If this is not possible or doesn’t make sense, choose what makes sense.
This turned out to be cumbersome. Lot’s of guessing and manual work (if I guessed wrong).
This is un-necessary, at least for the APPEND-Category:
Every append has a table or structure it appends – and this table has (well, should have! 😉 ) an enhancement category. That is the sensibel default to set it to.
That table is easily found, it’s right there in dd02l-sqltab, so I added that filed to my CDS view.
To get the enhancement category of the parent table, I joined in DD02L.
left outer join dd02l as appendedTable
on d.sqltab = appendedTable.tabname
So this is how my view looks now:
define view zz_i_tablesDevclas as select from dd02l as d
left outer join tadir
on tadir.pgmid = 'R3TR'
and tadir.object = 'TABL'
and d.tabname = tadir.obj_name
left outer join tdevc on
tadir.devclass = tdevc.devclass
left outer join dd02l as appendedTable
on d.sqltab = appendedTable.tabname
{
d.tabname as tableName,
d.tabclass as tableClass,
d.exclass ,
d.sqltab,
appendedTable.exclass as parentEnhCat,
appendedTable.wrongcl as parentHasWrongCat,
d.as4user as lastChagedBy,
d.as4date as lastChangedAtDate,
d.as4time as lastChangedAtTime,
tadir.devclass as devPackage,
tdevc.component
}
And this is how the ALV in my report looks now (showing a part with SAP tables):
ALV, German caption; the newly added coloums are marked red
Please note:
I didn’t touch a single line of code on my report, and neither in zz_i_tablesNoEnhCat.
All I changed was zz_i_tablesDevclas, shown above!
-> I think this is another benefit of using CDS-Views.
By the way, as always, comments are welcome.
Also ideas hot to improve the view! It works for me like it is, but I was thinking about some questions like:
- is join the right thing, or should I use assiciations? (Why, how?)
- Maybe I should add the description for the tables (how do text-tables work in CDS?)
- …
Best
Joachim