Xmlport to Codeunit parameter
Rikarddo
Member Posts: 80
Imagine this complicated scenario
I have an xmlport that receives through a webservice some variables. In this xmlport I want to pass the values to a code unit where it will calculate some costs and based on it returns a minimum price. Where then I through xmlport return the values to the same application that sent me the variables via webservice.
My SalesLine is temporary;
This is my code in xmlport
What am i doing wrong here? Any thoughts ?
Thanks for the help!
I have an xmlport that receives through a webservice some variables. In this xmlport I want to pass the values to a code unit where it will calculate some costs and based on it returns a minimum price. Where then I through xmlport return the values to the same application that sent me the variables via webservice.
My SalesLine is temporary;
This is my code in xmlport
Integer - Export :: OnAfterGetRecord ()
...
SalesLine3.Quantity: = ivardec;
SalesLine3. "Container Code": = ItemContainerNO;
ltBusRel.SETRANGE ("Contact No.", ContactNo);
ltBusRel.SETRANGE ("Business Relation Code", "CLI");
IF ltBusRel.FINDFIRST THEN
BEGIN
ltCustomer.GET (ltBusRel. "No.");
END;
SalesLine3. "Document Type": = SalesLine3. "Document Type" :: Order;
SalesLine3. "Sell-to Customer No": = ltCustomer. "No.";
SalesLine3. "Document No.": = 'TEMP';
SalesLine3. "No.": = ItemNo;
SalesLine3. "Location Code": = Location;
SalesLine3. "Line No.": = 1000;
- Here I call the codeunit lcPricingtool, with parameters that I get
lcPricingTool.GetPVmin (SalesLine3, CodT, ContactNo, CodPostal, CodPais, '');
--then the calculated values in the CU should be passed to my variables PT where I return them
PT_CustoVasilhame: = FORMAT (SalesLine3. "Cost Container");
PT_CustoOpe: = FORMAT (SalesLine3. "Cost Operation");
CUSTOMER: = FORMAT (SalesLine3. "Supplier Cost");
PT_CustomCustomer: = FORMAT (SalesLine3. "Customer Cost");
PT_CustoStk: = FORMAT (SalesLine3. "Cost Stock");
PT_CostTransport: = FORMAT (SalesLine3. "Transport Cost");
PT_CostTransfer: = FORMAT (SalesLine3. "Transfer Cost");
PT_PMinimo: = FORMAT (SalesLine3. "PV Minimo");
PT_PAconfigured: = FORMAT (SalesLine3. "PV Advised");
PT_CustoUnit: = FORMAT (SalesLine3. "Unit Cost");
And here is the code unit and where CU fails
GetPVmin (VAR SalesLine: Record "Sales Line"; ShipAgent: Code [20]; Contact: Code [20]; ShipPostCode: Code [20]; Country: Code [10]; EndEnv: Code [20]): Decimal
SalesLine.SETFILTER (Type, '<> 0');
Container: = 0;
IF SalesLine.FINDSET THEN //<--It fails here with (Encomenda,TEMP,1000)
BEGIN
IF (SalesLine. "Document Type" <> SalesLine. "Document Type" :: Order) THEN
EXIT;
...
What am i doing wrong here? Any thoughts ?
Thanks for the help!
0
Best Answer
-
Hi Rikarddo,
Perhaps you should insert the record before calling the codeunitSalesLine3. "Document Type": = SalesLine3. "Document Type" :: Order; SalesLine3. "Sell-to Customer No": = ltCustomer. "No."; SalesLine3. "Document No.": = 'TEMP'; SalesLine3. "No.": = ItemNo; SalesLine3. "Location Code": = Location; SalesLine3. "Line No.": = 1000; Salesline3.INSERT; // Add this line - Here I call the codeunit lcPricingtool, with parameters that I get lcPricingTool.GetPVmin (SalesLine3, CodT, ContactNo, CodPostal, CodPais, '');
Regards
Albert5
Answers
-
Hi Rikarddo,
Perhaps you should insert the record before calling the codeunitSalesLine3. "Document Type": = SalesLine3. "Document Type" :: Order; SalesLine3. "Sell-to Customer No": = ltCustomer. "No."; SalesLine3. "Document No.": = 'TEMP'; SalesLine3. "No.": = ItemNo; SalesLine3. "Location Code": = Location; SalesLine3. "Line No.": = 1000; Salesline3.INSERT; // Add this line - Here I call the codeunit lcPricingtool, with parameters that I get lcPricingTool.GetPVmin (SalesLine3, CodT, ContactNo, CodPostal, CodPais, '');
Regards
Albert5 -
Thanks for the help! It worked!!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 333 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