Read Multiple Media object for an Item

Kishore03

Active Member
HI,

I have attach two Media objects for an item in item master,one is in word document and other is in rtf format.I need to print both the Media object content in a batch .I have tried GT4101 but from this system function i can print only one MO not multiple.So how is possible to print Multiple MO for an Item in a batch program?

Regards
Kishore
 
You can't include NON TEXT media attachments in UBE standard output. You'll have to use BI Publisher for that.

EDIT: I don't think you can pull more than the first text attachment either using standard tools. You'll have to roll a bsfn for that I believe.
 
Yes, you can get images ... little complicated but doable. I'd like to hear though if anyone has accomplished the same with word docs.
For Media Object files though you would have to store the Media Object files as other than OLE types (to avoid the encryption) and also determine the location of the document and pass the filespec (path+name) into the UBE XML Output so that BI Pub knew where there were.
 
Last edited:
Couldn't you 'try' and loop through F00165 for the Item key and call a section for each record? Save the key and media object path url etc
Add this path to the RV output so it appears in the XML

Then use BI and the repeated XML section to hopefully show the media object attachments....?
 
That's essentially what I was saying above John with a couple caveats.

1. I don't know if you can dynamically embed a word/rtf document into a BI template.
2. The Media Object Type would need to be a 5
 
This is what I have done about 10 years ago on XE release in order to print images and others stuff on a JDE report.

1)at the end of the report retrieve the job number and build the final pdf path
2)Call an external function (I developed a java program) and pass the pdf path and the files to merge/print
3)inside the external program parse the pdf do all manipulation
 
1. I don't know if you can dynamically embed a word/rtf document into a BI template.

This is where the embedded BI publisher that is used with JDE falls down. So you can dynamically append PDF documents in the full version of BI Publisher that is part of OBIEE but not the embedded version unless you want to do some fairly serious hacking (which I have seen done at one site).
 
Gentlemen,
How do I read multiple TEXT attachments under GT4201A (F00165)?

I can only read the first attachment with GT4201A Media Objects.
This function doesn't have the option/parameter for me to specify the attachment name to read.

I am just starting out with JDE (1 week old), and I hope you can shed some light my way.

Thank you!
 
Gentlemen,
How do I read multiple TEXT attachments under GT4201A (F00165)?
Howdy, since this thread was posted there are more capabilities and technologies that might serve your purpose properly. Can you tell us which tools you're using where you need to loop through the media obj?

Also would be helpful to know which version of JDE you're on, which tools release, etc.
 
I am using E920 JDE version (trying to create a report to display the Sales Orders and the text within the text attachments).

1. I only have the JDE standard tool/report writing to use (no 3rd party tools).

2. Within the “do section” of a columnar section of a report, I can use Media Objects (GT4201A, [get text], text, parm1, parm2, parm3) to read the text inside the first attachment, but I do not know how to loop through to read the text inside the 2nd text attachment.

I am pretty new to JDE, so I hope I have provided enough info for you to see what I am trying to achieve.

Thanks again!
 
I'm taking a look at a report I know. I know that GT4201A template doesn't let you see the ordinal of the media obj attachment and only gets first attachment like you see. What I'm not sure of is, in 9.2, if it's possible to call the media obj rest API which does expose the ordinal and let you loop thru, or if you might need to do a fetch/while loop from f00165 to loop thru there, and decode the blobs. If someone else knows this for sure, please pipe up :D I'm new-ish to 9.2
 
I don't like the idea of storing a modifiable document as a MO and world prefer to store PDFs.

If it has to be Word docs then I think you will have a bit of work to do. Probably write an API that can receive a word doc and invoke Word to print it. That could be written in any tool that can access MS APIs
 
I'm taking a look at a report I know. I know that GT4201A template doesn't let you see the ordinal of the media obj attachment and only gets first attachment like you see. What I'm not sure of is, in 9.2, if it's possible to call the media obj rest API which does expose the ordinal and let you loop thru, or if you might need to do a fetch/while loop from f00165 to loop thru there, and decode the blobs. If someone else knows this for sure, please pipe up :D I'm new-ish to 9.2
There are several BSFN C APIs that can iterate through the list of Media Objects and do whatever you want with them (read, copy, extract, etc.).
 
There are several BSFN C APIs that can iterate through the list of Media Objects and do whatever you want with them (read, copy, extract, etc.).
Will you specify the name of the BSFC that I can look into?

Thank you all for helping!!
 
Look at the various APIs defined in \system\JDEKPRTO.h for working with media objects. One that I have used to iterate all the media objects for a given MO Struct/Key and then do something with them depending on media object type is jdeGTGet_AllMOType.

Here is some example code using the API listed above. This code doesn't really do what you are looking for but it may give you an idea of how to use the API.

Code:
/**************************************************************************
 *   Function: I5642018_CheckMediaObject
 *
 *      Notes:
            ATI#597
            API JDEGTAllocFetch no longer appears to work at all.  Will completely re-write this for 9.0

            Logic:
            - Check to See if there are any attachments of any type
            - If there is only one attachment and it is a empty/blank text attachments, then delete it.
            - If there is an empty/blank text attachment, but there are other non-text attachments DONT delete
                anything.
 *
 *    Returns:
 *
 * Parameters:
 **************************************************************************/
static ID I5642018_CheckMediaObject(LPBHVRCOM lpBhvrCom, LPVOID lpVoid, HUSER hUser, LPD5642018_CACHE_PCA lpCachePCA) 
{
    /************************************************************************
     *  Variable declarations
     ************************************************************************/
    ID idReturn = ER_SUCCESS;
    JDEDB_RESULT jdedbResult = JDEDB_FAILED;
    DSGT5642PCAA dsMOKey = {0};
    LPMODATA pMOData = (LPMODATA)NULL;
    long i, nTotalRec=0;
    BOOL bTextAttachmentsFound = FALSE;

    /************************************************************************
     * Main Processing
     ************************************************************************/
    
    /* check to see if any attachments exist */
    jdeStrncpy(dsMOKey.szCompanyKeyOrderNo, lpCachePCA->szCompanyKeyOrderNo,    DIM(dsMOKey.szCompanyKeyOrderNo)-1);
    MathCopy(&dsMOKey.mnDocumentOrderInvoiceE, &lpCachePCA->mnDocumentOrderInvoiceE );
    jdeStrncpy(dsMOKey.szOrderType, lpCachePCA->szOrderType, DIM(dsMOKey.szOrderType)-1);
    MathCopy(&dsMOKey.mnIdentifierShortItem, &lpCachePCA->mnIdentifierShortItem );
    jdeStrncpy(dsMOKey.szReasonCode, lpCachePCA->szReasonCode, DIM(dsMOKey.szReasonCode)-1);

    jdedbResult = jdeGTGet_AllMOType(B5642018_MEDIA_OBJECT_DS, (void *)&dsMOKey, &pMOData, &nTotalRec);

    if(jdedbResult != JDEDB_PASSED || !pMOData || nTotalRec <= 0)
        goto FunctionCleanUp;


    /* check for a blank text attachments */
    for(i = 0; i < nTotalRec; i++)
    {
        LPMODATA pMODataTmp=(pMOData + i), pMODataText=(LPMODATA)NULL;
        long j, nTotalRecText=0;


        if(pMODataTmp->nMOType != OBJ_RTFTEXT)
            continue;

        /* if we find at least one non-blank text attachment, no need to go any further */
        jdedbResult = jdeGTGet_GenericText(
            B5642018_MEDIA_OBJECT_DS, (void *)&dsMOKey, pMODataTmp->nSeq, &pMODataText, &nTotalRecText);

        if(jdedbResult != JDEDB_PASSED || !pMODataText)
        {
            if(pMODataText)
                jdeGTFreeMOData(pMODataText, nTotalRecText);

            goto FunctionCleanUp;
        }

        for(j = 0; j < nTotalRecText; j++)
        {
            if( !IsStringBlank((pMODataText+j)->pData) )
            {
                jdeGTFreeMOData(pMODataText, nTotalRecText);
                goto FunctionCleanUp;
            }
        }

        jdeGTFreeMOData(pMODataText, nTotalRecText);
        bTextAttachmentsFound = TRUE;
    }


    /* if this point is reached it means that any text attachments found were blank, delete all text attachments */
    if(bTextAttachmentsFound)
    {
        jdeGTDelete_AllText(B5642018_MEDIA_OBJECT_DS, (void *)&dsMOKey);
    }
    
    /************************************************************************
     * Function Clean Up
     ************************************************************************/
FunctionCleanUp:

    if(pMOData)
        jdeGTFreeMOData(pMOData, nTotalRec);

    return idReturn;
}

There are probably newer/different ones. There seems to be several different groups of Media Object APIs. I usually just look for one that looks promising and then search for it in pristine code to get an idea of how to use and what it does.
 
Back
Top