Skip to main content

Notifications

Announcements

No record found.

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

Unable to delete Transfer Order in case of Short Closed=true, Qty Shipped=received, Outstanding QTy=0

(0) ShareShare
ReportReport
Posted on by 50

Dear Sir/Madam,

I'm stuck over the same issue for a week. Please give me a solution on the same. Please find my code as per below on 'Short Closed Delete' button.

LOCAL DeleteShortClosed()
//IF NOT CONFIRM(GITL01) THEN
CLEAR(TransferLine);
CLEAR(TransferHeader);
TransferLine.RESET;
TransferLine.SETRANGE("Document No.",TransferLine."Document No.");
TransferLine.SETRANGE("Line No.",TransferLine."Line No.");
TransferLine.SETRANGE(Status,TransferLine.Status::Open);
TransferLine.SETRANGE("Short Closed",TRUE);
//TransferLine.SETRANGE("Completely Received",TRUE);
//TransferLine.SETRANGE("Completely Shipped",TRUE);
TransferLine.SETRANGE("Outstanding Qty. (Base)",0);
TransferLine.SETRANGE("Outstanding Quantity",0);

IF TransferLine."Quantity Received" = TransferLine."Quantity Shipped" THEN
IF TransferLine.FINDFIRST THEN
REPEAT
TransferLine.DELETE;
i+=1;
UNTIL TransferLine.NEXT=0;
//REPEAT UNTIL TransferHeader.NEXT=0;
TransferHeader.RESET;
TransferHeader.SETRANGE("No.");
TransferHeader.SETRANGE(Status,TransferHeader.Status::Open);
IF TransferHeader.FINDFIRST THEN
REPEAT
TransferHeader.DELETE;
BEGIN END;
UNTIL TransferHeader.NEXT=0;
IF i <> 0 THEN
MESSAGE('LInes Deleted')
ELSE
MESSAGE('LInes not deleted',i);
BEGIN END;

Thanks & Regards,

Sushil Chaudhari

  • Suggested answer
    Marco Mels Profile Picture
    Marco Mels on at
    RE: Unable to delete Transfer Order in case of Short Closed=true, Qty Shipped=received, Outstanding QTy=0

    Hello,

    Maybe Josh can answer this one.

    We from CSS currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    dynamicsuser.net/.../developers

    I will open this up to the community in case they have something to add.

    Thanks.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans