Skip to Content

dynamic cond in loop - error

Hi,

i have a declaration as follows:

TYPES: BEGIN OF ty_filter,
         cond(72)  TYPE c,
       END OF ty_filter.

DATA: ta_filter TYPE STANDARD TABLE OF ty_filter.

...
...
    LOOP AT ta_tran_upd
      ASSIGNING <fx_tran>
      WHERE ( ta_filter ).

the above one is issue an error message "Unable to inetpret ')' but when i replace the dynamic where with some condition it is working fine...any idea on it. couldnt get the source of the error.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 07, 2010 at 01:20 PM

    I don't think you can use a dynamic WHERE in a LOOP.

    Rob

    Add comment
    10|10000 characters needed characters exceeded

    • Dynamic WHERE in LOOP is possible as of NW 7.02.

      I think you can use field symbols to create kind of dynamic loop. Refer this for example:

      DATA: l_filter TYPE string VALUE 'CARRID',
            l_value  TYPE string VALUE 'LH'.
      
      DATA: it_sflight TYPE TABLE OF sflight WITH HEADER LINE.
      
      SELECT * FROM sflight INTO TABLE it_sflight  UP TO 10 ROWS  .
      
      FIELD-SYMBOLS <fs> TYPE ANY.
      
      LOOP AT it_sflight.
        ASSIGN COMPONENT l_filter OF STRUCTURE it_sflight TO <fs>.
        CHECK sy-subrc = 0.
        IF <fs> = l_value.
          WRITE / 'Found one'.
        ELSE.
          CONTINUE.
        ENDIF.
      ENDLOOP.
      

      Regards

      Marcin

  • avatar image
    Former Member
    Apr 07, 2010 at 02:21 PM

    Hi

    I think that you can't do dynamic where but if you use it you should declare it as (condition)

    and not ( condition ).

    SELECT ***

    FROM***

    INTO*********

    WHERE (ta_filter).

    Best Regards

    Yossi

    Add comment
    10|10000 characters needed characters exceeded