How to Trap error being set in JDE from C?

K J A

Member
Objective: To Call BSFNs from External application and trap errors.

I have been successful in calling a business function from a external application - 'C'.

Say JDE Form - has an Item Number and I enter an invalid Item Number. It results in an Error which is then passed back to the Form.

I would want to display the same kind of Error message on my external applications when i call the BSFNs.

I use jdecallobject, with the Bhvrcom created by jdeCreateBusinessFuncParms.

KJA

Demo Jr. VC 6.0
 
I know this isn't the cleanest way to do this, so if you find a better way, let me know...
As an example, we needed to track when a Quantity Not available warning happened and mark a grid cell as a Deployment Risk. Within the Edit Line Data Structure for B4200311, there are some Generic parameters that are not used, sort of like User Defined Fields.
I altered the Edit Line Code so that when this warning was being set and mapped directly back to the Grid Cell, it also loaded the Generic parameter with a '1' so that the application would know this was a deployment risk and is stored in the SO14 value on the F4211. When you go back into the order, it reads that and knows it was a deployment risk when ordered. If you change the quantity, it will recheck.
So, in short, you need to return something through the business function. At least that's the way I did it.
 
I am able to retrieve the error message that is set in the DS. ex.

/*************** sample code *********/
/* Declaration of environment variables */
char szEnv[11] = "DEMOB73";
char szUser[11] = "DEMO";
char szPwd[11] = "";

/* Initialize Environment Handle */
if ((rcode = JDB_InitEnvOvr(&hEnv, szEnv, szUser, szPwd)) != JDEDB_PASSED)
{
m_Message.SetWindowText("JDB_InitEnvOvr failed");
return (0);
}

/* Initialize User */
if ((rcode = JDB_InitUser(hEnv, &hUser, NULL, JDEDB_COMMIT_AUTO)) != JDEDB_PASSED )
{
m_Message.SetWindowText("JDB_InitUser failed");
return (0);
}


jdeCreateBusinessFunctionParms(hUser, &lpBhvrCom,(LPVOID*) &lpVoid);

****************************** sample code ********
DSD4001040 dsGetItem ;

memset(&dsGetItem,0,sizeof(DSD4001040));

ParseNumericString(&dsGetItem.mnShortItemNumber,(char *)(const char *)ITM);

jdeCallObject("GetItemMasterDescUOM", (LPFNBHVR) NULL,
lpBhvrCom, lpVoid, (LPVOID) &dsGetItem,
(CALLMAP *) NULL, NULL,
(char *) NULL, (char *) NULL, (int) 0);

m_2ND.SetWindowText(dsGetItem.szSecondItemNumber);
m_3RD.SetWindowText(dsGetItem.szThirdItemNumber);


*****************************

in the above code the dsGetItem.szErrorMessageID has value "0267" on error.

I was wondering when there are cascading Business function which set jdeSetGBRError...and the CALLED Business function just returns ER_ERROR. Would want to trap all the errors that is set in any level of Business function back to JDE.
 
Back
Top