web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

How to get remaning stock of Item using service ?

(0) ShareShare
ReportReport
Posted on by 989

Hi,

I am very new to Dynamics NAV.

I want to create a webservice which will accept a item No and location code as filter and will return the available stock position of the Item.

Please help me, how should I achieve the requirement.

Thanks in advance.

*This post is locked for comments

I have the same question (0)
  • Saurav.Dhyani Profile Picture
    14,380 Super User 2025 Season 2 on at

    Hi ,

    I am not sure how u can do will you consume the web service and send data to NAV as I am not experienced in DoTNET.

    From NAV what you need to do is -

    1) Create a codeunit with functions as per your requirement.

       Parameters as Item No & Location Code

       Return Value as Stock as that position.

    2) Publish that web service.

    3) Consume that web service (may be some one else can help you on that part).

  • surajitkundu Profile Picture
    989 on at

    Hi Saurav,

     Can you hemp me how to calculate sum of remaining qty in codeunit  using parameters and return that value ? I am able to define parameter and function.

    Thanks

    Surajit

  • Community Member Profile Picture
    on at

    msdn.microsoft.com/.../hh169472(v=nav.70).aspx

  • Saurav.Dhyani Profile Picture
    14,380 Super User 2025 Season 2 on at

    Hi,

     

    Here is the function that I have created in codeunit-

    GetItemQuantity(ItemNo : Code[20];LocationCode : Code[20]) : Decimal

      ItemLedEntry.SETRANGE("Item No.",ItemNo);

      ItemLedEntry.SETRANGE("Location Code",LocationCode);

      IF ItemLedEntry.FINDFIRST THEN REPEAT  

         Qty += ItemLedEntry.Quantity;

      UNTIL(ItemLedEntry.NEXT=0);

    EXIT(Qty);  

    Where ItemLedEntry is a Record Variable of Item Ledger Entry.

     

  • surajitkundu Profile Picture
    989 on at

    HI saurav,

      Thanks for the reply . Its realy help for me . One quary  ,is it required a variable for Qty ?

    Thanks

    Surajit

  • Verified answer
    Saurav.Dhyani Profile Picture
    14,380 Super User 2025 Season 2 on at

    Hi,

    Yes Surajit you will require the quantity variable as you need to return a value for that item in that particular location.

    Qty calculates the values and then return it to DOTNET.

    If you have issues in Dotnet part I have made a sample to consume data from this codeunit.

  • Suggested answer
    surajitkundu Profile Picture
    989 on at

    Hi Saurav,

     Thanks for the reply.

    Surajit

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans