Emailing completed UBE jobs CSV/PDF

johndanter

Legendary Poster
Thanks for the hint Craig

I build my own simple BSFN that just calls GetPrintQueueDirectoryPathName and passes it back into lpDS=>szCommandStringCMDS

Locally it brings back D:\E910\PrintQueue\

So I am guessing on the server it'll behave as expected right?

God bless JDE :)
 

johndanter

Legendary Poster
Hi Guys

When I read over F9861110 I have a custom config table F550002 (this lives in the nomal DEVDTA CRPDTA etc)

When I am signed on locally my machine picks up F9861110 from the System 900 datasource

Problem is F9861110 actually lives on datasource GTSAX-JDED1 - 900 Server Map The WSJ screen overrides this for you after you chose your server in the previous screen

Now I know I can use BSFN B9861101 to point my UBE to GTSAX-JDED1 - 900 Server Map but how am I going to then read back from my F550002 table?

Is there a BSFN to set the OCM for a specific table only?
 

David Robertson

Reputable Poster
B9861101 only overrides the location of F986110, and I don't think it works on a server job (#ifndef IAMASERVER around the code)

Alternatively, use a table handle rather than a BSFN.

Are you driving a section with F986110, or just wanting to fetch/read rows with the UBE?
If you are driving the UBE with it, I believe you will need another UBE to call it, that sets the override OCM first, as this happens for the UBE itself before the init.
 
Last edited:

Alex_Pastuhov

Legendary Poster
John, there are dozens of little problems like this along the way. Surely it's easier to use some ready product like our AUTOPRINT instead of redeveloping it all from scratch?
 

johndanter

Legendary Poster
B9861101 only overrides the location of F986110, and I don't think it works on a server job (#ifndef IAMASERVER around the code)
Are you driving a section with F986110, or just wanting to fetch/read rows with the UBE?

Yes Dave, it's a driving section. What happens is I read through F986110 and then go off to a config table to check for email active Y/N

So I may have to try your idea.
So far I'm just running this locally to test it

Just seen this on the KG
E1: RDA: No Data Returned by Report or Table I/O Event Rule on Job Control Master Table - F986110 (Doc ID 630623.1)

https://support.oracle.com/epmos/fa...afrWindowMode=0&_adf.ctrl-state=1pymdrxsx_234

So yeah seems likeit'll be on the server, just a pain to test locally :)
 
Last edited:

johndanter

Legendary Poster
For anyone reading this in the future. On the server you don't need any of this and the bootstrap table will be found as setup in your ini file.
Locally you will have an issue, so you need to do the following:

All you need to do is create a simple UBE that calls your main UBE.

3 lines of code
F986110 DS OVERRIDE (B9861101)
"ServerName" -> szDatabasepath

// Synchronous Report Interconnect
Call(UBE:ReportXX,Ver:VersionXX)

// remove the F986110 datasource override to servermap data source
F986110 DS OVERRIDE (B9861101)
"<Blank>" -> szDatabasepath


And it works :)
 
Last edited:

franck_blettner

Active Member
John,

Is the enterprise server a windows or linux/aix server ? if your enterprise server is running on AIX/Linux, it exists a simple way to get PDF and send him by email :
- rename runbatch into system/bin32 directory with runbatch_ow
- create a new runbatch that will call the runbatch_ow
By this way you can retrieve parameters of the runbatch (PDF name, job number, ....)
I've done this before to send PDF to a streamserve server and check before into JDE if the batch should go or not

Regards,

Franck
 

johndanter

Legendary Poster
Hi Franck

This is on the AIX

My aim for this is to have ZERO further development effort once setup.

This will all work via config. I, as a developer, won't be touching my mouse/keyboard to get other UBEs emailing.
You just add a record to the config table and a scheduled UBE (30 min cycle) does the rest for you. Gets the PDF and emails it out. I save the last run JOBNBR and select on F9861110 greater than that

Seems to be working fine so far :)

I'll post up how I did it
 

johndanter

Legendary Poster
Ok guys, here's an update and a few more questions

When I run it locally it works fine in that it finds my hardcoded file D:\E910\PrintQueue\test.pdf

On the server my debug log shows the files being picked up as:
"/App/jdedwards/e900/PrintQueue/R0006P_XJDE0001_1858421_PDF "

Note the spaces on the end

My emailing BSFN when running on the server gives this error in the debuglog

jdesmtp.c3951 - 59768896/1 WRK:Starting jdeCallObject encode_file : fopen failed for </App/jdedwards/e900/PrintQueue/R0006P_XJDE0001_1858421_PDF >,


Now is it that the address is wrong (the file does exist) or is it those extra spaces at the end?

I am rtriming the spaces as we speak but just thought I'd save time and ask can anyone see anything wrong with that address?

Thanks

John
 

peterbruce

Legendary Poster
John,

You are correct, trim the trailing spaces to get the file name as it exists on the server. However, for the email recipient to readily open the file, you will have to copy and/or rename it to a .PDF, as jileto points out.
 

apndy

Active Member
I see all your reply, didn't see detail information, who can upload a attachment with detail steps. thank you.
 

johndanter

Legendary Poster
Hey guys

So many thanks to all who have have contributed to this. I now have it working like a charm :)
All that's left to do is saving of the last the read job number (for future selections) and then work out if the file is CSV of PDF (any hints on that would be great)

The file is being picked up from the server as _PDF (however this is then unreadable in the email and needs renaming) Thankfully we can rename the file in the email merge letter BSFN so that's ok

apndy, I will be posting up with what I did and how but if you need answers quicker, let me know
 

neil_shepherd

Well Known Member
Hi John,

Great stuff, glads it's working. Your servers Unix isn't it? I'll try and send you some stuff about checking files.

Cheers

Neil.
 

johndanter

Legendary Poster
Hi Neil,

Thanks for your help. Yes it is Unix.

Seen as the F986110 FNDFUF2 is always OBJ_VERS_JOB_PDF regardless of it's extension, I'm a little lost as to find which one I may need. CSV or PDF

So yeah, if I can find a smart way of working out is it a CSV or PDF I need to go after, that would be great thanks
 

craig_welton

Legendary Poster
Technically, this is stored in the zReportFlags member of the UBEVar data structure, for example

if (pUBEVar->zReportFlags & eDRRPTCreateCSV)
{
/*CSV*/
}

That UBEVar is stored in the blob of F986110, but if I remember correctly it's packed with 8 byte alignment so you'll have to do some tweaking to get it to work on the fat client. I never worked with it on Unix, just Windows and iSeries plus it was a while ago, so things may have changed.

Craig
 

David Robertson

Reputable Poster
On ours here, I think the files are actually named OBJ_VERS_JOB_PDF.pdf and OBJ_VERS_JOB_PDF.csv, the pdf always exists, the csv exists if it was specified as output at run time, not sure on a UBE that is specifically designed as csv output.

(Just checked a CSV report, file name is R550018P_WHO0001_2479_PDF, and it still produced both R550018P_WHO0001_2479_PDF.pdf and R550018P_WHO0001_2479_PDF.csv in our /E910SYS/printqueue on AS400 IFS)

(at a quick and rough look, it does seem to specify ".csv" in the F986110 blob, as Craig suggested above)
 
Last edited:

johndanter

Legendary Poster
Righto cheers guys, I'll have a fiddle today:)

I've cheated and actually put a CSV y/n flag in my config file
So when I construct the file address I either do .csv or .pdf and attach to the email

Nearly there :)

I'm just thinking the option to have CSV auto ticked at runtime must exist on a table for the version somewhere
How else would it know?
 
Last edited:
Top