Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[SuccessFactors] OData V2 – filter in (VSC Rest-API Client)

When filtering an OData V2 endpoint, you can simply list your values separated by a comma after the keyword in (option 2). Much shorter than having to repeat your filter statement all the time, like in option 1.

01
02
03
04
05
06
07
08
09
10
11
12
@user1=10010
@user2=10020
 
### Option 1: Filter userId using OR condition
GET {{$dotenv api_url}}/odata/v2/User?$filter=userId eq '{{user1}}' or userId eq '{{user2}}'
Authorization: Basic {{$dotenv api_auth}}
Accept: application/json
 
### Option 2: Filter userId using IN condition
GET {{$dotenv api_url}}/odata/v2/User?$filter=userId in '{{user1}}', '{{user2}}'
Authorization: Basic {{$dotenv api_auth}}
Accept: application/json

[ABAP] OData – Filtering, Sorting, Paging

1
2
3
4
5
6
7
" Filter, Sort, Paging
/iwbep/cl_mgw_data_util=>filtering( EXPORTING it_select_options = it_filter_select_options
                                    CHANGING  ct_data           = et_entityset ).
/iwbep/cl_mgw_data_util=>orderby(   EXPORTING it_order          = it_order
                                    CHANGING  ct_data           = et_entityset ).
/iwbep/cl_mgw_data_util=>paging(    EXPORTING is_paging         = is_paging
                                    CHANGING  ct_data           = et_entityset ).

[SAPUI5] Filter on Model read

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
this.getModel().read("/Object", {
                filters: [
                    new Filter({
                        path: "firstName",
                        operator: FilterOperator.EQ,
                        value1: "Max"
                    }),
                    new Filter({
                        path: "lastName",
                        operator: FilterOperator.EQ,
                        value1: "Mustermann"
                    })
                ],
                success: oData => { },
                error: err => { }
});

[SAPUI5] Binding with filter on XML View

https://sapui5.hana.ondemand.com/sdk/#/topic/5338bd1f9afb45fb8b2af957c3530e8f.html

There are two ways to use a filter.

Option 1:

1
2
3
4
5
6
7
items="{
                path: '/myItems',
                parameters : {
                  $filter : 'itemName eq \'myItemName\'',
                  $orderby : 'createdAt desc'
                },
}">

Option 2:

01
02
03
04
05
06
07
08
09
10
11
items="{
                path: '/myItems',
                parameters : {
                  $orderby : 'createdAt desc'
                },
                filters : {                                    
                  path : 'itemName ',
                  operator : 'EQ',
                  value1 : 'myItemName'
                },
}">