Options

How can we export/import file from FTP server?

kenlkenl Member Posts: 182
Hello,

I need to export/import file from a FTP site. How can I do it in Navision 4.0 ?

Thanks.

Comments

  • Options
    TRSOEgroupTRSOEgroup Member Posts: 37
    kenl wrote:
    Hello,

    I need to export/import file from a FTP site. How can I do it in Navision 4.0 ?

    Thanks.

    unless the ftp drive is internal in your house so you can map it up as a drive with the rights you need you cant..

    you must transfer it to a local or network disc to import / export..

    you could use external programs to transfer the data from ftp to a networ drive though.
  • Options
    ta5ta5 Member Posts: 1,164
    Hi
    You can program a bat-/cmd-file and start this with shell command from navision. Hope this helps.
  • Options
    davmac1davmac1 Member Posts: 1,283
    Here is an example of a codeunit I wrote that may do what you need:


    Name DataType Subtype Length
    VirtFile Record File




    CommandString := 'E:\data\Batch\ftp.bat';
    CmdReturnCode := SHELL(CommandString);


    ImportDir := 'E:\data\TT';
    VirtFile.SETRANGE(Path, 'E:\');
    IF VirtFile.FIND('-') THEN ;

    VirtFile.SETRANGE(Path, ImportDir);
    VirtFile.SETFILTER(Name, '*.TXT');
    VirtFile.SETRANGE("Is a file", TRUE);

    IF VirtFile.FIND('-') THEN
    REPEAT

    IF STRPOS(VirtFile.Name,'BIDS') > 0 THEN
    DATAPORT.RUNMODAL(50024,FALSE)
    ELSE IF STRPOS(VirtFile.Name,'SALES') > 0 THEN
    DATAPORT.RUNMODAL(50025,FALSE)
    ELSE IF STRPOS(VirtFile.Name,'DUMP_AUCTION') > 0 THEN
    DATAPORT.RUNMODAL(50031,FALSE)
    ELSE IF STRPOS(VirtFile.Name,'DUMP_SUBSCRIBERS') > 0 THEN BEGIN
    DATAPORT.RUNMODAL(50030,FALSE);
    IF STRPOS(VirtFile.Name,'DUMP_SUBSCRIBERS_UML_CO_C') > 0 THEN
    DATAPORT.RUNMODAL(50026,FALSE)
    ELSE IF STRPOS(VirtFile.Name,'DUMP_SUBSCRIBERS_UML_CO_S') > 0 THEN
    DATAPORT.RUNMODAL(50027,FALSE)
    ELSE IF STRPOS(VirtFile.Name,'DUMP_SUBSCRIBERS_UML_SC_S') > 0 THEN
    DATAPORT.RUNMODAL(50028,FALSE)
    ELSE IF STRPOS(VirtFile.Name,'DUMP_SUBSCRIBERS_UML_SC_C') > 0 THEN
    DATAPORT.RUNMODAL(50029,FALSE);
    END;
    //CommandString := 'MOVE E:\data\XX\' + VirtFile.Name + 'E:\data\XXold\';
    //SHELL(CommandString);
    FILE.RENAME ('E:\data\XX\' + VirtFile.Name, 'E:\data\XXold\' + VirtFile.Name);

    UNTIL VirtFile.NEXT <= 0;
Sign In or Register to comment.