cancel
Showing results for 
Search instead for 
Did you mean: 

Filter for child enitty type

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member184867
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Thanks..

Answers (2)

Answers (2)

SyambabuAllu
Contributor
0 Kudos

Hi Vikram,

Yes -Try to implement Atun mentioned above SAP Note.

Thanks,

Syam

former_member184867
Active Contributor
0 Kudos

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

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