Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: Version E9.2 - Programmatically attach file based media object

  1. #1

    Version E9.2 - Programmatically attach file based media object

    We plan to use BI Publisher to parse individual invoices into single pdfs and place them on a network share. I wrote a UBE that reads that network share and loops thru the invoice pdf files and sends emails out to customers.

    I need that UBE to attach the pdf to the AR records in F03B11. Has anyone done anything like this? I could use some guidance on how to go about this. I think I may need some C code but that is outside of my skill set....

    Thanks.

    Stan

  2. #2
    Member craig_welton's Avatar
    Join Date
    Oct 2000
    Location
    Litchfield, CT
    Posts
    950
    You can create the F00165 records that point to the files in a MO Queue. Check out existing records that are created when you manually do an attachment. The important bit is knowing the key to the document you need to link to. If your filename has that (Company,Doc Typ,Order#), you can parse that out and create the piped string for the GDTXKY column of the GT03B11 attachment.

    Craig
    Craig Welton
    PatWel Group Inc.
    http://www.patwel.com
    Home of the FREE JDE Object Browser, JDETrace and NERDup Tools

    E1 9.0 8.98.4.2 Wintel SQL 2008
    E1 9.2 9.2.1.4 iSeries

  3. #3
    Thanks for the reply Craig.

    The problem is that at 9.2 we are set to store the attachments in the database. When you do that, 2 new files get into the mix, F98MOQUE and F98MODAT, the file name value in F00165 (GDGTFILENM) seems to just be a pointer to the F98MODAT record as a file at that location does not exist. My understanding is that the actual attachment gets encapsulated into a blob field in F98MODAT - field is ZUTXFT.

    Oracle tells me I need a C BSFN that would serve as a "wrapper" to an API that I can call from a UBE. Does this make sense?

    If so, unfortunately, I can't write C code.

    Thanks. Stan

  4. #4
    Senior Member DSauve's Avatar
    Join Date
    Nov 2000
    Location
    Spokane, WA
    Posts
    1,221
    Stan,

    There is an option to store attachments on the file system instead of the database. We also do a type of file attachment in an automated way, and this was one of the driving decisions for us to keep our MO's on a file system instead of the database. Plus, database storage for us is more expensive than on a file system. But this is a business decision that each JDE customer has to make. My 2 cents.
    Don Sauve
    Wagstaff, Inc.
    E1 9.1, Win2012 R2, Oracle 11.2.0.4, TR 9.1.5.3, WebLogic 12.1.3, BI Publisher
    Moving to: E1 9.2, Win2016, SQL Server 2016, TR 9.2.2.6, WebLogic 12.2.1, BI Publisher

  5. #5
    Hey Don. Thanks for the reply.

    I hear you about the option, I am not sure why our CNC made the change as I was never party to a conversation about it. I did see (on the Oracle) something about where it was not option prior to some level of E920, so perhaps we are or were at that level at some point. In any event, we're storing attachments in the database.

    Can someone advise me about the effort to create a "wrapper" C BSFN that would be callable from a UBE?

    Thanks again. Stan

  6. #6
    Member nkuebelbeck's Avatar
    Join Date
    Mar 2012
    Location
    Minnesota
    Posts
    528
    i've written some C to put date into F98MODAT (where the attachment blob is stored)

    sry for the formatting - this does not support large attachments that would use multiple F98MODAT records

    we've got a custom set of tables and bsfn's for attaching stuff from BI to records (mo attachments). Pretty slick.

    read the file into memory
    Code:
       pFile = jdeFopen(szFullFilePath, _J("rb"));   if (pFile==NULL){	      /*debug*/      jdeWriteLog(_J("B559800"), 0, _J("ERROR OPENING FILE"));      jdeWriteLog(_J("B559800"), 0, szFullFilePath);      jdeStrncpy(dsDE0022.szDescription, (const JCHAR *)(jdeRemoveLeadingAndTrailingSpaces(szFullFilePath)),         DIM(dsDE0022.szDescription));      jdeSetGBRErrorSubText(lpBhvrCom, lpVoid, 0, _J("Y55FOPEN"), &dsDE0022);	   idReturnCode = ER_ERROR;	   goto FunctionCleanup;	   }else{	   jdeFseek(pFile, 0, SEEK_END);                           // Jump to the end of the file	   lFilelen = jdeFtell(pFile);                             // Get the current byte offset in the file	   jdeFseek(pFile, 0, SEEK_SET);                           // Jump back to the beginning of the file	   pBuffer = (uchar *)jdeReAllocEx(pBuffer,lFilelen +1);   // Enough memory for file 	   jdeFread(pBuffer, 1, lFilelen, pFile);                  // Read in the entire file	      }
    
    /*the insert bit*/
    
       jdeStrcpy(dsDbRef.szTable, NID_F98MODAT);   dsDbRef.idInstance = 0;   jdeStrcpy(dsDbRef.szDict, NID_TXFT);   dsF98MODAT.zutxft.lMaxSize = MAX_BLOB_SIZE;   dsF98MODAT.zutxft.lSize = lFilelen;   dsF98MODAT.zutxft.lpValue = JDB_SetBLOBSize(hF98MODAT, dsDbRef, dsF98MODAT.zutxft.lSize);   memcpy(dsF98MODAT.zutxft.lpValue, (void *)pBuffer, dsF98MODAT.zutxft.lSize);      if (JDB_InsertTable(hF98MODAT, NID_F98MODAT, 0, &dsF98MODAT) != JDEDB_PASSED){      jdeStrncpy(dsDE0022.szDescription, (const JCHAR *)(_J("F98MODAT")),         DIM(dsDE0022.szDescription));      jdeSetGBRErrorSubText(lpBhvrCom, lpVoid, 0, _J("078F"), &dsDE0022);	   idReturnCode = ER_ERROR;	   goto FunctionCleanup;   }
    Last edited by nkuebelbeck; 09-14-2018 at 06:15 AM.
    Analyst/Developer
    E1: 9.2 | TR: 9.2.1.4 | JAS: WebLogic | ES: OS400
    DB: DB2 | WebDev Client: Win7Pro (64 bit), VS 2010

  7. #7
    Senior Member
    Join Date
    Mar 2004
    Location
    Fort Worth, Texas
    Posts
    1,503
    Just my opinion, but if you are going to use C code you might as well use the plethora of JDE media object C APIs for this. That way if Oracle changes the underlying implementation of how media objects are stored or your organizations makes a configuration change as to where they are stored (file system, db, etc.) your code should stay the same.
    Brian Oster
    Application Development Manager
    E1: 9.0 (TR9.1.5.1) / 9.2 (TR9.2.2.2)
    JAS/BSSV: Weblogic 12.1.2 / Weblogic 12.2
    ES: Win2008 / Win2016
    DB: MSSQL 2014 / 2016
    WebDev Client: Win7Pro / Win10Pro

  8. #8
    Member nkuebelbeck's Avatar
    Join Date
    Mar 2012
    Location
    Minnesota
    Posts
    528
    Quote Originally Posted by BOster View Post
    Just my opinion, but if you are going to use C code you might as well use the plethora of JDE media object C APIs for this. That way if Oracle changes the underlying implementation of how media objects are stored or your organizations makes a configuration change as to where they are stored (file system, db, etc.) your code should stay the same.
    at the time i rolled my own - there was no api for the in database storage.(we are on 9.2.1.4)

    E1: MOBJ: New Media Object APIs to Work with Attachments Stored in F98MODAT Table from Tools Release 9.2.1.6 (Doc ID 2301138.1)
    Analyst/Developer
    E1: 9.2 | TR: 9.2.1.4 | JAS: WebLogic | ES: OS400
    DB: DB2 | WebDev Client: Win7Pro (64 bit), VS 2010

  9. #9
    Senior Member
    Join Date
    Mar 2004
    Location
    Fort Worth, Texas
    Posts
    1,503
    Quote Originally Posted by nkuebelbeck View Post
    at the time i rolled my own - there was no api for the in database storage.(we are on 9.2.1.4)

    E1: MOBJ: New Media Object APIs to Work with Attachments Stored in F98MODAT Table from Tools Release 9.2.1.6 (Doc ID 2301138.1)
    Sorry, I meant this as more of a general comment, wasn't specifically criticizing you or what you did in the past. We all have to do things like this from time to time and better ways of doing things come along later.
    Brian Oster
    Application Development Manager
    E1: 9.0 (TR9.1.5.1) / 9.2 (TR9.2.2.2)
    JAS/BSSV: Weblogic 12.1.2 / Weblogic 12.2
    ES: Win2008 / Win2016
    DB: MSSQL 2014 / 2016
    WebDev Client: Win7Pro / Win10Pro

  10. #10
    Member nkuebelbeck's Avatar
    Join Date
    Mar 2012
    Location
    Minnesota
    Posts
    528
    Quote Originally Posted by BOster View Post
    Sorry, I meant this as more of a general comment, wasn't specifically criticizing you or what you did in the past. We all have to do things like this from time to time and better ways of doing things come along later.
    100% agree. I didn't take offense. I looked for the JDE api's for this stuff and it wasn't realeased. took no pleasure in learning about blobs and F98MODAT
    Analyst/Developer
    E1: 9.2 | TR: 9.2.1.4 | JAS: WebLogic | ES: OS400
    DB: DB2 | WebDev Client: Win7Pro (64 bit), VS 2010

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
The legal restrictions and terms of use applicable to this site are available here.
Use of this site signifies your agreement to the terms of use.
JDELIST is NOT affiliated with JD Edwards® & Company, Oracle or Peoplesoft. Contents of this site are neither endorsed nor approved by JD Edwards® & Company and, or Oracle.