cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

sap business one service layer -Filtering field from Contact Employees of Business partners

kyuvi0786
Explorer
1,806

Dear Experts,

Firstly I would like to inform that we have multiple contact persons for the Business partner (Customer) and we are using third party system for Customer Queries and now we would like to store the Internalcode of ContactEmployees back to the third party system and to do so.

We are trying to filter the Contact Employees of Business partner using the custom user defined field (U_cID) created in Contact employees however getting the below error.

Kindly guide me on the filtering aspect

ankit.chauhan1

wenli.chen

andy.bai

Payload:

https://myserver:50000/b1s/v1/BusinessPartners('C-01849124')/ContactEmployees?$filter=U_C4CContactID eq '104278'

{ "error": { "code": -1000, "message": { "lang": "en-us", "value": "Property 'U_C4CContactID' of 'BusinessPartner'is invalid" } }}

Accepted Solutions (0)

Answers (1)

Answers (1)

Paul_
Explorer

Hi @kyuvi0786 ,

Please use the crossjoin function:

/b1s/v1/$crossjoin(BusinessPartners,BusinessPartners/ContactEmployees)?$expand=BusinessPartners($select=CardCode,CardName),BusinessPartners/ContactEmployees($select=CardCode,Name)&$filter=BusinessPartners/CardCode eq BusinessPartners/ContactEmployees/CardCode and BusinessPartners/CardCode eq '1037' and BusinessPartners/ContactEmployees/Name eq 'Paul'

Here, you need to replace '1037' with your BusinessPartner code and Replace Name to your UDF field name and replace 'Paul' to your contact id.

The expected result like this:

{
    "odata.metadata": "$metadata#Collection(Edm.ComplexType)",
    "value": [
        {
            "BusinessPartners": {
                "CardCode": "1037",
                "CardName": "Hi Customer"
            },
            "BusinessPartners/ContactEmployees": {
                "CardCode": "1037",
                "Name": "Paul"
            }
        }
    ]
}
Babin_B82
Newcomer
0 Likes

{
"QueryPath": "$crossjoin(FixedAssets,FixedAssets/DepreciationLines)",
"QueryOption": "$expand=FixedAssets($select=DocEntry,DocNum,DocStatus,RefDate),FixedAssets/DepreciationLines($select=DocEntry,AssetCode,DepreciationAmount)&$filter=FixedAssets/DocEntry eq FixedAssets/DepreciationLines/DocEntry"
}Screenshot 2025-07-24 173517.png

"value": "Invalid query objects."  

My Questions:

  1. Is ODRN/DRN2 the correct way to reference the line table in $crossjoin and $expand?

    • Or should I use something like DRN2 directly (if that’s a separate entity set)?

  2. What is the correct $expand structure to include both ODRN and Depreciation Lines in one query?

  3. Could you please confirm the valid entity set names for both header and lines?
    I couldn’t find clear documentation showing whether DRN2 is an exposed collection or only accessible as a navigation property.

  4. If $crossjoin doesn't support navigation like ODRN/DRN2, what is the recommended pattern to retrieve header and line data in a single query?