cancel
Showing results for 
Search instead for 
Did you mean: 

How to Display messages within a popup window?

Former Member
0 Kudos

Hello everybody,

I am trying to display a message using the message maanger within a popup window but it doesnt work.

What I have is a parent view which creates a new popup view.

If i simply use the message manager, the messages are displayed in the parent view.

However, if I try to create a UI element of a message area inside the popup view, from the moment the child popup is shown, it seems that all the messages are directed to this message area, even if the popup is now hidden.

The same scenario repeates itself if i try to create two message areas.

Is there a correct way of doing this because im current unable to get it working.

thanks in advance,

Eli.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I've worked on one such requirement. Hope this will help you.

Requirement: The parent window has a message area UI element whose visibility is controlled by a visibility context value attribute. The parent window has a button, on click of which a pop-up window appears. The requirement is to provide an error message in this pop-up window on the basis of some conditions. But, the challenge is that the message area UI element doesnu2019t works in pop-up window.

Solution Steps:

1. Instead of taking a message area UI element, add a group UI element in your view layout in which the error message is required i.e. the pop-up view.

2. Map the visibility property of this group UI element with a visibility context value attribute (e.g. ctx_va_messageVisibility).

3. Set the layout property of this group as flow layout.

4. In this group, add an image UI element and a text view UI element.

5. Take the error image (red exclamation mark) in GIF format and save it in the MIME folder of your project hierarchy in WD explorer.

6. In Image UI elementu2019s alt property as well as source property, write the name of that GIF file (e.g. ERROR.GIF).

7. Declare a context value attribute of type string to store the error message text (e.g. ctx_va_message).

8. Map the text property of the text view UI element with this value attribute.

9. Add the following piece of code in the wdDoInit() hook method of the view:

wdContext.currentContextElement().setCtx_va_message(null);

10. Add the following piece of code in wdDoModifyView() hook method of the view:

IWDMessageManager l_mngr = wdThis.wdGetAPI().getComponent().getMessageManager();

if (l_mngr.isEmpty()) {

wdContext.currentContextElement().setCtx_va_messageVisibility(WDVisibility.NONE);

} else {

wdContext.currentContextElement().setCtx_va_messageVisibility(WDVisibility.VISIBLE);

}

11. In the view, where you want the message to be printed, write the following piece of code after checking the required conditions (if any):

wdComponentAPI.getMessageManager().reportException(wdComponentAPI.getTextAccessor().getText("Error message key"), true);

wdContext.currentContextElement().setCtx_va_message(wdComponentAPI.getTextAccessor().getText("Error message key"));

With thanks

RV

former_member185879
Active Contributor
0 Kudos

Hello Rohit,

Is this solution applicable for the following situation:

i will get the messages from RFC like the following:

Type Msg

S SO # Created Successfully

W Check Configuration

S Header/Items processed successfully

E Check the Documents.

I want to display as it is in the POP-UP View.

is this possbile?

Regards

Nizamudeen SM

Answers (5)

Answers (5)

david_palafox
Explorer
0 Kudos

There is actually a standard way to display a message window without having to create another view. It works perfectly for scenarios where you need to show a simple message with no input fields or things like that. It does provide you with at least one action button for which you can define its functionality and even better, it blocks the view until you select an option from the message window. Looks pretty nice and works great... here's the how-to...


// Pop-Up Generation with message and default button
// If you want message to just be informative, you still need that default button
// so you can create an action or event handler with no code
IWDConfirmationDialog confDialog;
confDialog = wdComponentAPI.getWindowManager().
             createConfirmationWindow( YOUR MESSAGE,
                                       ACTION OR EVENT HANDLER FOR BUTTON,
                                       BUTTON TEXT );

// Aditional buttons
confDialog.addChoice( ACTION OR EVENT HANDLER, BUTTON TEXT );

// Message window header and alignment
confDialog.setTitle( HEADER TEXT );
confDialog.setWindowPosition( WDWindowPos.CENTER );

// If you want, you can set window size in pixels, if not, sizes to fit
confDialog.setWindowSize(90,90);

// Show the popup ( this replaces deprecated confdialog.open(); )
confDialog.show();

Now, I know this works since I used it myself. If you have any problems, feel free to ask.

Edit...

I prefer to use EventHandlers for the buttons, you can access those by

wdThis.WD_EVENTHANDLER_EVENTHANDLERNAME

Otherwise, you could try

IWDControllerInfo controllerInfo = wdControllerAPI.getViewInfo().getViewController();

to access your view controller and get the Event Handler or Action you need from it.

Edited by: david.palafox on Dec 31, 2010 6:54 PM

former_member185879
Active Contributor
0 Kudos

Hello Eren,

Try the solution suggested by Shubham in the following thread.

Regards

Nizamudeen SM

Former Member
0 Kudos

Hello Eren,

Please let me know that whether the solution provided by me solved your probelm or not???

With thanks

RV

Former Member
0 Kudos

Hi,

I think this method will work when the error message details are coming from an RFC execution. In that case also, we need to store the message details in some local context and then manipulate it as required. You can check for that...

With thanks

RV

former_member185879
Active Contributor
0 Kudos

Hello Eren,

I hope/think it is not possible, as because it is a framework controlled, the same thing happening in WD ABAP also.

If someone found, then provide us the solution, it will be helpful for everyone.

Regards

Nizamudeen SM