pre cutover push
This commit is contained in:
@ -8,6 +8,7 @@ COMPILE FUNCTION obj_SAP(Method,Parms)
|
||||
11/20/2015 JCH & DKK updated
|
||||
10/11/2018 djs Additional logging added to SendRecord subroutine
|
||||
01/30/2019 djs SendRecord logging updated to record outbound files in respective directories
|
||||
04/03/2024 djs Updated code to use psftp instead of ftp.
|
||||
|
||||
Properties:
|
||||
|
||||
@ -35,9 +36,10 @@ $INSERT RLIST_EQUATES
|
||||
$INSERT SAP_COMM_LOG_EQUATES
|
||||
$INSERT LOGICAL
|
||||
|
||||
Equ CRCRLF$ TO \0D0D0A\
|
||||
Equ CRLF$ TO \0D0A\
|
||||
Equ TAB$ TO \09\
|
||||
Equ CRCRLF$ TO \0D0D0A\
|
||||
Equ CRLF$ TO \0D0A\
|
||||
Equ LF$ TO \0A\
|
||||
Equ TAB$ TO \09\
|
||||
|
||||
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\ScrapIn'
|
||||
LogDate = Oconv(Date(), 'D4/')
|
||||
@ -55,7 +57,6 @@ objSAPCreateLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$
|
||||
Main:
|
||||
|
||||
RepoID = ''
|
||||
//SAPEnviron = 'PRD' ;* Production
|
||||
SAPEnviron = Environment_Services('GetSAPPath')
|
||||
|
||||
BEGIN CASE
|
||||
@ -82,19 +83,11 @@ Main:
|
||||
RETURN
|
||||
END CASE
|
||||
|
||||
BaseFromSAPScript = 'open ':FTPServerIP:CRLF$
|
||||
BaseFromSAPScript := 'user':CRLF$
|
||||
BaseFromSAPScript := FTPUser:CRLF$
|
||||
BaseFromSAPScript := FTPPassWord:CRLF$
|
||||
BaseFromSAPScript := 'lcd ':TransFilePathIn:CRLF$ ;* Change local directory to C:\FTP_IN
|
||||
BaseFromSAPScript = 'lcd ':TransFilePathIn:CRLF$ ;* Change local directory to C:\FTP_IN
|
||||
|
||||
FromSAPScriptName = FTPScriptPath:'FromSAP.txt'
|
||||
|
||||
BaseToSAPScript = 'open ':FTPServerIP:CRLF$
|
||||
BaseToSAPScript := 'user':CRLF$
|
||||
BaseToSAPScript := FTPUser:CRLF$
|
||||
BaseToSAPScript := FTPPassword:CRLF$
|
||||
BaseToSAPScript := 'lcd ':TransFilePathOut:CRLF$ ;* Change local directory to C:\FTP_OUT
|
||||
BaseToSAPScript = 'lcd ':TransFilePathOut:CRLF$ ;* Change local directory to C:\FTP_OUT
|
||||
|
||||
ToSAPScriptName = FTPScriptPath:'ToSAP.txt'
|
||||
|
||||
@ -350,8 +343,10 @@ SendReconcile:
|
||||
StartTime = Time()
|
||||
|
||||
stat = "VAR"
|
||||
SRP_Run_Command("ftp -i -n -s:" : Environment_Services('GetFTPRootPath') : "\ToSAP.scr", stat, '', '')
|
||||
|
||||
|
||||
FTPCommand = "psftp ":FTPUser:"@":FTPServerIP:" -pw ":FTPPassword:" -b ":Environment_Services('GetFTPRootPath') : "\ToSAP.scr":" -batch"
|
||||
SRP_Run_Command(FTPCommand, stat, '', '')
|
||||
|
||||
StopTime = Time()
|
||||
|
||||
IF StopTime - StartTime > 30 THEN
|
||||
@ -558,9 +553,12 @@ GetInbound:
|
||||
|
||||
OSREAD FileIn FROM InboundPath:FileName THEN
|
||||
|
||||
OrigFileIn = FileIn
|
||||
SWAP LF$ WITH CRLF$ IN OrigFileIn
|
||||
|
||||
/************************ Log inbound file **************************/
|
||||
RepoDir = FTPRootPath : '\FTP_IN_REPOSITORY\ProdOrdRel\':FileName
|
||||
OSWrite FileIn on RepoDir
|
||||
OSWrite OrigFileIn on RepoDir
|
||||
/********************************************************************/
|
||||
|
||||
IF TransLogOn = 1 THEN
|
||||
@ -569,9 +567,10 @@ GetInbound:
|
||||
GOSUB LogTrans ;* Added 12/12/2011 JCH for transaction logging
|
||||
END
|
||||
|
||||
SWAP TAB$ WITH @VM IN FileIn
|
||||
SWAP '|' WITH @VM IN FileIn ;* Incorrect delimiter
|
||||
SWAP TAB$ WITH @VM IN FileIn
|
||||
SWAP '|' WITH @VM IN FileIn ;* Incorrect delimiter
|
||||
SWAP CRLF$ WITH @FM IN FileIn
|
||||
SWAP LF$ WITH @FM IN FileIn
|
||||
|
||||
LOOP
|
||||
LastChar = FileIn[-1,1]
|
||||
@ -632,9 +631,12 @@ GetInbound:
|
||||
|
||||
OSREAD FileIn FROM InboundPath:FileName THEN
|
||||
|
||||
OrigFileIn = FileIn
|
||||
SWAP LF$ WITH CRLF$ IN OrigFileIn
|
||||
|
||||
/************************ Log inbound file **************************/
|
||||
RepoDir = FTPRootPath : '\FTP_IN_REPOSITORY\Batch\':FileName
|
||||
OSWrite FileIn on RepoDir
|
||||
RepoDir = FTPRootPath : '\FTP_IN_REPOSITORY\Batch\':FileName
|
||||
OSWrite OrigFileIn on RepoDir
|
||||
/********************************************************************/
|
||||
|
||||
IF TransLogOn = 1 THEN
|
||||
@ -643,8 +645,9 @@ GetInbound:
|
||||
GOSUB LogTrans ;* Added 12/12/2011 JCH for transaction logging
|
||||
END
|
||||
|
||||
SWAP TAB$ WITH @VM IN FileIn
|
||||
SWAP TAB$ WITH @VM IN FileIn
|
||||
SWAP CRCRLF$ WITH @FM IN FileIn
|
||||
SWAP LF$ WITH @FM IN FileIn
|
||||
|
||||
LOOP
|
||||
LastChar = FileIn[-1,1]
|
||||
@ -693,15 +696,17 @@ GetInbound:
|
||||
StartTime = Time()
|
||||
OSREAD FileIn FROM InboundPath:FileName THEN
|
||||
|
||||
OrigFileIn = FileIn
|
||||
SWAP LF$ WITH CRLF$ IN OrigFileIn
|
||||
/************************ Log inbound file **************************/
|
||||
RepoDir = FTPRootPath : '\FTP_IN_REPOSITORY\ShipRel\':FileName
|
||||
OSWrite FileIn on RepoDir
|
||||
OSWrite OrigFileIn on RepoDir
|
||||
/********************************************************************/
|
||||
|
||||
OrigFileIn = FileIn
|
||||
SWAP TAB$ WITH @VM IN FileIn
|
||||
SWAP TAB$ WITH @VM IN FileIn
|
||||
SWAP CRCRLF$ WITH @FM IN FileIn
|
||||
SWAP CRLF$ WITH @FM IN FileIn
|
||||
SWAP CRLF$ WITH @FM IN FileIn
|
||||
SWAP LF$ WITH @FM IN FileIn
|
||||
|
||||
LOOP
|
||||
LastChar = FileIn[-1,1]
|
||||
@ -975,7 +980,7 @@ RETURN
|
||||
* * * * * * *
|
||||
SendRecord:
|
||||
* * * * * * *
|
||||
|
||||
|
||||
GOSUB DirNextSeq
|
||||
|
||||
IF ErrorMsg NE '' THEN RETURN
|
||||
@ -1018,7 +1023,10 @@ SendRecord:
|
||||
StartTime = Time()
|
||||
DELETE Buffer,TxSeqNo ELSE Null
|
||||
Stat = 'VAR'
|
||||
SRP_Run_Command('ftp -i -n -s:' : ToSAPScriptName, Stat, '', '')
|
||||
|
||||
FTPCommand = "psftp ":FTPUser:"@":FTPServerIP:" -pw ":FTPPassword:" -b ":ToSAPScriptName:" -batch"
|
||||
SRP_Run_Command(FTPCommand, stat, '', '')
|
||||
|
||||
StopTime = Time()
|
||||
ClearFlag = 1
|
||||
OSDelete DosTable ;* Removes table from C: drive
|
||||
@ -1045,9 +1053,11 @@ ReadInbound:
|
||||
|
||||
StartTime = Time()
|
||||
|
||||
stat = "VAR"
|
||||
SRP_Run_Command("ftp -i -n -s:":FromSAPScriptName, stat, '', '')
|
||||
|
||||
stat = "VAR"
|
||||
|
||||
FTPCommand = "psftp ":FTPUser:"@":FTPServerIP:" -pw ":FTPPassword:" -b ":FromSAPScriptName:" -batch"
|
||||
SRP_Run_Command(FTPCommand, stat, '', '')
|
||||
|
||||
StopTime = Time()
|
||||
|
||||
IF StopTime - StartTime > 60 Then
|
||||
@ -1070,7 +1080,10 @@ ReadInbound:
|
||||
StartTime = Time()
|
||||
|
||||
stat = "VAR"
|
||||
SRP_Run_Command("ftp -i -n -s:":FromSAPScriptName, stat, '', '')
|
||||
|
||||
FTPCommand = "psftp ":FTPUser:"@":FTPServerIP:" -pw ":FTPPassword:" -b ":FromSAPScriptName:" -batch"
|
||||
SRP_Run_Command(FTPCommand, stat, '', '')
|
||||
|
||||
StopTime = Time()
|
||||
|
||||
IF StopTime - StartTime > 60 Then
|
||||
@ -1089,10 +1102,12 @@ ReadInbound:
|
||||
OSWrite FromSAPScript ON FromSAPScriptName
|
||||
|
||||
StartTime = Time()
|
||||
|
||||
|
||||
stat = "VAR"
|
||||
SRP_Run_Command("ftp -i -n -s:":FromSAPScriptName, stat, '', '')
|
||||
|
||||
|
||||
FTPCommand = "psftp ":FTPUser:"@":FTPServerIP:" -pw ":FTPPassword:" -b ":FromSAPScriptName:" -batch"
|
||||
SRP_Run_Command(FTPCommand, stat, '', '')
|
||||
|
||||
StopTime = Time()
|
||||
|
||||
IF StopTime - StartTime > 60 Then
|
||||
@ -1120,8 +1135,10 @@ ClearInbound:
|
||||
StartTime = Time()
|
||||
|
||||
stat = "VAR"
|
||||
SRP_Run_Command("ftp -i -n -s:":FromSAPScriptName, stat, '', '')
|
||||
|
||||
|
||||
FTPCommand = "psftp ":FTPUser:"@":FTPServerIP:" -pw ":FTPPassword:" -b ":FromSAPScriptName:" -batch"
|
||||
SRP_Run_Command(FTPCommand, stat, '', '')
|
||||
|
||||
StopTime = Time()
|
||||
|
||||
IF StopTime - StartTime > 180 THEN
|
||||
@ -1150,8 +1167,10 @@ DirNextSeq:
|
||||
StartTime = Time()
|
||||
|
||||
stat = "VAR"
|
||||
SRP_Run_Command("ftp -i -n -s:":ToSAPScriptName, stat, '', '')
|
||||
|
||||
|
||||
FTPCommand = "psftp ":FTPUser:"@":FTPServerIP:" -pw ":FTPPassword:" -b ":ToSAPScriptName:" -batch"
|
||||
SRP_Run_Command(FTPCommand, stat, '', '')
|
||||
|
||||
StopTime = Time()
|
||||
|
||||
IF StopTime - StartTime > 30 THEN
|
||||
@ -1224,5 +1243,3 @@ LogTrans:
|
||||
RETURN
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user