cancel
Showing results for 
Search instead for 
Did you mean: 

How can i query from LineDocument from Master Document?

05-22-2023 9:29 AM
SayEangKheang Explorer
2878 views 6 comments
0 Likes
SAP Managed Tags
Subscribe

Hi, is there any way to filter or query from Line Document in API ServiceLayer?

example:

Thank you.

0 Likes

Accepted Solutions (0)

Answers (3)

Answers (3)

SayEangKheang
Explorer
0 Likes

Hi Mr Matija Gregur,

here is my SAP Version B1 SQL 10.0.

is there the configuration for that to enable to use it?

mgregur
Active Contributor
0 Likes

Hi,

this is limited by the version. This service is available on HANA, and not on SQL version.

BR,

Matija

SayEangKheang
Explorer
0 Likes

Thank for your reply,

I have check on what you give above but i have read it and i don't really understand on 3.7.10.1 Metadata for Query Service.

 /b1s/v1/QueryService_PostQuery
{
    "QueryPath": "$crossjoin(Orders,Orders/DocumentLines)",
    "QueryOption": "$expand=Orders($select=DocEntry, DocNum),Orders/DocumentLines($select=ItemCode,LineNum)&$filter=Orders/DocEntry eq Orders/DocumentLines/DocEntry and Orders/DocEntry ge 3 andOrders/DocumentLines/LineNum eq 0"
}

and I got error message from API.
{
    "error": {
        "code": 201,
        "message": {
            "lang": "en-us",
            "value": "Not supported query option"
        }
    }
}
mgregur
Active Contributor
0 Likes

Hi,

which version are you using? Because I get a good response...

POST /b1s/v1/QueryService_PostQuery

BODY
{  "QueryPath": "$crossjoin(Orders,Orders/DocumentLines)",  "QueryOption": "$expand=Orders($select=DocEntry, DocNum),Orders/DocumentLines($select=ItemCode,LineNum)&$filter=Orders/DocEntry eq Orders/DocumentLines/DocEntry and Orders/DocEntry ge 3 and Orders/DocumentLines/LineNum eq 0" }

Response:

{
   "odata.metadata" : "$metadata#Collection(Edm.ComplexType)",
   "value" : [
      {
         "Orders" : {
            "DocEntry" : 177,
            "DocNum" : 75
         },
         "Orders/DocumentLines" : {
            "ItemCode" : "23",
            "LineNum" : 0
         }
      },
      {
         "Orders" : {
            "DocEntry" : 209,
            "DocNum" : 94
         },
ETC
   ],
   "odata.nextLink" : "QueryService_PostQuery?$expand=Orders($select=DocEntry, DocNum),Orders/DocumentLines($select=ItemCode,LineNum)&$filter=Orders/DocEntry eq Orders/DocumentLines/DocEntry and Orders/DocEntry ge 3 and Orders/DocumentLines/LineNum eq 0&$skip=20"
}

BR,

Paul_
Explorer
0 Likes
Need space inbetween and and Orders/... "andOrders/DocumentLines/LineNum eq 0"
mgregur
Active Contributor
0 Likes

Hi,

you can find this in "Working with SAP Business One Service Layer 10" manual, page 49.

BR,

Matija