B4800210 help for DD Errror Msg data item 3551.

Oliver

Oliver

Well Known Member
Hi lists,

Need some help from C bsfn gurus...

We would like to force P48013 (Work With Manufacturing Work Orders) to error when creating work orders for items that have no bill...

I have changed the DD Error message for data item 3551 (Bill of material does not exist...) from error level 2 to 1. Used eGenerator to deploy the change in PY. Creating work orders will now prompt with a hard error when the item has no BOM, but would still continue to create WO...

I made some change in bsfn B4800210, wherein

Original Code snippet...
<font class="small">Code:</font><hr /><pre>
{
/* no bill exists for item number */
if (lpdsInternal->cSuppressErrorMessages != _J('1'))
{
/* Error: 3551 - Bill of Material does not exist */
jdeErrorSet (lpdsInternal->lpBhvrCom, lpdsInternal->lpVoid,
IDERRszTypeOfBill_18, _J("3551"), (LPVOID)NULL);
}
lpdsInternal->cErrorCode = <font color="red">EDIT_WARNING</font>;
}
</pre><hr />

Changing it from "EDIT_WARNING" to "EDIT_ERROR" now works per test...

lpdsInternal->cErrorCode = <font color="blue">EDIT_ERROR</font>;


but I want to add additional logic to consider both Error Level codes 1 and 2 (in case we revert back and it would be neater solution). The issue i have is that its not working as per code below...anybody can help? I'm struggling to hook the debugger to break before the logic.

Thanks.

<font class="small">Code:</font><hr /><pre>
/**************************************************************************
* Function: IB4800210_VerifyBOMExists
*
* Notes: Verify that a Bill of Material (F3002) exists for the order
* entered. Call B3000550
*
* Returns: None
*
* Parameters: lpdsInternal - Pointer to Internal Structure
* lpdsWorkCache - Pointer to Work Cache Structure
* lpdsInput - Pointer to Edit Line Structure
**************************************************************************/
static void IB4800210_VerifyBOMExists(LPDSB4800210INTERNAL lpdsInternal,
LPDSB4800210WORKCACHE lpdsWorkCache,
LPDSDX4801E lpdsInput)
{
DSD3000550 dsB3000550;
<font color="blue"> DSD9200006 dsB9200005;</font> /* MODIFICATIONS */
BOOL bMultipleBillsExist = FALSE;
BOOL bBatchBillExists = FALSE;

lpdsInternal->idFieldID = (ID)0;

memset ((void *)(&dsB3000550), (int)(_J('\0')), sizeof(DSD3000550));
<font color="blue"> memset ((void *)(&dsB9200005), (int)(_J('\0')), sizeof(DSD9200006));</font> /* MODIFICATIONS */

jdeStrncpy((JCHAR *)(dsB3000550.szBranch),
(const JCHAR *)(lpdsInput->szBranchPlant),
DIM(dsB3000550.szBranch)-1);
MathCopy(&dsB3000550.mnItemNumber, &lpdsInput->mnShortItemNumber);
jdeStrncpy((JCHAR *)(dsB3000550.szTypeOfBill),
(const JCHAR *)(lpdsInput->szTypeOfBill),
DIM(dsB3000550.szTypeOfBill)-1);
MathCopy(&dsB3000550.mnRequestedQty, &lpdsWorkCache->mnConvertedQty);

/*
* Fetch F3002 record, set batch qty = converted qty if qty is not 0
*/
if (MathZeroTest(&lpdsWorkCache->mnConvertedQty) != 0)
{
jdeCallObject (_J("SelectBillOfMaterial"), NULL,
lpdsInternal->lpBhvrCom, lpdsInternal->lpVoid,
(LPVOID) &dsB3000550,
(CALLMAP *) NULL,
(int) 0, (JCHAR *) NULL, (JCHAR *) NULL, (int) 0);

if (dsB3000550.cRequestedQtyFound == _J('1'))
{
bBatchBillExists = TRUE;

jdeStrncpy((JCHAR *)(lpdsWorkCache->szF3002BatchBillUOM),
(const JCHAR *)(dsB3000550.szUnitOfMeasure),
DIM(lpdsWorkCache->szF3002BatchBillUOM)-1);
}
else
{
if (dsB3000550.cBillsFound > _J('1'))
{
bMultipleBillsExist = TRUE;
}
}
} /* End If (MathZeroTest(&lpdsWorkCache->mnConvertedQty) != 0) */

/* if no bill exists for given qty */
if (bBatchBillExists == FALSE)
{
/* see if zero bill exists */
ZeroMathNumeric(&dsB3000550.mnRequestedQty);
jdeCallObject (_J("SelectBillOfMaterial"),
NULL ,
lpdsInternal->lpBhvrCom, lpdsInternal->lpVoid,
(LPVOID) &dsB3000550,
(CALLMAP *) NULL,
(int) 0, (JCHAR *) NULL, (JCHAR *) NULL, (int) 0);

/* if a zero bill has been found */
if (dsB3000550.cRequestedQtyFound == _J('1'))
{
/* Warn that a zero bill will be used only if Process */
if ((lpdsInternal->cProcessMfgFlag == _J('1')) &&
(bMultipleBillsExist == TRUE))
{
if (lpdsInternal->cSuppressErrorMessages != _J('1'))
{
/* Warning: 006M - Zero Bill will be used */
jdeErrorSet (lpdsInternal->lpBhvrCom, lpdsInternal->lpVoid,
IDERRszTypeOfBill_18, _J("006M"), (LPVOID)NULL);
}
lpdsInternal->cErrorCode = EDIT_WARNING;
}

jdeStrncpy((JCHAR *)(lpdsWorkCache->szF3002BatchBillUOM),
(const JCHAR *)(dsB3000550.szUnitOfMeasure),
DIM(lpdsWorkCache->szF3002BatchBillUOM)-1);
}
else
{
/* no bill exists for item number */
if (lpdsInternal->cSuppressErrorMessages != _J('1'))
{
/* Error: 3551 - Bill of Material does not exist */
/* ORIGINAL CODE
jdeErrorSet (lpdsInternal->lpBhvrCom, lpdsInternal->lpVoid,
IDERRszTypeOfBill_18, _J("3551"), (LPVOID)NULL);
*/
/* MODIFICATIONS */
<font color="blue">jdeErrorSet (lpdsInternal->lpBhvrCom, lpdsInternal->lpVoid,
IDERRszTypeOfBill_18, _J("3551"), (LPVOID)NULL);

if (dsB9200005.cErrorLevel == _J('1'))
{
lpdsInternal->cErrorCode = EDIT_ERROR;
}
else
{
if (dsB9200005.cErrorLevel == _J('2'))
{
lpdsInternal->cErrorCode = EDIT_WARNING;
}
}</font>
}
/* ORIGINAL CODE
lpdsInternal->cErrorCode = EDIT_WARNING;
*/
}
} /* (bBatchBillExists == FALSE) */
return;
}
</pre><hr />
 
It looks as though you haven't done anything to populate your dsB9200005 structure. After you know the error you're setting, you need to determine the error level of that error.

You need to call the business function for which you declared the data structure...that will populate the error level parameter that you can then test in your code.
 
Hi Jeremy,

Thanks for the analysis and advice...

Fixed it using the following codes:

<font class="small">Code:</font><hr /><pre>
/* no bill exists for item number */
if (lpdsInternal->cSuppressErrorMessages != _J('1'))
{
/* Error: 3551 - Bill of Material does not exist */
jdeErrorSet (lpdsInternal->lpBhvrCom, lpdsInternal->lpVoid,
IDERRszTypeOfBill_18, _J("3551"), (LPVOID)NULL);

/* MODIFICATIONS START */
<font color="blue">jdeStrncpy((JCHAR *)(dsB9200005.szDataItem),
(const JCHAR *)_J("3551"),
DIM(dsB9200005.szDataItem)-1);

idReturnCode = jdeCallObject (_J("RetrieveErrorMsgInfo"),
NULL ,
lpdsInternal->lpBhvrCom, lpdsInternal->lpVoid,
(LPVOID) &dsB9200005,
(CALLMAP *) NULL,
(int) 0, (JCHAR *) NULL, (JCHAR *) NULL, (int) 0);

if (idReturnCode == ER_SUCCESS )
{
if (dsB9200005.cErrorLevel == _J('1'))
{
lpdsInternal->cErrorCode = EDIT_ERROR;
}
else
{
if (dsB9200005.cErrorLevel == _J('2'))
{
lpdsInternal->cErrorCode = EDIT_WARNING;
}
}
} </font>
/* MODIFICATIONS END */
}
/* ORIGINAL CODE
lpdsInternal->cErrorCode = EDIT_WARNING;
*/
</pre><hr />
 
Back
Top