Dear colleagues,
I searched how to push-down "SELECT-OPTIONS" to HANA and realized that there are at least three ways as the following;
- CL_LIB_SELTAB (in the package SHDB_TOOLS)
- RSDS_RANGE_TO_WHERE
- FREE_SELECTIONS_RANGE_2_WHERE
The reason why I need to push down "SELECT-OPTIONS" is for using AMDP as the way of code push-down.. and the filter will be applied by APPLY_FILTER in AMDP.
I decided to use No 1 or 2; No 3 is not in the scope since I read an article that FREE_SELECTIONS_RAGE_2_WHERE is a bit less comfortable to use.
But those two classes are showing very different and wired results.
Result of CL_LIB_SELTAB
It converts SELECT-OPTIONS to native where condition as A.MATNR BETWEEN 'SD13 AND SD09'
The relevant field is converted well, but the values are wrong..
Result of RSDS_RANGE_TO_WHERE
It converts SELECT-OPTIONS to native where condition as BETWEEN 'SD13' AND 'SD09'
The values are converted well, but there's no filed names... so I have to put field names programmatically via iteration..
My test codes are:
REPORT ZTEST. TABLES: MARA . SELECT-OPTIONS S_MATNR FOR MARA-MATNR. DATA: O_COND TYPE REF TO CL_LIB_SELTAB, H_HANDLE TYPE REF TO CL_ABAP_TABLEDESCR, L_COND TYPE STRING. CALL METHOD CL_LIB_SELTAB=>NEW EXPORTING IT_SEL = S_MATNR[] RECEIVING RR_REF = O_COND . CALL METHOD O_COND->SQL_WHERE_CONDITION EXPORTING IV_FIELD = 'A.MATNR' RECEIVING RV_COND = L_COND.
It would be perfect if CL_LIB_SELTAB converts correctly and perfectly to A.MATNR BETWEEN 'SD13' AND 'SD09', but it was not..
Could someone help me on this..?
Is there any other ABAP class to convert SELECT-OPTIONS to native where clause statement perfectly?
Best Regards,
Hyukjoo