Skip to Content
avatar image
Former Member

Filter for child enitty type

Hi,

I am facing problem with filter criteria for child entity. Let me give you an example.

There are 2 entity types:

1. Order

2. OrderItem

I have created the association between these 2 entities. Order entity is parent entity and OrderItem is child entity.

I have implemented the GET_ENTITYSET for OrderItem entity.

I am trying to call the GET method with filter parameter.

For Example:

OrderCollection('100000008212')/OrderItemCollection?filter=Rate gt 100

Following is the default code in GET_ENTITYSET to convert the select option to internal table.

WHEN 'RATE'.
               lo_filter->convert_select_option(
                 EXPORTING
                   is_select_option = ls_filter
                 IMPORTING
                   et_select_option = lr_rate ).

               READ TABLE lr_rate INTO ls_rate INDEX 1.
               IF sy-subrc = 0.
                 lv_rate = ls_rate-low.
               ENDIF.


I am getting the "Rate" filter value in lo_filter variable but lo_filter->convert_select_option() is not returning the internal table. I have debugged the lo_filter->convert_select_option() method and found that it is checking properly 'Rate' with Order entity properties.


'Rate' property is only available in OrderItem Entity not in Order Entity so that why lo_filter->convert_select_option() not returning internal table.


I am just wondering why they are only comparing the filter property of child entity with parent entity properties. Any Idea??




Regards,

Vikram

pastedImage_0.png (15.5 kB)
pastedImage_0.png (22.6 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Dec 30, 2014 at 08:42 AM

    Please refer to Note

    1996855  -

    The filter method convert_select_option returns an empty list if a filter is used for an entityset with navigation path

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 02, 2015 at 08:06 AM

    Hi Vikram,

    Yes -Try to implement Atun mentioned above SAP Note.

    Thanks,

    Syam

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 30, 2014 at 08:57 AM

    As an alternative approach you can also use the following URI pattern

    /OrderItemCollection?filter=Rate gt 100 & OrderId = '100000008212'

    Add comment
    10|10000 characters needed characters exceeded