Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Split PO Line Into Two

(1) ShareShare
ReportReport
Posted on by 27
Hi all,
 
 previously i asked One question related Split Po line into Two line..
I splited line into two line .. but what my  question is how to handle line no for more than one original Po line record .. & how to split it ?
 
here i paste my code ..
anyone correct my code.
 
 
 
 
thanks In Advance .. 
 
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 77,351 Super User 2025 Season 1 on at
    Split PO Line Into Two
    This depends on the sorting method you need. If you want it to be sorted below this line, I think "Line No./2" would be better.
    PS: Business Central Standard Error: The line cannot be split & There is not enough space to insert correction lines (AutoSplitKey Property)
     
    Hope this helps as well.
    Thanks.
    ZHU
  • Netjacker2097 Profile Picture
    Netjacker2097 271 on at
    Split PO Line Into Two
    hi,
     
    please try this: 
     
    SplitQty := ABS(Rec."Quantity Received") / 2;
    IF SplitQty > 0 THEN BEGIN
        Rec.LOCKTABLE;
        
        WHILE (Rec."Quantity Received" > 0) DO BEGIN
            Newpurchaseline.INIT;
            Newpurchaseline.TRANSFERFIELDS(Rec);
            
            Newpurchaseline."Line No." := Rec."Line No." + (10000 * SplitCounter); 
            Newpurchaseline."Quantity Received" := MIN(SplitQty, Rec."Quantity Received");
            
            Rec."Quantity Received" -= Newpurchaseline."Quantity Received";
            
            Newpurchaseline.INSERT;
            
            SplitCounter += 1;
        END;
        MESSAGE('Split Line Complete');
    END;
    Thanks,
    M

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,234 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,994 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans