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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

The 'with' statement is deprecated and will be removed for cloud development in a future release. This warning will become an error in a future release.[AL0606]

(0) ShareShare
ReportReport
Posted on by 256

Hi All,  

I used WITH Statement in AL  for some functionality, so I how can Solve the warning? for below code

  WITH PurchHeader DO BEGIN
            IF IsCreditDocType THEN BEGIN
                IF ("Applies-to Doc. Type" = "Applies-to Doc. Type"::Invoice) AND ("Applies-to Doc. No." <> '') THEN
                    WHTManagement.CheckApplicationPurchWHT(PurchHeader);

                IF (("Applies-to Doc. Type" = "Applies-to Doc. Type"::Refund) AND ("Applies-to Doc. No." <> '')) OR
                   ("Applies-to ID" <> '')
                THEN
                    WHTManagement.CheckApplicationPurchWHT(PurchHeader);
            END;

            IF "Document Type" IN ["Document Type"::Invoice] THEN BEGIN
                IF ("Applies-to Doc. Type" = "Applies-to Doc. Type"::"Credit Memo") AND ("Applies-to Doc. No." <> '') THEN
                    WHTManagement.CheckApplicationPurchWHT(PurchHeader);

                IF (("Applies-to Doc. Type" = "Applies-to Doc. Type"::Payment) AND ("Applies-to Doc. No." <> '')) OR
                   ("Applies-to ID" <> '')
                THEN
                    WHTManagement.CheckApplicationPurchWHT(PurchHeader);
            END;
        END;

 Thanks.

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    The new AL version 6.x has features for quick fixing the WITH obsoletion.

    More info here:

    demiliani.com/.../

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 727 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 512 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 321 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans