How to put code in between for AL extension?
julkifli33
Member Posts: 1,099
Hi All.
I am planning to migrate all my code from C/AL to AL
some can use events
but how about if i want to put my code in between nav standard code
for example
In table 37 (Sales Line), there is function name CalcVATAmountLines
in the middle of the function there is code like this
I want to change to my customized code like this
I have added 3 more parameters for sumline function
and in the table 290 (VAT Amount Line)
[External] SumLine
"Line Amount" += LineAmount;
IF AllowInvDisc THEN
"Inv. Disc. Base Amount" += LineAmount;
"Invoice Discount Amount" += InvDiscAmount;
"VAT Difference" += VATDifference;
IF Prepayment THEN
"Includes Prepayment" := TRUE;
//Start Customized
"Transaction Type" := ParTransactionType;
"Document Type" := ParDocumentType;
"Document No." := ParDocumentNo;
//End Customized
MODIFY;
all the bold one is my customized code
how should i do that in AL?
Thanks before
I am planning to migrate all my code from C/AL to AL
some can use events
but how about if i want to put my code in between nav standard code
for example
In table 37 (Sales Line), there is function name CalcVATAmountLines
in the middle of the function there is code like this
//Nav Standard
CASE QtyType OF
QtyType::General:
BEGIN
VATAmountLine.Quantity += "Quantity (Base)";
VATAmountLine.SumLine(
"Line Amount","Inv. Discount Amount","VAT Difference","Allow Invoice Disc.","Prepayment Line");
END;
I want to change to my customized code like this
I have added 3 more parameters for sumline function
//CAL Customization
CASE QtyType OF
QtyType::General:
BEGIN
VATAmountLine.Quantity += "Quantity (Base)";
VATAmountLine.SumLine(
"Line Amount","Inv. Discount Amount","VAT Difference","Allow Invoice Disc.","Prepayment Line",2,"Document Type","Document No.");
END;
and in the table 290 (VAT Amount Line)
[External] SumLine
"Line Amount" += LineAmount;
IF AllowInvDisc THEN
"Inv. Disc. Base Amount" += LineAmount;
"Invoice Discount Amount" += InvDiscAmount;
"VAT Difference" += VATDifference;
IF Prepayment THEN
"Includes Prepayment" := TRUE;
//Start Customized
"Transaction Type" := ParTransactionType;
"Document Type" := ParDocumentType;
"Document No." := ParDocumentNo;
//End Customized
MODIFY;
all the bold one is my customized code
how should i do that in AL?
Thanks before
0
Answers
-
You can't
That's the "beauty" of AL / extensions - you cannot modify existing code. Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
You can create custom codeunits and find out what subscribers you can use for these tables and create your custom code there.0
-
I can add event for before or after
But how about in between standard code?0 -
You can't do any change in standard code
. 0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 322 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

