abaplint
abaplint copied to clipboard
unused_ddic - foreign key in another table
Hi, shouldn't this rule check also if other tables are referencing to the currently checked table?


yes, can you help creating a public example? just a few dummy objects should be enough to reproduce this error?
Yes, ofc. Two Z tables should be enough, right?
yea, try :)
Funny thing: on version 2.74.61 it's ok 😄 Here are samples you asked about:
@EndUserText.label : 'AbapLint test table 1'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table zlint_test1 {
key client : abap.clnt not null;
key bukrs : bukrs not null;
}
@EndUserText.label : 'AbapLint test table 2'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table zlint_test2 {
key client : abap.clnt not null;
@AbapCatalog.foreignKey.screenCheck : false
key bukrs : bukrs not null
with foreign key zlint_test1
where client = zlint_test2.client
and bukrs = zlint_test2.bukrs;
}
CLASS zlint_test DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
TYPES ty_bukrs_config TYPE STANDARD TABLE OF zlint_test1 WITH KEY bukrs.
METHODS get_bukrs_config
RETURNING VALUE(bukrs_config) TYPE ty_bukrs_config.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zlint_test IMPLEMENTATION.
METHOD get_bukrs_config.
SELECT bukrs INTO TABLE bukrs_config
FROM zlint_test1
ORDER BY PRIMARY KEY.
ASSERT sy-subrc <> 0.
ENDMETHOD.
ENDCLASS.
how about latest, 2.85.9? does it give the false positive?
Docker downloads 2.84.9 as latest and there is a false positive there.
argh, the docker build keeps stopping every 60 days, anyhow, triggered again, latest should be up in a bit
Yup, on 2.85.9 still false positive
anyhow, need the files that abapGit creates, and as of now, TABL are serialized to XML by abapGit
Here you can see the effect of the check. There are XMLs that you asked about. https://github.com/Zeatynis/abaplint-issue/commit/0dc66e613b05c332773dcf5470fc221b54814db0
@Zeatynis try again, 2.91.0
Same. You can check in my test repo: https://github.com/Zeatynis/abaplint-issue/actions/runs/2363288530
the finding is correct, https://github.com/Zeatynis/abaplint-issue/search?q=zlint_test2
zlint_test2 is not used anywhere in the other objects?
I just rechecked. It's resolved. I must have check it wrong.