Skip to content

sometime lead to a dump for sorted tables #498

@xpatate2

Description

@xpatate2

My original code :

READ TABLE lt_fields TRANSPORTING NO FIELDS WITH KEY column_name = lv_column_name ).
INSERT ls_field INTO lt_fields INDEX sy-tabix.

ABAP CLEANER replace it with :

INSERT ls_field INTO et_fields INDEX line_index( et_fields[ column_name = lv_column_name ] ).

This occurs when the internal table et_field_tech is a sorted table.

In the original code :
If lv_column_name does not exist in et_fields, ABAP returns in sy-tabix the correct place to insert it in the table and the isert works correctly.

In the abap cleaner conversion :
if lv_column_name does not exist in et_fields, the index = 0 and this is dumping with a message like this :

when inserting rows into table, 0 was used as the row index. An index less than or equal to zero is not allowed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions