Adding an attachment from UBE

patcc

Well Known Member
I am actually working on a functionality whereby I need to add an attachment to an item in P4101 via a custom UBE.

I tried to used the business function B0500047 but it is not working. I only need to add plain text as attachment.

Does anyone know how this can be done?

Or do you know the exact mappings for the BSFN B0500047?

Thanks
 
Patcc,

Here are code snipits from a bsfn we wrote to convert/add text to print messages. With a few tweaks it can be modified to fit your needs. Just use the correct GT structure and load the appropriate key.

Let me know if you need any help with it.

Good luck and please let me know if you were able touse this.


Header file ...

#ifndef DATASTRUCTURE_D594016
#define DATASTRUCTURE_D594016

typedef struct tagDSD594016
{
JCHAR szUserId[11];
JDEDATE jdDateUpdated;
MATH_NUMERIC mnTimeOfDay;
JCHAR szPrintMessage1[11];
JCHAR cErrorCode;
JCHAR szLanguagePreference[3];
JCHAR szMediaObjectText[30001];
} DSD594016, *LPDSD594016;

#define IDERRszUserId_1 1L
#define IDERRjdDateUpdated_2 2L
#define IDERRmnTimeOfDay_3 3L
#define IDERRszPrintMessage1_5 5L
#define IDERRcErrorCode_6 6L
#define IDERRszLanguagePreference_9 9L
#define IDERRszMediaObjectText_10 10L

#endif

/*****************************************
* TYPEDEF for Data Structure
* Template Name:
* Template ID: GT4016A
* Generated: Wed Jan 31 16:25:01 2007
*
* DO NOT EDIT THE FOLLOWING TYPEDEF
* To make modifications, use the OneWorld Data Structure
* Tool to Generate a revised version, and paste from
* the clipboard.
*
**************************************/

#ifndef DATASTRUCTURE_GT4016A
#define DATASTRUCTURE_GT4016A

typedef struct tagDSGT4016A
{
JCHAR szPrintmessage1[11];
JCHAR szLanguagepreference[3];
} DSGT4016A, *LPDSGT4016A;

#define IDERRszPrintmessage1_1 1L
#define IDERRszLanguagepreference_2 2L

#endif

Function ..

/**************************************************************************
* Business Function: ConvertPrintMessageText
*
* Description: Convert Print Message Text
*
* Parameters:
* LPBHVRCOM lpBhvrCom Business Function Communications
* LPVOID lpVoid Void Parameter - DO NOT USE!
* LPDSD594 lpDS Parameter Data Structure Pointer
*
*************************************************************************/

JDEBFRTN (ID) JDEBFWINAPI ConvertPrintMessageText (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD594016 lpDS)

{
/************************************************************************
* Variable declarations
************************************************************************/
JDEDB_RESULT JDBReturn = JDEDB_PASSED;
HUSER hUser;
long lTotalRec = 0;

/************************************************************************
* Declare structures
************************************************************************/
DSGT4016A dsGT4016AKey;

/************************************************************************
* Declare pointers
************************************************************************/
MODATA MOData;

/************************************************************************
* Check for NULL pointers
************************************************************************/
if ((lpBhvrCom == (LPBHVRCOM) NULL) ||
(lpVoid == (LPVOID) NULL) ||
(lpDS == (LPDSD594016) NULL))
{
jdeErrorSet (lpBhvrCom, lpVoid, (ID) 0, _J("4363"), (LPVOID) NULL);
return ER_ERROR;
}

/***********************************************************************
* Initialize Behavior
***********************************************************************/

JDBReturn = JDB_InitBhvr (lpBhvrCom,&hUser,(JCHAR *) NULL,JDEDB_COMMIT_AUTO);
if (JDBReturn != JDEDB_PASSED)
{
jdeErrorSet (lpBhvrCom, lpVoid, (ID) 0, _J("4363"), (LPVOID) NULL);
return ER_ERROR;
}

/************************************************************************
* Set pointers
************************************************************************/

/************************************************************************
* Main Processing
************************************************************************/

lpDS->cErrorCode = _J(' ');

/* -------------------------------------- */
/* Load Key to Media Object Structure */
/* -------------------------------------- */

memset ((void *)(&dsGT4016AKey), (int)(_J('\0')), sizeof(DSGT4016A));
jdeStrncpy (dsGT4016AKey.szPrintmessage1, lpDS->szPrintMessage1, DIM(dsGT4016AKey.szPrintmessage1));
jdeStrncpy (dsGT4016AKey.szLanguagepreference, lpDS->szLanguagePreference, DIM(dsGT4016AKey.szLanguagepreference));

/* -------------------------------------- */
/* Write New Text Record */
/* -------------------------------------- */

lTotalRec = 1;

MOData.nSeq = 1;
MOData.nMOType = OBJ_RTFTEXT;
MOData.jdDate = lpDS->jdDateUpdated;
MOData.mnTime = lpDS->mnTimeOfDay;
MOData.bRTFData = TRUE;

jdeStrncpy (MOData.szUser, lpDS->szUserId, DIM(MOData.szUser));
jdeStrncpy (MOData.szItemName, _J("Text1"), DIM(MOData.szItemName));
MOData.pData = lpDS->szMediaObjectText;

JDBReturn = jdeGTAddUpdate_Text (_J("GT4016A"), &dsGT4016AKey, &MOData, lTotalRec);

if (JDBReturn != JDEDB_PASSED)
{
lpDS->cErrorCode = _J('1');
}

/************************************************************************
* Function Clean Up
************************************************************************/

JDB_FreeBhvr (hUser);
return (ER_SUCCESS);
}
 
Back
Top