abapOpenChecks icon indicating copy to clipboard operation
abapOpenChecks copied to clipboard

Check 79 - CLEAR as first use of variable

Open jrodriguez-rc opened this issue 5 years ago • 6 comments
trafficstars

Cleaning of variables is not checking correctly: image

jrodriguez-rc avatar May 14 '20 10:05 jrodriguez-rc

to me it looks okay, not false positives

perhaps the line reported is wrong?

larshp avatar May 14 '20 10:05 larshp

There are exactly those lines: image

I declare attributes and first access to them is the CLEAR sentence

jrodriguez-rc avatar May 14 '20 11:05 jrodriguez-rc

yea, remove the CLEAR, it doesnt do anything, variables are initialized with initial value

larshp avatar May 14 '20 11:05 larshp

I was trying with and without clear, without error still persists but only with lb_badi image I found the root of the cause, it is this block: image

jrodriguez-rc avatar May 14 '20 11:05 jrodriguez-rc

can you help adding a full example with the code copy/pasta-ble?

larshp avatar May 14 '20 13:05 larshp

This is the code:

    DATA: lb_badi TYPE REF TO /rslt/ui5_tile_info.

    TRY.
        GET BADI lb_badi
          FILTERS
            tile = lv_tile.
      CATCH cx_badi_not_implemented.
        CLEAR lb_badi.
    ENDTRY.

I just replaced the CLEAR for an exception

jrodriguez-rc avatar May 18 '20 07:05 jrodriguez-rc