Help with C Business Function, if possible

jdesmm

Well Known Member
I am attempting to emulate the main functionality in a base JDE C business function within my own C business function. The only thing I really need to change from the original BSFN is which fields it updates in a table. The particular function I'm referencing is the F4211PostEditLine (B4203200). I created a new data structure and then a new C BSFN. I then copied relevant sections of the original C BSFN code into my new BSFN, changing parameter names as necessary.

Now, I'm not a C programmer and usually do most of my development in JDE with the base toolset and NER when a function is needed. I had a couple of C classes back in college, but that was a long time ago. I'd say I know enough to understand the processing that occurs in C code when I read it, but not enough to be sure of proper syntax, structure, commands, etc.

In attempting to busbuild the new function, I'm down to just a few errors that I don't know how to fix. I'm wondering if someone on JDElist can help.

The specific errors in the Busbuild are:

-------------------------------------------

C:\B7\DV7333\source\B5542032.c(72) : error C2065: 'DSDE0022' : undeclared identifier

C:\B7\DV7333\source\B5542032.c(72) : error C2146: syntax error : missing ';' before identifier 'dsDE0022'

C:\B7\DV7333\source\B5542032.c(72) : error C2065: 'dsDE0022' : undeclared identifier

C:\B7\DV7333\source\B5542032.c(258) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'char '

C:\B7\DV7333\source\B5542032.c(258) : warning C4024: 'IsStringBlank' : different types for formal and actual parameter 1

C:\B7\DV7333\source\B5542032.c(285) : error C2224: left of '.szDescription' must have struct/union type

C:\B7\DV7333\source\B5542032.c(285) : warning C4090: 'function' : different 'const' qualifiers

C:\B7\DV7333\source\B5542032.c(285) : warning C4024: 'strcpy' : different types for formal and actual parameter 1

C:\B7\DV7333\source\B5542032.c(285) : error C2198: 'strcpy' : too few actual parameters

-------------------------------------------

I'm mystified by the first few errors regarding the DSDE0022. This was essentially code that I copied directly from the original BSFN and didn't alter. The code looks like this:

/************************************************************************
* Declare structures
************************************************************************/
JDECMINDEXSTRUCT jdecmIndexF42UI12[2] = {0};
F42UI12 dsF42UI12;
KEY1_F42UI12 dsF42UI12Key1;

DSDE0022 dsDE0022;

I believe I know what's causing the char related errors that follow the DSDE0022 errors. The original code updated fields that were all either string or numeric type. My new code needs to update a character type field. I think I need to use some sort of different syntax to work with a character field. Below is the code I have now:

if (!IsStringBlank(lpDS->cSubledgerType_SBLT))
{
strcpy((char *)(&dsF42UI12.zdsblt),(const char *)(&lpDS->cSubledgerType_SBLT));
}

How should it be changed?

I'm not sure about the final errors, but they are referring to a line that hits DSDE0022 again, and perhaps will be corrected by fixing whatever the issue is with that declaration. Below is the segment with the line in question:

if (jdeCacheResult != JDECM_PASSED || idJDEDBReturn != JDEDB_PASSED)
{
memset((void *)&dsDE0022, (int)'\0', sizeof(dsDE0022));
strcpy((char *)dsDE0022.szDescription, (const char *)"F42UI12");

if (lpDS->cUseWorkfile_WFOC == '2')
{
/* If the Cache Update failed */
jdeSetGBRErrorSubText(lpBhvrCom, lpVoid, (ID)0, "078P", &dsDE0022);
}
else
{
/* If the Update Table failed */
jdeSetGBRErrorSubText(lpBhvrCom, lpVoid, (ID)0, "078H", &dsDE0022);
}
idReturnValue = ER_ERROR;
}

Thanks in advance for any help on this.
smile.gif
 
Hi Shelley,

The original code has an #include statement somewhere that defines the DSDE0022 structure. You'll need to track down where that definition is and copy it or include that same file.

The IsStringBlank function is expecting a string as you mention. You can test char values explicitly as follows:

if(lpDS->cSubledgerType_SBLT != ' ')

The 3rd group of errors should disappear when you fix the 1st issue.

Good luck.
 
Hi jdesmm

Jeremy is definitely pointing you to the right direction but if you are still having problems, just attach you .c and .h files and i'll have look.
 
Thanks, Jeremy, that was exactly the information I needed. The business function built just fine once I got those fixes in place and is working perfectly. Unfortunately, it's not resolving the issue that I hoped it would, but that's another post.
 
The part you are missing is in the .h file. You need the line...

#include <jdeapp.h>

This will define the common error substition data structures.
 
Back
Top