JD Edwards

JD Edwards
Lokesh Reddy Blog

Wednesday, October 11, 2017

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


File Transfer From Non-JDE WIndows Server(FTP) to JDE Winows Server: 
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: FileTransferFTPToJDE
Listing of ER for Named ER: N5601001


=======================================================================
NAMED ER:
=======================================================================
evt_HEIidGenericLong_GENLNG
evt_HEIszBatchFileRecord_VAR1
evt_HEIcErrorCode_ERRC
evt_HEIszBatFileNamePath_NFLF
OPT: Using Defaults
// ****************************************************************
// HEI Modification History
// Buisness Function to copy File From FTP to JDE (Inbound) using the Shell
// Scripting
// Developer                   Prjct    Date
// Lokesh Vedium        FTP       02/08/2017
// ****************************************************************
VA evt_HEIszBatFileNamePath_NFLF = concat(ltrim(rtrim([BF HEIszE1ServerPath_NFLF],' '),' '),concat(concat("/",rtrim(ltrim([BF HEIszCommandFileName_FILENAME],' '),' ')),".bat"))
Replace Character in String
   VA evt_HEIszBatFileNamePath_NFLF -> BF szInputString
   VA evt_HEIszBatFileNamePath_NFLF <- BF szOutputString
   "/" -> BF cReplCharOld
   "\" -> BF cReplCharNew
Open Flat File
   VA evt_HEIcErrorCode_ERRC <- BF cErrorCode
   VA evt_HEIidGenericLong_GENLNG <- BF idFilePtr
   VA evt_HEIszBatFileNamePath_NFLF -> BF szFilePath
//
If VA evt_HEIidGenericLong_GENLNG is greater than <Zero>
   //
   VA evt_HEIszBatchFileRecord_VAR1 = "@echo off"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatchFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatchFileRecord_VAR1 = "echo user svcbase.ftp01> ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatchFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatchFileRecord_VAR1 = "echo Heineken1122>> ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatchFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatchFileRecord_VAR1 = "echo bin>> ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatchFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatchFileRecord_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_HEIszBatchFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatchFileRecord_VAR1 = "echo lcd c:/Temp >>ftpcmd.dat"
   Replace Character in String
      VA evt_HEIszBatchFileRecord_VAR1 -> BF szInputString
      VA evt_HEIszBatchFileRecord_VAR1 <- BF szOutputString
      "/" -> BF cReplCharOld
      "\" -> BF cReplCharNew
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatchFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatchFileRecord_VAR1 = concat("echo get ",concat(ltrim(rtrim([BF HEIszCommandFileName_FILENAME],' '),''),">>ftpcmd.dat"))
   Replace Character in String
      VA evt_HEIszBatchFileRecord_VAR1 -> BF szInputString
      VA evt_HEIszBatchFileRecord_VAR1 <- BF szOutputString
      "/" -> BF cReplCharOld
      "\" -> BF cReplCharNew
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatchFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatchFileRecord_VAR1 = "echo quit>> ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatchFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatchFileRecord_VAR1 = "ftp -n -s:ftpcmd.dat 10.12.66.17"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatchFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatchFileRecord_VAR1 = "del ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatchFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatchFileRecord_VAR1 = concat("copy ",concat("c:/Temp",concat("/",concat(rtrim(ltrim([BF HEIszCommandFileName_FILENAME],' '),' '),concat(" ",ltrim(rtrim([BF HEIszE1ServerPath_NFLF],' '),' '))))))
   Replace Character in String
      VA evt_HEIszBatchFileRecord_VAR1 -> BF szInputString
      VA evt_HEIszBatchFileRecord_VAR1 <- BF szOutputString
      "/" -> BF cReplCharOld
      "\" -> BF cReplCharNew
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatchFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszBatchFileRecord_VAR1 = concat("del c:/Temp/",ltrim(rtrim([BF HEIszCommandFileName_FILENAME],' '),' '))
   Replace Character in String
      VA evt_HEIszBatchFileRecord_VAR1 -> BF szInputString
      VA evt_HEIszBatchFileRecord_VAR1 <- BF szOutputString
      "/" -> BF cReplCharOld
      "\" -> BF cReplCharNew
   Write One Line To Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
      VA evt_HEIszBatchFileRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   Close Flat File
      VA evt_HEIidGenericLong_GENLNG -> BF idFilePtr
   //
   Execute External Program
      BF HEIcErrorCode <- BF cErrorCode
      VA evt_HEIszBatFileNamePath_NFLF -> BF szCommandLine
   //
   Time to sleep
      "15000" -> BF szSleepTimeString
   Delete Or Copy Flat File
      VA evt_HEIszBatFileNamePath_NFLF -> BF szOriginalFlatFile
      "1" -> BF cActionOnFlatFiles
End If

No comments:

Post a Comment