A P4021 Recursive Problem

Gary P

Active Member
All, I'm trying to have a form, called by the Find button on P4021 trigger a new find and call to the form, and want to find a way to do it without using recursion. Here's the long of it:

I'm making a modification to P4021 - Supply and demand that will group records together to show a summary. The way I'm doing it, on the "Post Button Clicked" event of the Find button, I generate a workfile, and then call the new form that displays this information.

I need to be able to handle this form in three different ways:
On-demand: The user has already performed a successful find, and has used a form exit to call this summary.
Auto-call: If a processing option is set, when the user presses Find, the summary form is automatically called (the user doesn't see the main form).
Interconnect Auto-call: Same as above, but this handles going to P4021 from another application, so it populates item/branch etc, presses Find, and then calls the summary.

As stated above, I've been able to accomplish this by creating a form exit that generates the workfile and calls the summary, then handles the auto-call via ER in the Find button's "Post Button Clicked" event. Now the user wants to change the part number / branch and initiate a new P4021 Find from the summary. I'm concerned about this causing a recursive problem, because the Find button which called the summary in the first place would then be initiating a new find. I admit I'm not too familiar with the JDE ER to know any tricks. If there was a way to give a command on a button, but delay that command until after the event has stopped, that would handle my issue.

My first thought is to move a "Controller" button. I would move the summary auto-calls to the controller from the Find, and then the Find would be complete before a summary call. This would be mildly invasive, as I would need would need to make all calls to Find call the controller first. This would be a performance hit when the user wants to call the form on-demand. But, other than that, I'm stumped.

Does anyone know a better way?
 
A couple of questions:
1) Do your users still use the base P4021 functionality or do they just use your new summary form?
2) I apologize, but I lost you on the following paragraph:
[ QUOTE ]
My first thought is to move a "Controller" button. I would move the summary auto-calls to the controller from the Find, and then the Find would be complete before a summary call. This would be mildly invasive, as I would need would need to make all calls to Find call the controller first. This would be a performance hit when the user wants to call the form on-demand. But, other than that, I'm stumped.

[/ QUOTE ]

If I'm understanding what you mean by recursive, you're right in that you don't want to be in FormA (P4021) and call FormB (summary) and then try to call FormA so it kicks-off a new build only to then call FormB to show the new summary and then potentially do it over and over...bad idea.

My suggestion would be:
- make a copy of P4021.
- Add a new form to show your summary data
- duplicate the 'Find' (building of S&D data) logic from W4021B and incorporate into the new summary form. Then they can stay in the summary form all they want and reinquire to their hearts content.

If the answer to question #1 is that they don't even need the base functionality, then you wouldn't even need a new form and to duplicate any of the build logic. You could just change the current grid to meet your summary needs and build the grid from your summary data instead of how it's doing it from the S&D cache.

Good luck.
 
Hi JMR, Thank you for your help.

First, I want to apologize to all for posting this in the wrong forum. Technically this is a development question, but I had been away for so long that I just saw E1 and posted there.

JMR, I was afraid you'd give me that answer. The truth is our users typically don't use the main form, but want to go straight to different summaries of the data. Our discussions lead to inevitably rebuilding the P4021 for our summary purpose, but wanted to hold it off for workload reasons.

Thank you very much for your help.
 
Back
Top