‎2021 Jan 20 12:13 PM
I've got an RFC enabled function module, which uses a dynamic where clause, like
TRY.
DATA(Where) = `somefield EQ zcl_someclass=>c_constant-value`.
SELECT * FROM table INTO internal_Table WHERE (where).
CATCH cx_sy_dynamic_osql_error INTO DATA(sql_error).
e_error-message = sql_error->get_text( ) && ` : ` && sql_error->get_longtext( ).
e_error-type = 'E'.
RETURN.
ENDTRY.
I'm calling it with a destinations that's just to another client in the same instance. It throws an exception - it does not like zcl_someclass=>c_constant-value. It says that the value can't be established.
This is in a 7.31 system. I'll be testing in a 752 system when I get some time.
Has anyone noticed this strange behaviour, or have an explanation? It only happens with an RFC. Locally, it works fine.
‎2021 Jan 20 2:30 PM
There's no mention of it in the 7.31 documentation, but in the 7.52 docs says right here that:
Both doc versions says that:
I don't know what it could be, but is it something with the class and RFC?
‎2021 Jan 20 1:23 PM
‎2021 Jan 20 1:34 PM
No.
Neither in update, nor in local.
When I debug locally, I don't get the exception.
‎2021 Jan 20 1:36 PM
‎2021 Jan 20 1:44 PM
I get the error in RFC (debug or not debug -> I updated the question):
Could not interpret the value 'CLASS=>CONSTANT'
An attempt was made to execute an Open SQL stateme nt, in which the dynamic WHERE or SET condition contains the illegal value 'CLASS=>CONSTANT'. For instance, one of the value fields, addressed by a LIKE operator in the WHERE clause, is not type C.
The constant type is CHAR 1.
When I put the value in directly, like
DATA(Where) = `somefield EQ '1'`.
SELECT * FROM table INTO internal_Table WHERE (where).
It also works fine.
‎2021 Jan 20 2:14 PM
Try assigning zcl_someclass=>c_constant-value to a local helper variable to see if that makes any difference...?
‎2021 Jan 20 2:30 PM
There's no mention of it in the 7.31 documentation, but in the 7.52 docs says right here that:
Both doc versions says that:
I don't know what it could be, but is it something with the class and RFC?
‎2021 Jan 20 2:39 PM
There you go. The caller of the FM has already run class constructor. - it works locally.
However, in the RFC context in the FM, the class constructor has not run - and we get the error.
‎2021 Jan 20 2:56 PM
‎2021 Jan 20 2:37 PM
Tried that - works.
Also tried
DATA(Where) = `somefield EQ '` && zcl_someclass=>c_constant-value && `'`.
and that works too.