Emailing completed UBE jobs CSV/PDF

The CSV output flag is in the spec for report, along with the printer and form definition stuff, and in the F986110 blob of the jobs to allow for run time override.

The way we do it here is to try it as a .csv, and if that fails, then try it as .pdf.
 
John,

Great to see that your development is working. I was not available last 3 days so it was not possible for me to post another solution. If someone is interested by this other way, i post this trick.
As you will see, there is not need to develop into JDEdwards and this trick will work for all ube. You can look into your configuration table (me i was using OSA table as the standard does).

As i said before, just rename runbatch into system/bin32 and create a new runbatch with script like below. The script will look up when the batch is finished, lookup into a table to see if an email should be send, run the batch, ans send the email :

#!/bin/ksh
PQUEUE=“/jdedwards/E910/PrintQueue"
create_mail()
{
batch=`sqlplus -s "svm910/svm910@JDEE1 << EOF
set heading off feedback off verify off
select JCJOBSTS,JCPROCESSID from svm910.F986110 where JCFNDFUF2 = '$1';
exit;
EOF`
set -- `echo "$batch" | sed -e 's/*\(*\)/\1/g'`
status=`echo "$1"`
batchid=`echo "$2"`
if [ $status = "D" ]
then
all=`sqlplus -s "svm910/svm910@JDEE1 << EOF
set heading off feedback off verify off
select JCFNDFUF2 from svm910.F986110 where JCPROCESSID=$batchid;
exit;
EOF`
for i in $all
do
batch_name=`echo $i|sed 's/_/ /g'`
set -- `echo "$batch_name" | sed -e 's/*\(*\)/\1/g'`
name=`echo "$1"`
version=`echo "$2"`
send_email=`sqlplus -s “SY910/SY910@JDE”1” << EOF
set heading off feedback off verify off
select count(*) from SY910.F986168 where OHOBNM='$name' and OHENHV='$env' and (OHUGRP='$username' or OHUGRP='*PUBLIC');
exit;
EOF`
if [ $send_email = "1" ]
then
cp $PQUEUE/$i $PQUEUE/$i.pdf
mail ######## to replace with mail function on aix ##############
fi
done
fi
}
batch_name=`basename $6`
env=`echo $3`
username=`basename $1`
runbatch_ow $*
create_mail $batch_name

Regards

Franck
 
If anyone is interested I'm attaching the code for a function to read a F986110 record and extract the UBEVAR data structure passing back a couple of values. The structure definition is packed to 8 byte alignment so it works on the client and server. Just pass the host and job number. Feel free to expand on this if you're looking to return more members of UBEVAR. I have not tried this in a Unix install, so if someone would like to try and report back, much appreciated.

Craig
 

Attachments

  • B5500001.zip
    3.9 KB · Views: 99
Cheers Frank and Craig.

Initially I wanted to use OSA Frank but didn't understand the scripting part, so that idea was scrapped.
I've got this solution 95% of the way there, so just need to stress test it now and it picking up the CSV/PDF (but David's reply above seems simpler)

I'll try Craig's code here too :)
 
If anyone is interested I'm attaching the code for a function to read a F986110 record and extract the UBEVAR data structure passing back a couple of values. The structure definition is packed to 8 byte alignment so it works on the client and server. Just pass the host and job number. Feel free to expand on this if you're looking to return more members of UBEVAR. I have not tried this in a Unix install, so if someone would like to try and report back, much appreciated.

Craig

Hi Craig,
Thanks for the nice little function!
But, I've loaded it up from a test application on a fat client, and it's retrieving garbage characters, so I assume the offset is out somehow. I've debugged and can see it retrieving the record fine, but after
pUBEVar = (LPUBEVAREX)dsF986110.jcsrvbloba.lpValue
szReport contains
0x3f7cdcc8 "刀㔀㔀  ㄀㠀倀" unsigned short [11]
, for example (whereas it should contain "R550018P").
I have the
#ifndef IAMASERVER
#pragma pack(push, 8)
#endif
in the function header file.
 
Hi Everyone

I am finding some difficultyin working with BI Publisher in MS Word. I have an xml file which i load in BI Publisher but when i click on preview an error occurs saying "Java Execution Failed. Please check Java Option in Option Dialog".
Could Anyone Kindly Help me out.

Thanxs in Advance

Ankur Sekhri
 
What database flavour is F986110 stored in?

DB2

Memory view is showing:
R 5 5 0 0 1 8 P
00 52 00 35 00 35 00 30 00 30 00 31 00 38 00 50


If I change this to:
R 5 5 0 0 1 8 P
52 00 35 00 35 00 30 00 30 00 31 00 38 00 50 00


The value is correct in the szReport variable.

I've tried removing the pack push and pop, doesn't seem to help
 
Last edited:
Strange. That works fine for me on DB2. Only difference would be tools release. 8.98.4.2 Would you mind posting your code? I know you have the pragma to set the packing boundary to 8, do you have the pop to reset it to 1?
 
Strange. That works fine for me on DB2. Only difference would be tools release. 8.98.4.2 Would you mind posting your code? I know you have the pragma to set the packing boundary to 8, do you have the pop to reset it to 1?

This seems more like there is a 1 byte element missing from the structure.
If I manually adjust the pointer value in debug from (for example) 0x3F8BB030 to 0x3F8BB031, it all aligns fine and the values in pUBEVar are at least mostly correct.

Even with that, it's incorrectly getting that my test report is not a CSV, where does eDRRPTCreateCSV come from?

#ifndef IAMASERVER
#pragma pack(push, 8)
#endif
typedef struct tagUBEVAREx {
NID szReport; /* Report Template Name - Key to F983051 */
NID szVersion; /* Version Name - Key to F983051 */
JCHAR szMachineKey[16]; /* To be used for install */
NID szEnhv; /* Client Environment Name - will be used for install */
JCHAR szUser[21]; /* User unsigned long. */
JCHAR szPwd[21]; /* Password. */
JCHAR szRole[11]; /* User's Role */
JCHAR szHostName[BLC_MAXLEN_SERVERNAME]; /* Remote Server name if running remotely */
ID idRunTime; /* Runtime ID comes from HWND, gets the user name */
BOOL bSynchFlag; /* synch/asynch flag */
BOOL bPreview; /* print/preview flag */
BOOL bBatchFlag; /* Report_To_Report flag - for prompting in UBE */
UBE_RESULT nStatusFlag1;
UBE_RESULT nStatusFlag2;
JCHAR szError[25];
JCHAR szLogFileName[126];
ushort nDebugLevel;
BOOL bRDAUBEFlag;
FILE * fp;
HUSER hUser;
JCHAR cProcOptFlag; /* Processing Option Flag */
ulong nPageCount; /* Total Pages processed by UBE */
MATH_NUMERIC mnJobNum; /* Job Num for SERVER Subsystems */
long zReportFlags; /* report level flags from DR_REPORT spec record */
NID szPOTemplateName; /* Processing Option Template Name */
NID szJobQueue; /* Remote Server Job Queue */
long nLimitRowsValue; /* max # of primary table rows to be printed when called from RDA - Raj */
BOOL bJDELog;
BOOL bJDEDebugLog;
JCHAR szMenuSysCode[5]; /* system code of menu selection, passed through from oexplore */
JCHAR szPrinter[31]; /* New entry to pass printer name from szPrintInfo struct to this entry on client mc */
} UBEVAREX, * LPUBEVAREX;;
#ifndef IAMASERVER
#pragma pack(pop)
#endif
 
Last edited:
Yes David, you are right. I'm seeing the same thing (don't know what I was looking at earlier). It looks like the byte order is different when written by the AS/400. I tried using the jdeUTF16ByteOrder API on the blob. That kind of worked, but the structure is still off further down.

So, very sorry to all.

Craig
 
Thanks Craig, it was still an interesting exercise for me ;)

If I offset the pointer by 1 byte, it seems to work until bRDAUBEFlag, and everything is messed up again from fp onwards.
 
For anyone reading this in the future some info for you one the file address and format

Jobs in WSJ are labelled OBJ_VERS_JOBNBR_PDF but on the Print Queue they will be saved as follows

CSV = /App/jdedwards/e900/PrintQueue/R550002_GTS0001_1935821_PDF.csv

PDF = /App/jdedwards/e900/PrintQueue/R550002_GTS0001_1935821_PDF


This is important as you make the mistake of trying _PDF.pdf etc (as I did)

To test your address is correct I made a simple APPL that I had promoted. All it does it call B0500725 and I call CheckForFile
You can then take it one step further and call B0500725 EmailMergeLetter to test the emailing of the jobs file :)
 
Hi Brian,

That API seems to just copy the BLOB into the DS. No manipulation is done so it's the same result. Thanks for idea.

Craig
 
Hi guys,

I have this working fine now and have written a tech spec for it etc. It can't seem to upload it here.
If anyone wants to know how I ended doing this please email me

[email protected]

It's fairly simple really but works well and I'm sure could be expanded on.
 
Hi,

I have used the BSFN "SendHRMEmail" in B0501320. You may also need to have your jde.ini configured for this to work. In particular, in the [JDEMAIL] section, check the key "Rule1=90|OPT|MAILSERVER=xxxxx" - substitute the value xxxxx with the name of your email server.
 
Cheers Kim. I ended using B0500725 in the end to send the email
It also has a few other modules that are very useful for checking the file type etc
 
I am new at this and we are trying to use B0500725 to send emails but we are getting an error code of 32?
Does anyone know what that means.

I decided to use BI Publisher and the email works great.

Thanks
E9.1
 
Last edited:
32 is returned if the JDE_SendEMailSMTPExt API fails. Your JDE.LOG should have more details. Set cRecordOperInLogFileFlag01 = 1 when calling the function.

More info would help though ... running on server or dev client? UBE or BSFN?
 
Back
Top