Skip to main content
Microsoft Dynamics NAV forum
Suggested answer

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

editSubscribe (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.

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,045 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,570 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans