JD Edwards

JD Edwards
Lokesh Reddy Blog

Wednesday, October 11, 2017

Non-JDE WIndows FTP File Deletion from JDE using Batch File

FTP File Deletion 
Listing Named ER for Function: FTPFileDeletion
Listing of ER for Named ER: N5601001


=======================================================================
NAMED ER:
=======================================================================
evt_HEIszFTPFileName_VAR1
evt_HEIszFTPRecord_VAR1
evt_HEIidGenericLong_VAR1
OPT: Using Defaults
// **************************************************************
// Added Logic for FTP File Deletion
// By Lokesh on 9/10/2017
// **************************************************************
VA evt_HEIszFTPFileName_VAR1 = concat(ltrim(rtrim([BF HEIszE1ServerPath_NFLF],' '),' '),concat(concat("/",rtrim(ltrim([BF HEIszCommandFileName_FILENAME],' '),' ')),".bat"))
Replace Character in String
   VA evt_HEIszFTPFileName_VAR1 -> BF szInputString
   VA evt_HEIszFTPFileName_VAR1 <- BF szOutputString
   "/" -> BF cReplCharOld
   "\" -> BF cReplCharNew
Open Flat File
   BF HEIcErrorCode <- BF cErrorCode
   VA evt_HEIidGenericLong_VAR1 <- BF idFilePtr
   VA evt_HEIszFTPFileName_VAR1 -> BF szFilePath
//
If VA evt_HEIidGenericLong_VAR1 is greater than <Zero>
   //
   VA evt_HEIszFTPRecord_VAR1 = "@echo off"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszFTPRecord_VAR1 = "echo user svcbase.ftp01> ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszFTPRecord_VAR1 = "echo Heineken1122>> ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszFTPRecord_VAR1 = "echo bin>> ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszFTPRecord_VAR1 = concat("echo cd ",concat(ltrim(rtrim([BF HEIszFTPServerPath_NFLF],' '),' ')," >>ftpcmd.dat"))
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszFTPRecord_VAR1 = concat("echo delete ",concat(ltrim(rtrim([BF HEIszCommandFileName_FILENAME],' '),'')," >>ftpcmd.dat"))
   Replace Character in String
      VA evt_HEIszFTPRecord_VAR1 -> BF szInputString
      VA evt_HEIszFTPRecord_VAR1 <- BF szOutputString
      "/" -> BF cReplCharOld
      "\" -> BF cReplCharNew
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszFTPRecord_VAR1 = "echo quit>> ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszFTPRecord_VAR1 = "ftp -n -s:ftpcmd.dat 10.12.66.17"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   VA evt_HEIszFTPRecord_VAR1 = "del ftpcmd.dat"
   Write One Line To Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
      VA evt_HEIszFTPRecord_VAR1 -> BF szRecord
      "1500" -> BF szLargeString
   //
   //
   Close Flat File
      VA evt_HEIidGenericLong_VAR1 -> BF idFilePtr
   //
   Execute External Program
      BF HEIcErrorCode <- BF cErrorCode
      VA evt_HEIszFTPFileName_VAR1 -> BF szCommandLine
   //
!    Time to sleep
!       "15000" -> BF szSleepTimeString
   Delete Or Copy Flat File
      VA evt_HEIszFTPFileName_VAR1 -> BF szOriginalFlatFile
      "1" -> BF cActionOnFlatFiles
End If
// **************************************************************
// Added Logic for FTP File Deletion
// By Lokesh on 9/10/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
// **************************************************************

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