RE: Call BSFN from Legacy System

franck_blettner

Active Member
RE: Call BSFN from Legacy System

I give you a simple example on how to call a business function outside of
OneWorld...
If you want more details, send me an email.

4 steps to call a business function :
1) Connect to oneworld with the JDB_InitEnvOvr
2) Initiliase a user with the JDB_InitUser
3) Initialise parameters of the function you want to call
4) Call the function



#include <jde.h>
#include <n0100041.h>
#include "Call Object Sample.h"



int _cdecl main(void)
{
char buf[20],errstr[80];

JDEDB_RESULT rcode=JDEDB_PASSED;

HENV hEnv = NULL;
HUSER hUser = NULL;

/*call object variables */

LPBHVRCOM lpBhvrCom=NULL;
LPCG_BHVR lpVoid = NULL;
LPVOID lpDS=NULL;

ERROR_EVENT_KEY EventKeyLocal;
LPJDEERROR_RECORD ErrorRec;
LPINT NumErrors=0;
LPINT NumWarnings=0;

/*address book datastructure */

DSD0100041 dsAddressBookStruct;

/* CONNECT TO ONEWORLD */

if((rcode=JDB_InitEnvOvr(&hEnv,"DEMOB73", "DEMO", "DEMO"))!=JDEDB_PASSED)
{
sprintf(errstr,"JDB_InitEnvOvr failed.\n");
MessageBox(NULL,errstr,"JDE API Error!",MB_OK|MB_ICONEXCLAMATION);
return 0;
}

if((rcode=JDB_InitUser(hEnv,&hUser,NULL,JDEDB_COMMIT_AUTO))!=JDEDB_PASSED)
{
sprintf(errstr,"JDB_InitUser failed.\n");
MessageBox(NULL,errstr,"JDE API Error!",MB_OK|MB_ICONEXCLAMATION);
return 0;
}

/* INITIALIZE BUSINESS FUNCTION PARAMS */

jdeCreateBusinessFunctionParms(hUser, &lpBhvrCom,(LPVOID*) &lpVoid);
lpVoid->lpHdr = jdeErrorInitializeEx();
lpVoid->lpErrorEventKey = (LPERROR_EVENT_KEY) jdeAlloc(COMMON_POOL,
sizeof(ERROR_EVENT_KEY), MEM_ZEROINIT | MEM_FIXED);
lpVoid->lpHdr->nCurDisplayed = -1;
lpBhvrCom->lpObj->lpFormHdr = lpVoid->lpHdr;
EventKeyLocal.hwndCtrl = NULL;
EventKeyLocal.iGridCol = 0;
EventKeyLocal.iGridRow = 0;
EventKeyLocal.wEvent = 1;
lpBhvrCom->lpEventKey = (LPVOID)&EventKeyLocal;

/* Initialize Address Book data structure*/

memset((void *)(&dsAddressBookStruct), (int)('\0'), sizeof(DSD0100041));
dsAddressBookStruct.cActionCode = 'A';
dsAddressBookStruct.cUpdateMasterFile = '1';
strncpy(dsAddressBookStruct.szLongAddressNumber, "EmployeeName",
sizeof(dsAddressBookStruct.szLongAddressNumber));
strncpy(dsAddressBookStruct.szTaxId, "987654321",
sizeof(dsAddressBookStruct.szTaxId));
strncpy(dsAddressBookStruct.szSearchType, " ",
sizeof(dsAddressBookStruct.szSearchType));
strncpy(dsAddressBookStruct.szAlphaName, "Employee Name",
sizeof(dsAddressBookStruct.szAlphaName));

/* Call Address Book Master Business Fuction*/

rcode = jdeCallObject("AddressBookMasterMBF", NULL, lpBhvrCom, lpVoid, (void
*)&dsAddressBookStruct,
(void *)NULL, (int)0, (char *)NULL, (char *)NULL, (int)0);

/*Does the call have errors???*/

if(jdeErrorGetCountEx(lpBhvrCom,NumErrors,NumWarnings, lpVoid)>0)
{
jdeErrorSetToFirstEx(lpBhvrCom, lpVoid);
while(ErrorRec=jdeErrorGetNextDDItemNameInfoEx(lpBhvrCom, lpVoid))
{
sprintf(errstr,"AddressBook %s (level
MessageBox(NULL,errstr,"JDE API Error!",MB_OK|MB_ICONEXCLAMATION);
jdeErrorClear(lpBhvrCom);
}
}


jdeFree(((LPCG_BHVR)lpVoid)->lpErrorEventKey);
jdeErrorTerminateEx(((LPCG_BHVR)lpVoid)->lpHdr);
jdeFreeBusinessFunctionParms(lpBhvrCom,lpVoid);

if(hUser)JDB_FreeUser(hUser);
if(hEnv)JDB_FreeEnv(hEnv);

return 0;
}



-----Message d'origine-----
De : owner-jdeowdevml@jdelist.com
[mailto:eek:wner-jdeowdevml@jdelist.com]De la part de Manish Pradhan
Envoyé : vendredi 11 mai 2001 00:01
À : jdeowdevml@jdelist.com
Objet : Call BSFN from Legacy System


Hello Guys,
I am working on building an interface between a Legacy system and
OneWorld Xe. I need to call a OneWorld Master Business Function from a
legacy system's C program. Can anyone help me in figuring out the best way
to do it. Thanks in advance.

Manish


Franck BLETTNER
Service Informatique RAVATE
Tel : 02 62 90 40 48
E-mail : franck.blettner@ravate.com
 
RE: Call BSFN from Legacy System

Hi Frank,
Thanks a lot for your email. The sample program you have sent me
closely resembles, the task I am trying to do. I will really appreciate, if
you could send me any documentation on this.
Also, after including all the prerequisite folders/directories in the
C compiler, I am still getting built errors like ...

c:\b7\system\include\jdeuprto.h(263) : error C2081: 'JDEMENUBUILDCALLBACK' :
name in formal parameter list illegal
c:\b7\system\include\jdeuprto.h(263) : error C2081: 'JDEMENUSLCTCALLBACK' :
name in formal parameter list illegal
c:\b7\system\include\jdeuprto.h(281) : error C2146: syntax error : missing
')' before identifier 'lpFS'
c:\b7\system\include\jdeuprto.h(281) : error C2081: 'LPJDEERFONT_STRUCT' :
name in formal parameter list illegal
c:\b7\system\include\jdeuprto.h(281) : error C2061: syntax error :
identifier 'lpFS'

.... any idea, what I need to do resolve these errors. Thanks a lot. I am
immensly greatful to you for your help.

Manish.



Manish
 

kalpeshp

Member
Hi Guys,

We have some critical problem. We are fetchnig error from F4211 Edit Line through "JDEM Sales Detail Line Level Action Error Se" and "Proccess batch errors to the JDEM system".

Our F4211 Edit Line shows Error Code = 0 it meanse there is no error in sales order creation, but when we write error through "Proccess batch errors to the JDEM system" in WC then it give "Error: Record Invalid" error.

We can't understand that from where this error occured ? Can any one help us ?

Regards,
Kalpesh
 
Top