I am building a dynamic where statement (inside a share method) that could have 0 to N sub statements. So I have coded ABAP to fill a table of tables of ranges. Then I want the where statement to refer to one of the rows in the top level table.
The problem is that the dynamic where is giving an error " An error has occurred while parsing a dynamic entry." Any ideas how to write a dynamic where statement where the variables reference the index of a table?
Here is the where statement:
( ( ( ( ( ( LOGDATE in @LR_WHERE[ 1 ] ) and ( LOGDATE in @LR_WHERE[ 2 ] ) ) and ( PLANT in @LR_WHERE[ 3 ] ) )
LR_Where is a Table Type /IWBEP/T_COD_SELECT_OPTIONS which is a table type
/IWBEP/S_COD_SELECT_OPTION which is a range (Sign, Option, Low, High).
Any help would be greatly appreciated.
So I've tried a simplified version, here are the ones I've tried. Reminder LR_where is a Table of range tables.
PLANT in @LR_WHERE[3]
PLANT in @LR_WHERE[ 3 ]
PLANT in @(LR_WHERE[3])
PLANT in @( LR_WHERE[3] )
PLANT in @( LR_WHERE[ 3 ] )
I am still getting "An error has occurred while parsing a dynamic entry."
Please do a very small report with your code (so, the relevant parts only, of course), and post it so that we can copy/paste it, and correct it for you.
It looks like you are not able to reference an index of a table in a where statement. So I ended up having to do this:
( ( ( ( ( ( LOGDATE in @LR_01 ) and ( LOGDATE in @LR_02 ) ) and ( PLANT in @LR_03 ) )
Not ideal but you do what you have to.
I found the reference in the ABAP documentation why LOGDATE IN @( LR_WHERE[ 3 ] ) is not permitted (@( ... ) is called a host expression):
Tipp: First write it statically to see the syntax errors, then transfer to the dynamic token.
1) you should be able to use a single clause for all those entries, e.g. LOGDATE IN @LR_WHERE if LR_WHERE is a range table.
2) check if open and close parenthesis match
JNN
what is your ABAP version?
Excuse me, but did you say that /IWBEP/T_COD_SELECT_OPTIONS is a table type, and its line type is /IWBEP/S_COD_SELECT_OPTION, which is a structure with the 4 components SIGN, OPTION, LOW, HIGH ?
If yes, then you must declare your variable as a table of /IWBEP/T_COD_SELECT_OPTIONS:
DATA LR_WHERE TYPE STANDARD TABLE OF /IWBEP/T_COD_SELECT_OPTIONS WITH EMPTY KEY.
so that you can use
LOGDATE IN @( LR_WHERE[ 1 ] )
_{}^{}_{}^{}