cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with InventoryCountings (B1 Service Layer)

sap-chris
Explorer
0 Kudos

Hi Everyone

We've a problem with Service Layer (B1 V10.0 FP2105).

Our goal is to load a presaved inventory counting list trough service layer and show them in our application to the employees. They count the items and save the counted quantity trough service layer back to SAP.
The problem we are faced is that when we load the presaved inventory list, we can’t get the lines with the items we have to count. “InventoryCountingLines” is always 0.

We tried it on two different SAP Systems (both V10.0 FP2105) and with different presaved inventory lists. We also tried it with different user, including admin user. Always the same problem.

Any Idea how we can solve this issue and get the information about the items in a inventory counting who have to be counted?

{
   "odata.metadata" : "https://sap-server:50000/b1s/v1/$metadata#InventoryCountings",
   "value" : [
      {
         "DocumentEntry" : 419,
         "DocumentNumber" : 419,
         "Series" : 51,
         "CountDate" : "2022-11-18",
         "CountTime" : "14:23:00",
         "SingleCounterType" : "ctUser",
         "SingleCounterID" : 9,
         "DocumentStatus" : "cdsOpen",
         "Remarks" : null,
         "Reference2" : null,
         "BranchID" : null,
         "DocObjectCodeEx" : "1470000065",
         "FinancialPeriod" : 138,
         "PeriodIndicator" : "Standard",
         "CountingType" : "ctSingleCounter",
         "AttachmentEntry" : null,
         "YearEndDate" : null,
         "TeamCounters" : [],
         "IndividualCounters" : [],
-------> "InventoryCountingLines" : [], 
         "InventoryCountingDocumentReferencesCollection" : []
      }
   ]
}

Accepted Solutions (1)

Accepted Solutions (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

Hi sap-chris,

I checked the issue in the DEMO Database on FP2202 and following request works fine and returns InventoryCountingLines collection:

GET /b1s/v1/InventoryCountings(1)

Are you using the same request?

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

Answers (2)

Answers (2)

0 Kudos

TL;DR;

EDIT with response: If you send just the LineNumber (Instead of ItemCode and WarehouseCode) and the CountedQuantity, it works!! 🙂

Hello folks, related to that question, what is the right way to update the values on the array?.

I'm trying to do something like that

PATCH /b1s/v1/InventoryCountings(1)<br><br>{         <br>    "InventoryCountingLines": [
        {  "ItemCode": "AG-35",  "CountedQuantity": 1.0,  "WarehouseCode": "01"  }                     

    ]
}

But I receive this error:

{<br>  "error": {<br>  "code": -5002,<br>  "message": {<br>  "lang": "en-us",<br>  "value": "1470000411 - Item AG-35 in warehouse 01 has already been added to current document [INC1.ItemCode][line: 5934]"<br>  }<br>  }<br>}

I suppose that it's interpreting that i want to update the entire array, which is not the case. Any help on that?

sap-chris
Explorer
0 Kudos

Hi ankit.chauhan1

Thanks for your quick reply.

I tried GET /b1s/v1/InventoryCountings(1) on our database and it worked 🙂

Before I used a filter in my request. With this filter we don't get the InventoryCountingLines. Can you try this on your database again and tell me if you can get the InventoryCountingLines with this filter request?

GET /b1s/v1/InventoryCountings?$filter=DocumentNumber eq 1

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

Hi sap-chris,

The following does not work:

GET /b1s/v1/InventoryCountings?$filter=DocumentNumber eq 1

However the following works fine:

GET /b1s/v1/InventoryCountings?$filter=DocumentEntry eq 1

Hope it helps!

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

sap-chris
Explorer
0 Kudos

Hi ankit.chauhan1

Thanks for your reply.

Yes will now use this request:

GET /b1s/v1/InventoryCountings?$filter=DocumentEntry eq 1

Thank you very much for your help!

I wish you a nice weekend!

Christian