how to send parameter to codeunit?

bangswit
Member Posts: 265
hi
how to send parameter to codeunit?
thanks
this is my code in codeunit
OnRun()
SalesInvLine.FINDFIRST;
SalesInvLine.SETRANGE(SalesInvLine."Sell-to Customer No.");
SalesInvLine.SETRANGE(SalesInvLine."Document No.",Parameter);
SalesInvLine.FINDSET;
how to send parameter to codeunit?
thanks
this is my code in codeunit
OnRun()
SalesInvLine.FINDFIRST;
SalesInvLine.SETRANGE(SalesInvLine."Sell-to Customer No.");
SalesInvLine.SETRANGE(SalesInvLine."Document No.",Parameter);
SalesInvLine.FINDSET;
0
Comments
-
Make sure you declare the Parameter variable global in that codeunit.
Next declare a variable that's linked to your codeunit: MyCodunit
Create a function in the same codeunit called, for example, SetParameter:SetParameter(par : <datatype of Parameter>) Parameter := par;
Before you call the (OnRun) of the codeunit first call your new function SetParameter:MyCodeunit.SetParameter(<fill in the value you want to hand over to Parameter>); MyCodeunit.RUN;
0 -
bangswit wrote:how to send parameter to codeunit?
Is it standard Codeunit or your custom made codeunit?
If it is the standard CU, I prefer the one suggested by Luc:
Iflvanvugt wrote:Create a function in the same codeunit called, for example, SetParameter:SetParameter(par : <datatype of Parameter>) Parameter := par;
Before you call the (OnRun) of the codeunit first call your new function SetParameter:MyCodeunit.SetParameter(<fill in the value you want to hand over to Parameter>); MyCodeunit.RUN;
But if you use your own design CU, you can try this one:
1. Add the Parameter to the CU.
2. Run the CU with the passed parameter.Regards,
Andwian0 -
SLF25 wrote:Andwian wrote:But if you use your own design CU, you can try this one:
1. Add the Parameter to the CU.
2. Run the CU with the passed parameter.
I think this is not possible, you have to create a function.
I forgot that on OnRun() trigger, we could not add the parameterRegards,
Andwian0 -
Andwian wrote:SLF25 wrote:Andwian wrote:But if you use your own design CU, you can try this one:
1. Add the Parameter to the CU.
2. Run the CU with the passed parameter.
I think this is not possible, you have to create a function.
I forgot that on OnRun() trigger, we could not add the parameter0 -
that's right
just like thisCurrForm.SETSELECTIONFILTER(SalesInvHeader); REPORT.RUN(50092,TRUE,FALSE,SalesInvHeader);
0 -
bangswit wrote:that's right
just like thisCurrForm.SETSELECTIONFILTER(SalesInvHeader); REPORT.RUN(50092,TRUE,FALSE,SalesInvHeader);
0 -
Belias wrote:not correct, we can add a record parameter (see codeunit 80, it's tableno property of the codeunit)Bangswit wrote:that's right
just like thisCurrForm.SETSELECTIONFILTER(SalesInvHeader); REPORT.RUN(50092,TRUE,FALSE,SalesInvHeader);
Regards,
Andwian0 -
Andwian wrote:Belias wrote:not correct, we can add a record parameter (see codeunit 80, it's tableno property of the codeunit)Bangswit wrote:that's right
just like thisCurrForm.SETSELECTIONFILTER(SalesInvHeader); REPORT.RUN(50092,TRUE,FALSE,SalesInvHeader);
owww yeah sorry i forgot to tell
i change from codeunit become report
because the client doesn't have codeunit0 -
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
- 320 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