Get attachments

petrcat

Member
Hi,


I need to get the attachments informed into SKU's. I have found the GT41XX functions. Which this functions I can't get the text attachemnts. I need to get the attachments, but I have more than 1 for every SKU and this methods don't allow to filter by GDGTITNM field. Any idea?


Thank you

Edit:

I'm not working with C. I use JDE 9.8
 
Last edited:
We offer a commercial solution to this requirement, if you are interested. Just e-mail me directly for the details.
 
You didn't list your release. There are quite a few different JDE C APIs to do basically anything you want with attachments including iterating over, and retrieving the contents for multiple attachments.

If you are trying to work with media objects from a third party application outside of the JDE toolset then the everestsoftint.com commercial product might be a viable solution - we have it here at our organization and we use it to export text attachments to a non-jde db/application in a nightly job. If you are working with media objects within the JDE toolset then I see no point in purchasing the everestsoftint.com solution - you can probably do anything you need to do within the toolset using the existing APIs and it will actually be a lot simpler.
 
If you use C-API, you can definitely do this as indicated by Brian. You may be able to do this using ER code as well. Try doing a Open/Select/Fetch from F00165 in ER code, and iterating over it and using the <Get Text> action of the Media Objects system function.
 
Look in C++ for this baby and see how you can make use of it
JDEGTAllocFetchText

B0500725 has a module Mail Merge Media Object Get Text. Generic DSTR, make the key up and get back up to 30000 long text field



JDEGTAllocFetchText will retrieve the text data from in Media Object Table, F00165, exists based on GT Structure Name and generic text key.

Syntax

JDERTN(LPSTR) JDEWINAPI JDEGTAllocFetchText(LPSTR pObjectName,

LPVOID pKey,

BOOL bConvert)


Parameters

Parameter
Notes
Usage

pObjectName
Input
GT Structure Name

pKey
Input
Pointer to GT Structure with data loaded.

bConvert
Input
TRUE = Convert RTF text to plain Text

FALSE = leave RTF text as is.


Return Value

Memory allocated string.

Example

DSABGT dsAbGT = {0};

LPSTR lpText = NULL;





ParseNumericString(&dsAbGT.mnAddressNumber, “1”);



lpText = JDEGTAllocFetchText( “ABGT”, &dsAbGT, TRUE);



if (lpText)

{

JDEGTTextFree(lpText);

}

Additional Notes

1. FreeBuildStrFromDstmplName() must be called to free the memory allocated by AllocBuildStrFromDstmplName().

2. JDEGTFree() must be called to free LPF0016D memory allocated by JDEGTAllocFetch().

3. JDETextFree() must be called to free the text memory allocated by JDEGTAllocFetchText().



See Also

1. JDEGTAllocFetch()

2. JDEGTFree()

3. JDEGTExists()

4. JDEGTAdd()

5. JDEGTAddRecord()

6. JDEGTUpdate()

7. JDEGTDelete()

8. JDEGTAllocFetchText()

9. JDEGTTextFree()
 
I just spent some time looking at B0500725 "MailMegeMOGetText" (nice typo in the BSFN name...) and I simply can't get it to work.

I setup a call with szMediaObjectName = 'GT4211A' and szMOKey = '32158|SO|00001|1.000' but my debug log shows that szMOKey is not being passed or parsed correctly. The resulting SQL query looks like:

WHERE ( GDOBNM = 'GT4211A' AND GDTXKY = '0|||0' AND GDGTMOTYPE = 0 )

And the call fails with return code 2.

I'm stumped on this, having read the documentation for JDE API on Toolset 8.98 - and looking at the source code in B0500725, I would expect this to work. [UPDATE: I just searched Oracle Support site, and found that the JDE API reference I have for 8.98 is still valid for Tools 9.1]

Any thoughts?
 
Last edited:
If you are just trying to get text out of an attachment try using GetGenericTextNameEx instead. This is for a work order but concept would be the same:

Code:
	DSGT4801	dsMOKey={0};
	JCHAR	*pszMOText = (JCHAR *)NULL;

	MathCopy(&dsMOKey.mnWorkOrderNumber,	&lpDS->mnWorkOrderNumber);
	jdeStrncpy(dsMOKey.szWorkOrderType,		lpDS->szWorkOrderType, DIM(dsMOKey.szWorkOrderType)-1);
	jdeStrcpy(dsMOKey.szWorkOrderSuffix,	_J(""));
	dsMOKey.cRecordtype							= _J('A');


	pszMOText = GetGenericTextNameEx(lpBhvrCom->hEnv, B5648101_MO_OBJECT_WORKORDER, (void *)&dsMOKey, TRUE, TRUE);

	if(pszMOText)
	{
		if(!IsStringBlank(pszMOText))
		{
			lpDS->cHasTextAttachment = _J('1');
			jdeStrncpy(lpDS->szTextAttachment, pszMOText, DIM(lpDS->szTextAttachment)-1);
		}
		jdeTextFree(pszMOText);
	}
 
Also, if you can post your actual code it might help - not all of it, just the relevant portion, namely szMediaObjectName, szMOKey and MailMegeMOGetText.
 
Just getting back from Collaborate, where I learned about the AIS server. If you have one of those, there's an HTTP + JSON based API that's available for working with JDE Media Objects.

Might be easier than hacking something together in C. Just a suggestion.
 
Back
Top