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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Business Central forum

How to assign lot/serial number to Sales Order Line by program

(0) ShareShare
ReportReport
Posted on by

Hi Experts!

We're working on an Extension for 365BC.

We have some items with Tracking.

Could you please guide me how to assign lot/serial number to Sales Order Line by program?

And make sure it can be post to create a Posted Sales Shipments successfully.

Does 365 have some codeUnit help us to do that?

Thanks

Billy

Categories:
I have the same question (0)
  • Suggested answer
    Amit Profile Picture
    2,559 on at

    Hi,

    Refer the below code-:

    ReservationEntry.INIT;
                                ReservationEntry."Entry No." := ReservationEntryNo;
                                ReservationEntry.Positive := False;
                                ReservationEntry."Item No." := SalesLine."No.";
                                ReservationEntry.INSERT(True);
                                ReservationEntry."Location Code" := "Location Code";
                                ReservationEntry."Reservation Status" := ReservationEntry."Reservation Status"::Surplus;
                                ReservationEntry.Description := SalesLine.Description;
                                ReservationEntry."Creation Date" := "Posting Date";
                                ReservationEntry."Source Type" := 37;
                                ReservationEntry."Source Batch Name" := '';
                                ReservationEntry."Source ID" := "No.";
                                ReservationEntry."Source Subtype" := 1;
                                ReservationEntry."Source Ref. No." := SalesLine."Line No.";
                                ReservationEntry."Expected Receipt Date" := "Posting Date";
                                ReservationEntry."Lot No." := BatchNo;
                                ReservationEntry.VALIDATE("Quantity (Base)", -1);
                                ReservationEntry."Qty. per Unit of Measure" := 1;
                                ReservationEntry."Warranty Date" := ManfDate;
                                ReservationEntry."Expiration Date" := ExpDate;
                                ReservationEntry."Item Tracking" := ReservationEntry."Item Tracking"::"Lot No.";
                                ReservationEntry.Modify(True);
    Regards
    Amit Sharma
  • Dhirenders Profile Picture
    5 on at

    Hi Umar,

    I'm stuck on same; did you find any solution?

    Thanks

  • Hot Potato Profile Picture
    25 on at

    What about if you want to split the sales line with lot number quantity into the next line if the quantity is greater than a particular number? Let's say, you have 1000 cases for item no. 1 and you are comparing it to a number 500, which is the number of cases per pallet - with this, the report should create one line for 500 and another line for the other 500 but with the same lot number from reservation entry?

  • Suggested answer
    Bilal Haider Profile Picture
    414 on at

    @KC Lai you can see the second reply on the post by Suresh Kulla. It has solution.

  • KC Lai Profile Picture
    335 on at

    Hi PHT80,

    We are having similar request from client to assign serial number to SO line.

    wonder you have solution?

  • Umar Farooq Raja Profile Picture
    15 on at

    Hi PHT80!!!

    I am having same problem,  I am using the code above, but when I go to the Item Tracking Lines window, the "Lot No." field is empty.

    Will you please share your findings with me , so I can resolve my problem.

    Thanks

  • PHT80 Profile Picture
    40 on at

    I solved the problem. There were erroneous data in the "Reservation Entry" table. I cleaned this data and now it works OK.

    Thank you !!

  • Community Member Profile Picture
    on at

    Where your lotNo field value come from? did you pass lotNo field value?

  • PHT80 Profile Picture
    40 on at

    Hi MIng0515,

    I am not using web service, I am importing from a text file.

    This is the code I am using:

    pastedimage1573571500756v1.png

    Thank you.

  • Community Member Profile Picture
    on at

    Maybe you need provide some screen shots or code sample. Did you use web service to create lot&serial?

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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans