2016 Sep 21 1:38 PM
Hello everyone!
i want to create a dynamic where condition, (BI related) to create a select for every extractor. But this is just additional information
Though i need to create a dynamic where condition to have generic selects.
Actually i use FM CRS_CREATE_WHERE_CONDITION. But this FM got a restriction. When i want to have a where condition like:
WHERE TEXT CP 'A**'
this FM masks the * with #* and this leads to the result that i only get texts containing the string 'A*' and not every text starting with A.
Though i tried FM RH_DYNAMIC_WHERE_BUILD because it was recommended very often here in the forum-discussions.
But this FM can only work with Fields shorter than 20 signs. And it also can not work with SIGNS, so only SIGN = I is possible.
the most disadvantage is that it creates a where condition that can not be used for SQL-Select statements. Because in a SQL Statement you can not write TEXT EQ 'A*' -> you need to write TEXT = 'A*'.
i also had a look on FREE_SELECTIONS_INIT. but this seems to be something different. But looking to the function Group of this FM i found the FM FREE_SELECTIONS_RANGE_2_WHERE. But this FM also does not produce legit SQL Where-Statements.
can you help me out? do you know any methods / FMs beside these to create dynamic where condition?
the where condition i need is for this statement:
OPEN CURSOR WITH HOLD ca_curser FOR SELECT * FROM (pi_table_name)
WHERE (ca_t_where_condition).
regards
Stefan Seebruger
2016 Sep 21 8:09 PM
Why do you need an existing function module? Isn't it more simple to build it from scratch by concatenating strings?
2016 Sep 22 8:15 AM
2016 Sep 22 5:14 PM
In that case, I doubt CRS_CREATE_WHERE_CONDITION and RH_DYNAMIC_WHERE_BUILD are supported by SAP (only very few function modules are released) and they may be deleted in a future release without warning (although it's not so frequent). FREE_SELECTIONS_RANGE_2_WHERE being the only released function module, so go for it! What issue do you have with it exactly?
2016 Sep 23 12:32 PM
In this statement: WHERE (ca_t_where_condition),
its not legit to have OPERATORS LIKE "EQ" "CP"... It will result in a Dump/exception.
I need "=" and "LIKE"-Operator and stuff. but the method FREE_SELECTIONS_RANGE_2_WHERE does not create a legit string for my where-condition.
I did not solve this issue, but i found out, that i dont need *-Search in my dynamic where clause of FM CRS_CREATE_WHERE_CONDITION because SAP-BI-API does not allow it in INIT-LOAD either.so i dont have to search for different methods/FMs
I left this thread open because it would be good to know for future tasks.
Regards
Stefan Seeburger