Strange results from C BSFN

badda_bing

Well Known Member
Apologies in advance for this but I am no C guru!!!

I am having problems with B0900038 (Edit Posting Edit Code) when called from B0900042 (F0911 Edit Line). Code below;

Now in my humble opinion this simply opens the F0006 record for the MCU passed in and checks the MCPECC field (posting edit code) if the field is equal to N then it displays error “0069”.

Here’s my problem, the system seems to be invoking this error for every BU – if the posting edit code is set to N or not? I have turned debug on and captured the SQL statement that is executed and manually ran this against the DB and it returned the record I expected with a BLANK in the MCPECC field? Yet every time it is run within th BSFN it produces the error – any ideas.

TIA,

Paul

B7332 Win2K SQL2000 SP11.3srv and 11.1client




/* File open business units */
idJDBReturn = JDB_OpenTable(hUser, NID_F0006, ID_F0006_COST_CENTER,
NULL, (ushort)0, (char *)NULL,
&hRequestF0006);

if (idJDBReturn == JDEDB_FAILED)
{
memset((void *)(&dsDE0022),(int)('\0'),sizeof(dsDE0022));
strncpy(dsDE0022.szDescription, (const char *)("F0006"), sizeof(dsDE0022.szDescription));
jdeSetGBRErrorSubText(lpBhvrCom, lpVoid, (ID)0, "078D", &dsDE0022);
JDB_FreeBhvr(hUser);
return ER_ERROR;
}

/* Read the business unit record to find the posting edit code. */
strncpy(dsF0006Key.mcmcu, (const char *)(lpDS->szCostcenter),
sizeof(dsF0006Key.mcmcu));

idJDBReturn = JDB_FetchKeyed(hRequestF0006, ID_F0006_COST_CENTER,
(void *)&dsF0006Key, (short)1,
(void *)lpdsF0006, FALSE);

if (idJDBReturn == JDEDB_PASSED)
{
/* If the business unit posting edit code does not allow posting, */
/* Set an error on the business unit . */
if (dsF0006.mcpecc == 'N')
{
jdeErrorSet(lpBhvrCom, lpVoid, IDERRszCostcenter_1, "0069", (LPVOID)NULL);
JDB_CloseTable(hRequestF0006);
JDB_FreeBhvr(hUser);
return ER_ERROR;
}
}
else
 
Not sure it it is a transcription error, but the Fetch is into lpdsF0006 but the test is against dsF0006? Otherwise perhaps you could enable logging then capture the SQL from the log and run the SQL statement directly and see what is returned.
Cheers,
JohnO
 
Hey JohnO,

Thanks for that. Excuse my ignorance but what is the difference between
lpdsF0006 and dsF0006? Are they not both just pointers to F0006?

I think I have already tried your suggestion, I captured the SQL using the
debug file and manually executed this against the DB and it returned the
record I expected that was blank in the MCPECC field, yet when this record
is used within the application it error with error "0069"????

TIA

Paul

B7332 Win2K SQL2000 SP11.3svr & 11.1client
 
Hey JohnO,

Thanks for that. Excuse my ignorance but what is the difference between lpdsF0006 and dsF0006? Are they not both just pointers to F0006?

I think I have already tried your suggestion, I captured the SQL using the debug file and manually executed this against the DB and it returned the record I expected that was blank in the MCPECC field, yet when this record is used within the application it error with error "0069"????

TIA

Paul

B7332 Win2K SQL2000 SP11.3svr & 11.1client
 
Oh ... not your ignorance but my misreading; that code is fine; they are referencing the same thing: lpdsF0006 is a pointer to the structure where as dsF0006 is the structure itself. So the fetch is passed the pointer to the structure to fetch into whereas the test references an element of the structure directly.

So what you should do next is use the C debugger to place a breakpoint in the BSFN and examine the variables and flow of execution there.

Let us know what happens!

JohnO
 
Back
Top