Page 1 of 1

(RPG) Call stack of RPG / LongRange

Posted: Thu Oct 18, 2012 1:34 am
by JoeHam
Hello everybody,
I have a question concerning the call stack of LongRange and RPG. I hope I will be succesful in explaining our problem because it seems to be a little bit complex (at least to me).

Please let me first explain what we are actually doing:

In LongRange studio we define a main menu with a menu item "Geschaeftszahlen und Umsatz". Target Type is FormView, target object is a RPG program called JH_STRBU.
This RPG program JH_STRBU serves as a menu program and by using push buttons (and onclick requests) it calls other RPG programs.
One example for such a call is this:
When (RequestACTION = 'AGRUMS');
GZ_RQ_ACTION = 'GESAMT ';
GZ_RQ_PGM = 'JH_AGRUMS';
CallP JH_AGRUMS(GZ_RQ_ACTION:GZ_RQ_PGM:SavedSTATE:SystemINFO);

In the now called RPG program JH_AGRUMS we defined a back button to return to the menu RPG JH_STRBU.
For preventing going back to JH_STRBU while still handling other requests in JH_AGRUMS we inserted the following statement into Subroutine "DisplayFormView":
If (RequestACTION <> 'BACK_TO_JH_STRBU');
RequestPROGRAM = 'JH_AGRUMS';
Else;
RequestPROGRAM = 'JH_STRBU';
EndIf;

And now here is the problem:
when I leave JH_AGRUMS using the Back-Button I return to JH_STRBU. Then I use the LongRange-Menu-Button in the top left of the first row of the screen to go back to main menu. Now I can activate other menu items without any problems.
But when I use this MENU-Button in JH_AGRUMS and then return to main menu I cannot activate any other menu item after that. No matter which item I choose: JH_AGRUMS is always activated and shown on screen (but in the first row on the screen the symbolic name of the selected menu item is shown).

There must be some part in our programming in which we corrupt the normal invocation stack / invocation routine of LongRange. Or is it simply impossible to create own (RPG) menu programs to control the application flow.
Is there a way to disable the Menu-Button on the screen in any way?

If any screen shots or code snippets would be helpful for better understanding please let me know.

With many thanks for your support,

Joerg

Re: Call stack of RPG / LongRange

Posted: Thu Oct 18, 2012 9:42 am
by MarkDuignan
Please see attached

Re: Call stack of RPG / LongRange

Posted: Thu Oct 18, 2012 6:44 pm
by JoeHam
Hi Mark,
a huge "thank you" for the very detailed answer.
I will work it over and I'm sure that I can realize our project now.

Background for creating an own menuing structure is this:
we are going to make a presentation for managers and presidents (existing customers who are using our IBMi ERP system) to show them the abilities of LongRange applications. For purposes of Corporate Identity and "making a big impression" I shall design a start screen / menu screen with company logo, some individual pictures, personal welcome messages etc. And since we are not sure if we can reach this by using the LongRange menu system we decided to use an RPG contol program.

Best regards,
Joerg

Re: Call stack of RPG / LongRange

Posted: Fri Oct 19, 2012 3:14 am
by JoeHam
Hi Mark,
I got it working! :D
Thank you once again,
Joerg

Re: Call stack of RPG / LongRange

Posted: Fri Oct 19, 2012 8:39 am
by MarkDuignan
That's great.

Please have a look at the attached regarding using the LongRange menus and welcome screens.