cancel
Showing results for 
Search instead for 
Did you mean: 

using the messages-object on another page?

daniel_humberg
Contributor
0 Kudos

I used to show error messages on the top of my BSP-page by using the messages object. With <i>messages->add_message()</i>, I added the error messages and with <i>message->get_message()</i> I read and displayed them.

Now, I would like to show the messages on a popup-window that shows another BSP-page. Can I access the first page's messages object on the popup-page or is using a global messages object in the application class the only way?

Accepted Solutions (1)

Accepted Solutions (1)

JiriEhrlich
Product and Topic Expert
Product and Topic Expert
0 Kudos

The right way is to use global messages object in the application class & statefull BSP.

Other way is to transfer message table from page to page via navigation->set_parameter

former_member181879
Active Contributor
0 Kudos

> Other way is to transfer message table from page to

> page via navigation->set_parameter

Keep in mind URL is limited to about 2Kb length. The navigation object does a browser redirect transfering the parameters via the URL (by default). Not recommended for tables.

Answers (1)

Answers (1)

Former Member
0 Kudos

Daniel,

I think it should be possible to use JavaScript to read the error message from another page.

If, for example, the two pages are in the same frameset,

and if the first frame contains the message element with

id="MY_MESSAGE_ID", then something like the following could do the job:

<script>

<!--

document.write(parent.frames[0].document.getElementById("MY_MESSAGE_ID-txt").firstChild.nodeValue;

-->

</script>

In a popup window this will be more difficult. I know that there is something like self.creator.xxx.xxx etc., but I am not really sure if this works.

But it's worth a try.

Hope that helps.

Best regards,

Juergen

daniel_humberg
Contributor
0 Kudos

not self.creator but window.opener...

but probably using a global messages object is the better way to go.

Former Member
0 Kudos

Hi Daniel,

You should use server side cookies for transfer data across sessions (or windows)...

Dany

Former Member
0 Kudos

Well, I use a string variable to store the message generated in the first page, then I send it to the next page via parameters. The problem I find is that I don't know how to resize the second page to display it as a small popup windows, just like the javascript method window.alert().

First, the message is generated:

page->messages->add_message(

condition = 'condition'

otr_alias 'ZPQT/TEXTALIAS'

severity = page->messages->CO_SEVERITY_ERROR ).

Second, the message is stored:

message = page->messages->assert_message( 'condition' ) .

Finally, I displayed it with javascript utility:

<script javascript>

window.alert( "<%=message%>" ) ;

</script>

But I wanted to display a different format of popup page, creating it as a BSP page with its own design.

I have done it but can't find the way to stablish the properties of the page (size, menu bar, etc) Just as we do with javascript utility "window.open(,,,)"

Thank you very much.

daniel_humberg
Contributor
0 Kudos

i think you cannot change the window size with ABAP.

The only way to influence it is to use window.open() to open a new window or maybe window.resizeTo(...) to resize the existing window.

(check http://de.selfhtml.org/javascript/objekte/window.htm#resize_to )

Former Member
0 Kudos

No problem, I found the solution quickly to my issue:

I use an empty bsp page called "PruebaPopUpamedida.htm"

I use the following javascript code to calle this page and stablish its content and properties:

And it seems it works, so thank you very much anyway, I hope I can manipulate the layout from the calling page in this script.

Carlos.