how can i import data into table using codeunit on page button

Hi All,

I am new user of Navision and i am usin NAV 2013.

Actually I am creating a table in the name of Cato Nav Integration.It has fields like cato ID, Order ID,Account,Date/Time,UID, Batch no., Qty. and now i have to import data into this table from notepad which is saved in my desktop. I don’t have

use xmlport methode. I have to do this to create a button on the page and write a codeunit on the action deginer.

Anyone help me please.[:)]

Use XMLPort for importing data and just called XMLPORT on Page using Action Designer…

Hi Amol,

Thanks for Reply.

But I want to Import data from codeunit .I don,t want to use XMLPORT,

I am writing this code on the codeunit deginer OnRun trigger.

TestFile.TEXTMODE(TRUE);
TestFile.WRITEMODE(TRUE);
TestFile.OPEN(‘E:\Avinash wikal\NavImport.txt’);
REPEAT
TestFile.READ(vstring);
CatoIDPos := STRPOS(vstring,’;’);
CatoNavInt.“CATO Medication ID”:= COPYSTR(vstring,1,CatoIDPos-1);
OrderNoPos := STRPOS(vstring,’;’);
CatoNavInt.“NAV Order No.” := COPYSTR(vstring,CatoIDPos+1,OrderNoPos-1);
CustNoPos := STRPOS(vstring,’;’);
CatoNavInt.“Customer No.” := COPYSTR(vstring,OrderNoPos+1,CustNoPos-1);
“ProdDate&TimePos” := STRPOS(vstring,’;’);
EVALUATE(CatoNavInt.“Prod Date and Time”,COPYSTR(vstring,CustNoPos+1,“ProdDate&TimePos”-1));
UIDPos := STRPOS(vstring,’;’);
CatoNavInt.UID := COPYSTR(vstring,“ProdDate&TimePos”+1,UIDPos-1);
BatchNoPos := STRPOS(vstring,’;’);
CatoNavInt.“Batch No.” := COPYSTR(vstring,UIDPos+1,BatchNoPos-1);
QuantityPos := STRPOS(vstring,’;’);
EVALUATE(CatoNavInt.Quantity,COPYSTR(vstring,BatchNoPos+1,QuantityPos-1));
StatusPos := STRPOS(vstring,’;’);
EVALUATE(CatoNavInt.Status,COPYSTR(vstring,QuantityPos+1,StatusPos-1));
UNTIL
TestFile.POS=TestFile.LEN;
CatoNavInt.INSERT;
MESSAGE(‘Sent Successfully’);
But I still get Runtime error that is WRITE is not supported for a without a maximum Length.

what should I change or Add in this code.

Reply me Pls

Avinash

I don’t see CatoNavInt.INIT;,