How to open/print a PDF right after the job is finished

Ariel Alvarez

Ariel Alvarez

Member
Wise List,

We want to have the ability of to create an order and after click on the OK button to call an UBE report and either open the PDF or print the PDF.

Does anybody know how to do that?

We are using One World XE- Released B7334. In Citrix Environments against SQL.

Thanks a lot for your help.
 
REL,

What you wish to do requires a modification to the Purchase Order Entry application. Either clone it and modify and use the clone or modify the standard application.
 
To call a UBE yes, it will require a mod, but there's a ready commercial third-party software solution (yes, ours) to automatically open the PDF's, which were run on the server, on the submitting client...
 
Hi Alexander, could I suggest with all due respect that instead of promoting your products here, you give the guy a tip on how to do this himself? After all, that's what this forum is intended for.

Hi REL. You didn't quite give us all the detail required to answer your question, but in general:

In the Post Button Clicked event of the 'OK' form exit, you can put in a System Function to 'Report Interconnect' your UBE to print the order. However you have to be a bit careful here as, for instance, Sales Order Entry business functions (or are you talking about purchase orders?) might be completing the order in the background, so you can't be sure when it's completed! In this case you might need a further mod to change the business function (EndDoc) to run synchronously. Then you know when its done and you can also check that the order did indeed create without any error.

If your UBE runs locally on the client (unlikely) the PDF will display automatically. If the UBE runs on a server (typical case) then your JDE CNC admin can configure the system so it prints immediately. In this case getting the PDF to automagically display on the screen is more tricky, but not too hard. If you look at the Work With Server Jobs application (P986110B) at the code behind the 'View PDF' row exit you will see exactly what you need to do! Just dupicate that logic.

But as I say, beware of the EndDoc business function being async, leading to you attempting to run your UBE before the order creation has completed!

Another tip: You should consider writing all this in a Named Event Rule so the only mod to your application is a one liner. This makes retrofitting your mod after upgrades and ESUs easy.


Hope that helps,
JohnO
 
Fair enough, but this would be a solution, that would require many mods to standard objects, which is not a very good idea. That's why I didn't take this path - it turns JDE into a minefield, as far as the future Upgrades are concerned.

My solution is mod-less, but it requires external coding and cannot be implemented in JDE toolset. Hence, while it's worth mentioning, it's not worth describing.

On the other hand, although the two approaches are perfectly valid, I always doubted, that DIY solutions are the best in every case. I.e. everybody knows the basic principles of building houses, but 99% of houses are still built by builders nonetheless ;-) It's all about a choice.
 
Hi REL,

I agree with Jolly to the point that you should provide some more detailed information regarding your question and also that mods in standard applications do not always lead to a minefield if you handle them with care (e.g. using a NER as suggested which would make future retrofitting easier).

If you go ahead with the Print Immediate option (either through the standard functionality or through one of the other options frequently posted on the list) than you can launch your UBE with Call UBE (Report Interconnect) directly, which will trigger the Printer Selection screen, or from a NER BSFN which will not display this screen (batch mode). In this case your only concern is the EndDoc BSFN.

If you want to display the PDF on screen directly (by using the coding from P986110B and BSFN B9861102 as suggested by Jolly) then you will need the Server Job Number of the job that has just been executed. To accomplish this you can use standard BSFN's that will return the job number (e.g. B91300C). However this way you don't have the report interconnect functionality to pass parameters to your UBE.
If you need to do this you can write your own BSFN using jdeLaunchUBEEx API where you can include your report data structure and pass parameters to it. (This topic is also covered many times on the list).

In both cases you will need to take into account the asynchronous execution of the EndDoc BSFN. You can only launch your UBE if EndDoc has finished processing.
I would not suggest changing the process mode to run synchronous.
Alternatives for you would be to place your code in the EndDoc BSFN itself after all clean up actions have been finished (e.g. B4200310 if you're talking about Sales Order Entry), but this can be tricky (passing parameters back and forth, etc...) or to write a BSFN that will check if the header cache or workfile still exists (check BSFN B4201550 for an example). You can call this BSFN from the Post Button-Clicked event in the OK form exit or from the End Dialog event in a loop until the cache is destroyed and EndDoc has finished processing completely. At this moment you can launch your UBE.
A third possibility would be to put your code (to launch the UBE) into a custom BSFN, which you can call after the EndDoc BSFN is executed (also from the Post Button-Clicked event in the OK row exit button) with the asynchronous checkbox checked. The second asynch BSFN will run after the asynch EndDoc has finished, because there is one asynch thread active at a time. However, I personally never used this last solution.

Good luck and hopefully this can help getting you started.

Kind regards,

Jan Hox
E1 B733.4 SP23 Oracle 9i HP-UX
 
Thanks to everybody for your replays

Basically, what we want to do is avoid to the user to do many clicks in order to print a sale order. We already have a customized P4211 (too late for the minefield)
Despite the lack of information, I think the information that you provided is really helpful to start to work and choose one of the suggestions.

Thanks a lot.
 
Back
Top