Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Invoking a MAIN window tex element after the execution of MAIN window

Former Member
0 Kudos

Hi,

Is it possible to invoke a text element in the MAIN window after the execution of MAIN window is over ?

I understand that MAIN is the first window to get executed. Now If I were to have some text that needs to be printed in the MAIN window but depending on the value of a certain variable "V" that gets decided in another window in the Script(which is ofcourse executed after the MAIN window) ?

I understand that this could be possible if I were to incorporate the ENTIRE logic used to determine the value of variable "V" in the print program where other active text elements are invoked. But I was wondering if I could leverage on the logic that already exists in the non-MAIN window in the Script without duplicating it in the print program.

Thanks,

S.

5 REPLIES 5

Former Member
0 Kudos

Hi Samarth,

definitely u can do that...u can call ur text element in the main window conditionally. i presume that the variable u r talkin about in the non-main window is also available in the print program. so u can chk the value of this variable n call ur MAIN WINDOW TEXT ELEMENT accordingly.. the things within a text element are never executed wen u do not call them explicitly...

hope it helps..

0 Kudos

Hi Bikash,

Thaks for the quick reply. I am sorry I forgot to mention: NO, the variable "V" is not available in the print program directly, as it is "DEFINE"d in the Script itself locally in the non-MAIN window.

Also, the entire logic for "V" is written in that window itself. Therefore even If I were to write a <b>PERFORM <routine> IN PROGRAM <print program> USING <variable V>, ENDPERFORM</b> in the non-MAIN window after "V" is determined, and try to call the text element in the print program, it does not work as the execution of MAIN window is already over by that time.

Is there a way to get past this limitation or am I missing something really simple ?

Thanks,

S.

0 Kudos

HI samarth,

In that case, you cannot do what you are trying to do.

YOu have to copy the code in the main window text element and paste it in your non-main window text element.

Regards,

Ravi

Former Member
0 Kudos

Hi

try this out

set a flag in the non main window and run that non main window without writing anything on the form .after calculating the value of V store it a variable(say V1) .

now u can run the main window , get the value from V1.

now clear the flag in the non main window.

0 Kudos

Thank you Bikash, Ganesh and Ravi Kanth.

I finally settled with duplicating the logic (present in the non-MAIN window)in the print program so as to predict the value of "V" the same way it would have been decided in the Non-Main window. There were reasons for that although it may not have been the most efficient solution. It was anyway bad programming practice to have written solid logic in a SAP Script window as opposed to the print program, but it was not my code anyway.

Since the MAIN window gets executed almost as a default before any other window, the only way of triggering another/all other windows would have been to trigger a PAGE-BREAK at the appropriate place, which unfortunately has implications that are not desirable in the current requirement.

Setting a flag and explicit calling of the main window after the execution of a non-MAIN window does not look like its possible.

Thanks,

S.