• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

OW Interoperability w/Access

jdeuser2001

Active Member
Dear List,

Can anyone tell me how to submit a OW UBE from Access using Visual Basic?

The manuals refer to jdeCallObject API, which adds records to the subsystem table. However, all examples call this API from C functions. Is there a way to call this API from Visual Basic?

Best regards,

Will K.
EMS, Inc.
 
Will,

You don't say what version of OW you are running, and I assume you are
using VBA in Access.
If your OW version is current enough, your best bet is to create a JDE
COM object that can then be called from VB. I can tell you how to do
this.

Mark Collins

B733/XE/Oracle 8/W2K
 

jdeuser2001

Active Member
Re: RE: OW Interoperability w/Access

Mark,

I am using OW 7332 Stand Alone to develop, but will be migrating code to a server. And, yes, I will be using VB in Access to submit a batch job in JDE.

Thank you for your help.

Best regards,

Will Kaufman
303-744-7080.
 
RE: RE: OW Interoperability w/Access

Will,

You should be able to use JDE COM objects for this. Try this:

1. Create a text file named <MyLibrary>.cmd and add the following to
it:

define library <MyLibrary>

login

library %library%
interface <MyInterface>
import B0000004 (change this to the name of the cpp file that
contains the business functions you need)
build

logout

2. Create a .bat file named <MyLibrary>.bat and add this:

gencom /cmd <MyLibrary>.cmd /tempout c:\<MyDirectory>\TempOut /out
regsvr32 c:\<MyDirectory>\<MyLibrary>.dll"
pause

3. Go into your VBA project and add references to JDECOMConnector2 and

4. Get the JDE "Address Book" sample app. It will show you how to use
these in VB.

If you have any questions, let me know.

Mark

B7333/XE/Oracle 8/W2K
 

jdeuser2001

Active Member
Re: RE: RE: OW Interoperability w/Access

Mark,

Thank you for your help, I really appreciate.

Unfortunately, I don't think that your method will work for what we're trying to accomplish because your approach relies on calling a particular OW Bus. function. A JDE interoperability consultant also confirmed that the COM object approach relies on calling a specific business function. We are simply trying to launch a UBE or to call it directly from within Access VB. One approach I've considered was to simply write entries into subsystem job queue table, which, theoretically should trigger a UBE launch. However, that may not work since you need a jde API to populate such fields as job number, etc. Another approach is to write entries into the JDE scheduler, but again I am somewhat reluctant to do that since that would add maintenance for my client (i.e. maintaining schedulure and making sure that it's always running.) Finally, and this may be most realistic, would be to have this UBE automatically run every 5 minutes or so using JDE scheduler. The last approach is the simpliest, but not the most elegant since there will be a delay in posting the transactions into OW.

If you have any other ideas or comments I would appreciate hearing from you.

Best regards,

Will Kaufman.
 

WhippingBoy

VIP Member
Re: RE: RE: OW Interoperability w/Access

Will, does anyone there write C code? I'm doing essentially the same thing you describe, but it's in C. Logon, execute UBE, logoff.

You can write a simple 'stand-alone' C app that VB calls.

Darren Ricciardi - OneWorld Whipping Boy

Looking for work in Amsterdam THE NETHERLANDS
 
RE: RE: RE: OW Interoperability w/Access

Will,

Sorry that won't work for you. You could use a declare statement in
your VB module for jdeCallObject, but it doesn't sound like that would
work, either. Good luck.

Mark
 

Larry_Jones

Legendary Poster
Re: RE: RE: OW Interoperability w/Access

Hi Darren,

do you know a way from 'C' to change the Data Selection values for a UBE (without custom coding inside the UBE) before executing it?

TIA,

Larry Jones
ljones@wagstaff.com
OneWorld XE, SP 15.1
HPUX 11, Oracle SE 8.1.6
Mfg, Distribution, Financials
 

WhippingBoy

VIP Member
Re: RE: RE: OW Interoperability w/Access

If you don't need the selection to be really dynamic then just set up a bunch of versions to cover your bases. Then, simply call the appropriate version at run-time.

Now, if you need 'on the fly' dynamic data selection, then I don't know how to do that in C. Give me a few hours to scour the inclusion files and I bet I could figure it out, but that seems to be counter productive. You should change the UBE to update it's data selection at run-time.

Thusly:
Add a data structure to the report. In the Initialize section append data selection commands that utilize the structure values. You can condition the 'appends' to be ignored if anything else calls the report. I know, I know, you didn't want to change the report. . .well, sometimes you have to do things the 'easy way'.

Now right a C program using the Interconnectivity stuff I mentioned in that other thread. That shows you how to log in and out of OW and how to get the environment 'handles.'

Now call jdeLaunchUBEEx to execute your UBE (I stole this out of B4200310)

/************************************************************************
* Variable and Structure Declarations
************************************************************************/
PUBEVAR pUbeVar = (PUBEVAR)NULL;
DSRI375782 ds42997; /* Data Structure for R42997 */
LPF42UI01 lpdsF42UI01 = lpds4200310D->lpdsF42UI01;

/************************************************************************
* Main Processing
************************************************************************/
pUbeVar = jdeAlloc(COMMON_POOL, sizeof(struct tagUBEVAR),MEM_ZEROINIT);

if (pUbeVar != (PUBEVAR)NULL)
{
memset((void *)pUbeVar, (int)'\0', sizeof(pUbeVar));

/*--------------------------------------------------------------------
* Load Ube Structure
*-------------------------------------------------------------------*/
pUbeVar->bPreview = FALSE;
jdeNIDcpy((char *)pUbeVar->szReport,(const char *)"R42997");

if (IsStringBlank(lpds4200310D->szPOR42997Vers))
{
strcpy((char *)pUbeVar->szVersion, (const char *)"ZJDE0001"); /* CHG 2830649 */
}
else
{
strcpy((char *)pUbeVar->szVersion, (const char *)lpds4200310D->szPOR42997Vers);
}

strcpy((char *)pUbeVar->szMachineKey, (const char *)lpDS->szCMComputerID);
GetLocalEnvironmentName(pUbeVar->szEnhv, 11);
pUbeVar->idRunTime = (GLRTID)lpBhvrCom->hDlg << 16;

/*--------------------------------------------------------------------
* Run the UBE Asynchronously
*-------------------------------------------------------------------*/
pUbeVar->bSynchFlag = FALSE;

/*--------------------------------------------------------------------
* Run the UBE in Batch Mode
*-------------------------------------------------------------------*/
pUbeVar->bBatchFlag = TRUE;

/*--------------------------------------------------------------------
* Load R42997 Structure
*-------------------------------------------------------------------*/
memset((void *)&ds42997, (int)'\0', sizeof(ds42997));

MathCopy(&ds42997.mnSalesOrderNumber, &lpdsF42UI01->zhdoco);
strcpy((char *)ds42997.szSalesOrderType, (const char *)lpdsF42UI01->zhdcto);
strcpy((char *)ds42997.szSalesOrderCompany, (const char *)lpdsF42UI01->zhkcoo);

/*--------------------------------------------------------------------
* Launch the Ube
*-------------------------------------------------------------------*/
jdeLaunchUBEEx((HUSER)hUser, (PUBEVAR)pUbeVar, (LPVOID)&ds42997,
lpBhvrCom);
}


It's cake, allocate and initialize the pUbeVar structure. Fill it with the stuff you see up there; report name, version, how to run it, etc. Just copy that stuff and replace your report name. You'll be fine.

Next you initialize and fill the data structure. If you don't want to go with a structure, just skip that part and send NULL in the third parm of jdeLaunchUBEEx.

Lastly, call jdeLaunchUBEEx with all the pieces and logout.

If you don't use the report structure call the function like this:
jdeLaunchUBEEx((HUSER)hUser, (PUBEVAR)pUbeVar, (LPVOID)NULL,
lpBhvrCom);



Between this thread, and the one where I show how to sign-on and off, you have almost the whole program. Write it up, and attach the monster to your VB proggy. (homer)mmmmmm. . . .caaaaaake(/homer)



Darren Ricciardi - OneWorld Whipping Boy

Looking for work in Amsterdam THE NETHERLANDS
 

Larry_Jones

Legendary Poster
Re: RE: RE: OW Interoperability w/Access

Thx Darren,

I really wanted the dynamic data selection because I wanted to build an all-purpose UBE launcher tool ... Oh well, philosophically I agree with your more pragmatic approach.

Really appreciate your posts in this forum. Keep up the good work!

P.S. What time was it in the Netherlands when you made your last post?

Larry Jones
ljones@wagstaff.com
OneWorld XE, SP 15.1
HPUX 11, Oracle SE 8.1.6
Mfg, Distribution, Financials
 

WhippingBoy

VIP Member
Re: RE: RE: OW Interoperability w/Access

hehehe. . who knows. I live in colorado!

Oh yeah, it's my experience that OneWorld doesn't do 'all-purpose'. At least not the tricky stuff.

Darren Ricciardi - OneWorld Whipping Boy

Looking for work in Amsterdam THE NETHERLANDS
 
Top