04-07-2010 2:11 PM
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.
04-07-2010 2:20 PM
04-07-2010 2:20 PM
04-07-2010 2:28 PM
04-07-2010 2:55 PM
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
04-07-2010 3: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