Application Development and Automation 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: 
Read only

Bug in Syntax-check (Object Component Selector in VALUE Operator)?

amadeusgrabmayer
Participant
0 Likes
838

Hi,

I'm note sure if I found here a bug or if I have a made a mistake:

I have a table with object references and want to check if a specific version is "dirty" (changed).

(I know that the table is a standard table, but in my case there won't be enough entries in this table to cause a performance problem)

With 7.50 the "Object Component Selector After Table Expressions" was added, but it seams, that if it is used within a VALUE Operator the Syntax check doesn't allow it.

According to the documentation: "A component addressed in this way can, depending on its design, be used in all suitable operand positions", this should work (at least from my point of view).

I hope somebody can help me with this, maybe ?

CLASS lcl_model DEFINITION FINAL CREATE PRIVATE.

  PUBLIC SECTION.

    CLASS-DATA gt_versions TYPE STANDARD TABLE OF REF TO lcl_model WITH DEFAULT KEY.

    DATA mv_version TYPE i READ-ONLY.

    DATA mv_is_dirty TYPE abap_bool READ-ONLY.

    CLASS-METHODS is_dirty

      IMPORTING iv_version         TYPE i

      RETURNING VALUE(rv_is_dirty) TYPE abap_bool.

  PRIVATE SECTION.

ENDCLASS.

CLASS lcl_model IMPLEMENTATION.

  METHOD is_dirty.

    "1. this works

    TRY.

        rv_is_dirty = gt_versions[ table_line->mv_version = iv_version ]->mv_is_dirty.

      CATCH cx_sy_itab_line_not_found ##NO_HANDLER.

    ENDTRY.

    "2. this doesn't

   rv_is_dirty = VALUE #( gt_versions[ table_line->mv_version = iv_version ]->mv_is_dirty OPTIONAL ).

  ENDMETHOD.

ENDCLASS.

Br Amadeus

1 ACCEPTED SOLUTION
Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
798

Hello,

This restriction was a kind of lapse in development and wasn't documented in 7.50.

The restriction is now documented in SP01 for the upcoming 7.51 (unfortunately, correction close was before the lapse was reported).

The restriction is removed in the Release following 7.51 (that will be 7.52).

Horst

(if you really want to have it patched, you have to open a ticket ...)

2 REPLIES 2
Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
798

To make a long thing shorter:

DATA itab TYPE TABLE OF REF TO i.

DATA(test1) = itab[ 1 ]->*.

DATA(test2) = VALUE #( itab[ 1 ]->* OPTIONAL ). "Syntax error


From my point of view it should work, -> forwarded to development.


Horst

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
799

Hello,

This restriction was a kind of lapse in development and wasn't documented in 7.50.

The restriction is now documented in SP01 for the upcoming 7.51 (unfortunately, correction close was before the lapse was reported).

The restriction is removed in the Release following 7.51 (that will be 7.52).

Horst

(if you really want to have it patched, you have to open a ticket ...)