JD Edwards

JD Edwards
Lokesh Reddy Blog

Wednesday, October 11, 2017

File Transfer From JDE Winows Server to Non-JDE WIndows Server(FTP) using Batch File

File Transfer From JDE Winows Server to Non-JDE WIndows Server(FTP)
Description :This Business Function is developed using the FTP Windows Scripting using Batch File. Will create the file with windows command and transfer the file by excuting the batch file.
Listing Named ER for Function: FileTransferJDEToFTP
Listing of ER for Named ER: N5601001


=======================================================================
NAMED ER:
=======================================================================
evt_HEIcErrorCode_ERRC
evt_HEIidGenericLong_GENLNG
evt_HEIszBatFileRecord_VAR1
evt_HEIszBatFileName_NFLF
evt_HEIwasFound_EV01
OPT: Using Defaults
// ********************************************************************
// Developer   Prjct             Start Date
// Lokehs Vedium  FTP    04/08/2017
// Desc : NER will copy the file from FTP Local Server to E1 Server
// ********************************************************************
VA evt_HEIszBatFileName_NFLF = concat(ltrim(rtrim([BF HEIszE1ServerPath_NFLF],' '),' '),concat(concat("/",rtrim(ltrim([BF HEIszCommandFileName_FILENAME],' '),' ')),".bat"))
Replace Character in String
   VA evt_HEIszBatFileName_NFLF -> BF szInputString
   VA evt_HEIszBatFileName_NFLF <- BF szOutputString
   "/" -> BF cReplCharOld
   "\" -> BF cReplCharNew
Open Flat File
   VA evt_HEIcErrorCode_ERRC <- BF cErrorCode
   VA evt_HEIidGenericLong_GENLNG <- BF idFilePtr
   VA evt_HEIszBatFileName_NFLF -> BF szFilePath
//
If VA evt_HEIidGenericLong_GENLNG is greater than <Zero>
   //
   VA evt_HEIszBatFileRecord_VAR1 = "@echo off"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   //
   VA evt_HEIszBatFileRecord_VAR1 = concat(concat("copy ",concat(ltrim(rtrim([BF HEIszE1ServerPath_NFLF],' '),' '),concat("/",rtrim(ltrim([BF HEIszCommandFileName_FILENAME],' '),' '))))," c:/Temp")
   Replace Character in String
      VA evt_HEIszBatFileRecord_VAR1 -> BF szInputString
      VA evt_HEIszBatFileRecord_VAR1 <- BF szOutputString
      "/" -> BF cReplCharOld
      "\" -> BF cReplCharNew
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   VA evt_HEIszBatFileRecord_VAR1 = "echo user svcbase.ftp01> ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatFileRecord_VAR1 = "echo Heineken1122>> ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatFileRecord_VAR1 = "echo bin>> ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatFileRecord_VAR1 = concat("echo cd ",concat(ltrim(rtrim([BF HEIszFTPServerPath_NFLF],' '),' ')," >>ftpcmd.dat"))
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatFileRecord_VAR1 = concat("echo put c:/Temp/",concat(ltrim(rtrim([BF HEIszCommandFileName_FILENAME],' '),'')," >>ftpcmd.dat"))
   Replace Character in String
      VA evt_HEIszBatFileRecord_VAR1 -> BF szInputString
      VA evt_HEIszBatFileRecord_VAR1 <- BF szOutputString
      "/" -> BF cReplCharOld
      "\" -> BF cReplCharNew
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatFileRecord_VAR1 = "echo quit>> ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatFileRecord_VAR1 = "ftp -n -s:ftpcmd.dat 10.12.66.17"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatFileRecord_VAR1 = "del ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatFileRecord_VAR1 = concat("del c:/Temp/",ltrim(rtrim([BF HEIszCommandFileName_FILENAME],' '),' '))
   Replace Character in String
      VA evt_HEIszBatFileRecord_VAR1 -> BF szInputString
      VA evt_HEIszBatFileRecord_VAR1 <- BF szOutputString
      "/" -> BF cReplCharOld
      "\" -> BF cReplCharNew
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   Close Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
   //
   Execute External Program
      BF HEIcErrorCode <- BF cErrorCode
      VA evt_HEIszBatFileName_NFLF -> BF szCommandLine
   //
   Time to sleep
      "15000" -> BF szSleepTimeString
   Delete Or Copy Flat File
      VA evt_HEIszBatFileName_NFLF -> BF szOriginalFlatFile
      "1" -> BF cActionOnFlatFiles
Else
End If
// **************************************************************

No comments:

Post a Comment