jueves, 5 de mayo de 2016

[JD Edwards] Execute Windows / Linux Commands


Sometimes we are in a situation where in JDE not have a function, features or functionality to perform a certain task, or is too complex, and with a Windows command or Linux command (depends of Enterprise Server) it's easy. For example search text files in a directory, search for a PDF generated with BIP, etc.


In JDE through the Business Fuction "Execute External Program" (B34A1030) we can execute these commands. I can even make a script (.bat in Windows or .sh in Linux)



Example:

//
// Linux command to search files
//
VA evt_Command_NFLF = concat('/bin/ls -1 ',concat(directory,concat(' | egrep -i $*.csv > ',tempFile_directory)))
//
// Windows command to search files
//
VA evt_Command_NFLF = concat('dir /A:-D /B ',concat(directory,concat(' > ',tempFile_directory)))
//
Execute External Program
VA rpt_ErrorCode_ERRC <- BF cErrorCode
VA evt_Command_NFLF -> BF szCommandLine
//
If VA rpt_ErrorCode_ERRC is equal to "1"
   Stop Batch Processing
End If
//

No hay comentarios:

Publicar un comentario