Xmlport to Codeunit parameter

RikarddoRikarddo Posts: 55Member
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
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!

Best Answer

Answers

  • RikarddoRikarddo Posts: 55Member
    Thanks for the help! It worked!!
Sign In or Register to comment.