Application Development 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: 

Code Inspector Error

Former Member
0 Kudos

I am validating the delivery status field in vbuk table as it exists in my selection screen.

I am not having vbeln field in my selection screen .

CODE INSPECTOR ERROR:

Large table VBUK: No field of a table index in WHERE CONDITION.

I am getting above error how to resolve this.

Is there any other solution to resolve this error rather than creating secondary index on this field.


METHOD  validate_delivery_status.
IF s_lfstk-low IS NOT INITIAL.
SELECT lfstk
INTO g_lfstk
FROM vbuk UP TO 1 ROWS
WHERE lfstk EQ s_lfstk-low.
ENDSELECT.
IF sy-subrc NE 0.
IF g_lfstk IS INITIAL.
MESSAGE e043(z12). “ There is no data match your selection.
ENDIF.
ENDIF.
IF s_lfstk-high IS NOT INITIAL.
CLEAR g_lfstk.
SELECT lfstk
INTO g_lfstk
FROM vbuk UP TO 1 ROWS
WHERE lfstk EQ s_lfstk-high.
ENDSELECT.
IF sy-subrc NE 0.
IF g_lfstk IS INITIAL.
MESSAGE e043(z12). “ There is no data match your selection.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.    


Thanks in Advance

Regards,

Avinash.                  

15 REPLIES 15

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

I am confused...

Can you explain why you use select-options or a range this way ?

Regards.

TuncayKaraca
Active Contributor
0 Kudos

@Avinash

You are using "UP TO 1 ROWS" anyway, yes it will be kind of slow without key fields WHERE but because of "UP TO 1 ROWS" I think you can ignore this SCI error.

Second point: I see your method VALIDATE_DELIVERY_STATUS is validating Document Status selection value for VBUK but you can consider to use STATV domain values for validating instead of VBUK table.

0 Kudos

Hi Tuncay Karaca,

Even If I consider the STATV domain values in select statement.

I am Facing this error.

Regards,

Avinash.

matt
Active Contributor
0 Kudos

UP TO 1 ROWS and SELECT SINGLE perform exactly the same operation on the database. You should use SELECT SINGLE because it is simpler and clearer programming.

0 Kudos

Avinash,

Just use function module DD_DOMA_GET and you will get all possible values for Delivery Status then compare with what entered on selection-screen. No need to use SELECT statement and you

won't get SCI error.

Former Member
0 Kudos

Hello,

you are getting this Error in code inspector becasue these in no key field in where condition and VBUK is a very big table..you can only remove it by adding vbeln in where condition or by creating secondary index .

0 Kudos

Hi Navneet Kumar,

Will there be an other solution other than these two options(adding vbeln and secondary index).

Because I don't know the vbeln value to specify because it is not there in selection screen field.

Regards,

Avinash.

0 Kudos

Hi Avinash,

you can't create a useful secondary index for this issue.

Every useless secondary index will slow down your system.

Regards,

Klaus

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

When you get to this method do you know the delivery number ?

Regards.

0 Kudos

Hi Eitan Rosenberg,

I am having field delivery status field in selection screen .

When the user gives value on that field in selection screen.

AT selection-screen on s_lfstk.

I am trying to validate the values which he enters is valid or not.

I am not having the vbeln field in selection screen.  I am getting this error.

CODE INSPECTOR ERROR:

Large table VBUK: No field of a table index in WHERE CONDITION.

Regards,

Avinash.

0 Kudos

There's no need to keep repeating information already given.

As it stands your validation won't work. What if the user enters a selection of ranges? Or an exclusion? Or just an "*" to get everything?

Use the correct function module to get the valid values for the domain LFSTK (see here: GET DOMAIN FIXED VALUE - Code Gallery - SCN Wiki) into an internal table. Then


DATA match TYPE abap_bool. match = abap_false. LOOP domain_values INTO domain_value. CHECK domain_value IN s_lfstk. match = abap_true. ENDLOOP.

IF match EQ abap_false.

..." Sorry, pal, not valid.

ENDIF.

Validating select options is not straightforward. If you need to validate against a db table, then you can only use

SELECT SINGLE blah FROM dbtable INTO otherblah WHERE field IN s_field.

IF sy-subrc IS NOT INITIAL:

    " Sorry, pal, not valid

ENDIF.

Which, as you've seen, is not very efficient.

raymond_giuseppi
Active Contributor
0 Kudos

As you did not provide any criteria used in an index or in primary key, the database will perform a full scan of the database table (the UP TO 1 ROWS will stop once found some record, but if unlucky you could (and will, Peter's principle) get awful response time in production (and time out dumps, in development system, you have usually much less data available) -> Check with a SQL trace ST05.

Could you find another solution to check this field (Are you actually checking existence of at least one SO with this status ? ) thru domain value, or SAP provided index tables (similar to VRKPA for partner or VLKPA for deliveries)

At least only execute such SELECT only when user actually press the Execute icon (e.g. IF sscrfields-ucomm EQ 'ONLI'.)

NB: Also (let Customer) consider tools like BW for this kind of report.

Regards,

Raymond

former_member195402
Active Contributor
0 Kudos

Hi,

you can comment the SELECT after end line with '.' using pseudo comment

"#EC CI_NOFIELD

Regards,

Klaus

0 Kudos

Hi Klaus Babl ,

"#EC CI_NOFIELD

It is not recommended as per my coding  standards and it is strictly prohibited.

Regards,

Avinash.

0 Kudos

Hi Avinash,

in our systems a new program has to be free of any code inspector errors, warnings and informations.

Therefore all issues must be worked and either corrected or acknowleged with a pseudo comment, if the code inspector fails.

The code inspector is a tool, which shows possible issues, but it can't decide, if there is a real issue.

If you read a complete database table into an internal table in your program. you may get a code inspector error or warning. But if you want to read all 12 entries, because you need them, then you have to comment this SELECT with a pseudo comment to tell the code inspector, that this issue doesn't exist and it shouldn't check it further.

If you can't use pseudo comments due to your coding standards, then your first option should be to remove the causing code lines. In your issue, remove the VBUK access.

Regards,

Klaus