Skip to Content

Can we use select-options in the query ? How ?

Hi Techies,

we are using a BAPI that is having select-options as input we want to get the data based on the select-options in the query

how do we write the query to get the data..

please help me on this

Thanks & regards


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Sep 10, 2014 at 11:35 AM

    Hello Sathish,

    In my opinion,

    We cannot send range values as such in a way like we send to our FM generally to GW as part of filters in QUERY operation as an internal table with multiple fields with different operators.

    Ideally we need to operate on BATCH. But most of the times this BATCH will not serve the purpose as there would be scenarios where we would like to send all the values as part of range table in a single call and get result based on it.

    My suggestion would be,

    Send the parameters as part of filters and use that internally in your DPC_EXT class to prepare a range table manually with appropriate operators and send it to ur FM.

    below are the operators supported by GW through URL.

    EQ Equals

    LE Less than or equal to

    GE Greater than or equal to

    NE Not equal to

    GT Greater than

    LT Less than

    Other operators like CP etc... has to be handled explicitly in GW level in DPC_EXT class in respective methods by checking whether the input value contains ' * ' .

    If the input contains ' * ' then u need to pass CP operator explicitly in the code level.

    few operator combinations are not supported by GW which we need to be aware of.

    The below are the things supported by GW where u can send some inputs as part of filters so that GW itself will convert into a range values so that u can straight away access those and use it in our logic.

    Example 1: Supported

    /sap/opu/odata/sap/xxxxxxxxx/get_dataSet?$filter=QueryParam1 ge 'abcd' and QueryParam1 le 'uvwx'

    when u pass this GW itself will fill your IT_FILTER_SELECT_OPTIONS as follows with appropriate operator.

    Example 2: Not Supported

    /sap/opu/odata/sap/xxxxxxxxx/get_dataSet?$filter=QueryParam1 ge 'abcd' and QueryParam1 le 'uvwx' and QueryParam2 ge 'abcd' and QueryParam2 le 'uvwx'

    Its not accepted by GW. U cannot send 2 different parameters as above.

    Example 3 : Supported

    /sap/opu/odata/sap/xxxxxxxxx/get_dataSet?$filter=QueryParam1 ge 'abcd' and QueryParam1 le 'uvwx' and QueryParam3 le '123'

    U can use filters with different operators but note not all combination will work.



    Add comment
    10|10000 characters needed characters exceeded