Question about attaching PDF documents to Payment Vouchers (Media Objects)

mmateus

Active Member
Dear Sir/Madam,

We have an old legacy system which is used for our Invoice PDF documents. The business would like to get rid of this legacy system but they have in the region of 600000 PDF documents that they would like to keep. The payment vouchers (PV) are created and stored in JDE. The requirement is now to move these PDF documents to JDE (deployment server MO) and attach them to the PV's in JDE.

The question is whether or not this can be done where a UBE can be written using some business function (or another mechanism) that will attach a PDF document (the PV number is part of the PDF document name) to the matching PV in JDE. The other alternative is to do this manually but this would be very laborious given the amount of PDF documents that are needed to be moved/attached.

I hope it makes sense.

We are currently running JDE Apps 9.0 with TR 9.1.5.2 running on IBM i (V7R1).

Any recommendations or advise would be appreciated.

Thank you in advance for your assistance.

Kind regards,
Misael
 
Misael,

I've done similar using just a custom vbscript written outside of JDE's toolset.

Basically what it does is:
1. Loops on Input Directory to find files to attach.
2. File Names are parsed into multiple fields (such as Voucher #).
3. Key field value(s) from the Parsing are used to validate / locate a matching document in a JDE table
If no JDE Table matching entry found log it and skip to next file
4. Copy file from INPUT directory to OUTPUT directory (\\JDEDEPSVR\MEDIAOBJ\ACCOUNTING\VOUCHERS)
5. Create Type 5 F00165 entry pointing to OUTPUT directory
6. Delete Input File (or move it to archive location)
7. Loop to Next file in INPUT Directory

This runs daily attaching different types of documents that have been scanned into temporary network folders.

Here's a code fragment from the routine that creates the F00165 entry:

'Create F00165 entry
' 1. Enumerate existing objects to determine SEQ number value
' 2. check for Duplicate - if found then skip - already attached
' 2. If duplicate not found then insert new Type 5 object
sSQL = "SELECT NVL(MAX(GDMOSEQN),0) AS nSeqNo FROM " & msSchema & "DTA.F00165 "
sSQL = sSQL & "WHERE GDOBNM = '" & sType & "' AND GDTXKY = '" & sTXKY & "'"
rsF00165.Open sSQL, mdbConnection, 0, 3, 1
If rsF00165.EOF Then
nSeq = 1
Else
nSeq = cint(rsF00165.Fields("nSeqNo")) + 1
End If
rsF00165.Close
sSQL = "SELECT * FROM " & msSchema & "DTA.F00165 "
sSQL = sSQL & "WHERE GDOBNM = '" & sType & "' AND GDTXKY = '" & sTXKY & "' AND GDGTMOTYPE=5 AND LOWER(TRIM(GDGTFILENM)) = '" & LCase(sOutputFile) & "'"
rsF00165.Open sSQL, mdbConnection, 2, 2, 1
If rsF00165.EOF Then
With rsF00165
.AddNew
.Fields("GDOBNM") = sType
.Fields("GDTXKY") = sTXKY
.Fields("GDMOSEQN") = nSeq
.Fields("GDGTMOTYPE") = 5
.Fields("GDLNGP") = " "
.Fields("GDUSER") = "BATCHXTRAC"
.Fields("GDUPMJ") = mdDateJDE
.Fields("GDTDAY") = Hour(Now()) * 10000 + Minute(Now()) * 100 + Second(Now())
.Fields("GDGTITNM") = sDocInfo
.Fields("GDQUNAM") = " "
.Fields("GDGTFILENM") = sOutputFile
.Fields("GDGTFUTS1") = " "
.Fields("GDGTFUTS2") = " "
.Fields("GDGTFUTS3") = " "
.Fields("GDGTFUTS4") = " "
.Fields("GDGTFUTM1") = 0
.Fields("GDGTFUTM2") = 0
'.Fields("GDGTXFT") = blob field
.Update
End With
LogMessages " Added Media Object for " & sDocumentID & ", " & sLineNo & ", " & sDocInfo , "N",False,False,""
iFilesAttached = iFilesAttached + 1
Else
LogMessages " Media Object Already Exists for " & sDocumentID & ", " & sLineNo & ", " & sDocInfo , "N",False,False,""
iDuplicateMO = iDuplicateMO + 1
End If
 
Back
Top