Package Violation - Error - The used object is not visible (NVIS).
When I execute ATC checks (ABAP Test Cockpit), results show errors titled "Package Violation - Error - The used object is not visible (NVIS)" with priority 1. Since there were a quite big number of ATC results with "not visible objects", I decided to take possible solutions as notes on this webpage.
Development object TABL PRCD_ELEMENTS is not contained in any (visible) package interface.
For example, on S/4HANA SAP systems KONV table where pricing conditions are stored is replaced with PRCD_ELEMENTS table.
In my ABAP developments, I replaced KONV with PRCD_ELEMENTS.
ATC checks listed those code blocks as errors under "Package Check for Source Code Objects and ABAP Dictionary Objects"
Here is an example case.
Package Violation - Error - The used object is not visible (NVIS).
Object used, TABL PRCD_ELEMENTS, is not visible.
The development object TABL PRCD_ELEMENTS (package VF_PRC_DB) used in PROG /KODYAZ/ZDISPLAY_INVOICE is not contained in any (visible) package interface.
Unfortunately this error cannot be supressed by simply adding a pragma or pseudo-comment right after related ABAP code.
When I switched to ABAP source code where the error is triggered by pressing the link Object Name in ATC results list, I see that I used prcd_elements table in an OpenSQL query replacing KONV table.
ABAP programmers can replace prcd_elements table with v_konv_cds view to get rid of above ATC check error.
So to summarize, I had a short story of changing data source between following ABAP data sources: konv => prcd_elements => v_konv_cds
But this update actually caused some other ATC check errors. For example, instead of using v_konv_cds ATC checks suggested me to Use the associated entity "V_KONV".
When I replaced v_konv_cds => v_konv then I have to convert old style OpenSQL to new syntax where comma is used between selected field list, using "@" in front of variables, moving INTO TABLE clause to the end of the SELECT statement, etc for successfully acctivating the ABAP program.
It is interesting that using V_KONV instead of PRCD_ELEMENTS caused another Package Violation - Error - The used object is not visible (NVIS).
So, I used the solution that my colleague has developed. Actually by creating a CDS view which selects all fields from the prcd_elements table works quite fine and resolves ATC check errors for package violation.
Here is the DDL source codes of a sample CDS view to replace table prcd_elements in your OpenSQL queries in ABAP programs.
Replace prcd_elements table name with DDL name of the CDS view.
Another package violation error listed for prcd_elements was caused from the ABAP source codes where I used in data definitions section of a program.
Simply replacing above ABAP code line into following form by replacing prcd_elements with v_konv_cds solved my ATC check error for package violation.