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 21
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 74,148 Super User 2024 Season 2 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 263 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,431 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans