cancel
Showing results for 
Search instead for 
Did you mean: 

By clicking on a button i want a message

Former Member
0 Kudos

Hi,

there are only two fields in my view, one is label and the other one is button. i want to get a message with help of the <b>"Message pool"</b> by clocking on the button. could any body help me out with the code.

thanks

Suresh

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi SureshKumar Arumugham

Open the Message Pool edit the following details

<i><b>MessageKey =</b></i> ButtonClicked

<i><b>MessageType =</b></i> standard

<i><b>Message Text =</b></i> You had Clicked the Button times.

Now Create a Button in the and also create an action for that button.( eg Show_Message).

Inside The Action write this code...

public void onActionShow_Message(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionShow_Message(ServerEvent)
    i=i+1;
    wdComponentAPI.getMessageManager().reportMessage(IMessageTest_Button_App.BUTTON_CLICKED,new Object[] {" "+i},false);
    //@@end
  }

Declare a variable " i " Globally

/** You will find this at the end of the coding page ***/

//@@begin others

int i = 0;

//@@end

Now Execute Your Application

The output will be in such a way that how many times you had clicked the button.......

Regards

Chandran S

Former Member
0 Kudos

Hi Suresh,

Write this line in your button's action:

wdComponentAPI.getMessageManager().reportMessage(IMessage<viewname>.<messagekey in message pool>,null,true);

Warm Regards,

Murtuza

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

This will help you using Message Editor

http://help.sap.com/saphelp_nw70/helpdata/en/ae/4fd9b1ff5c8449b276586e801e5cfe/frameset.htm

you can use this statement to write message

wdThis.getComponent().wdGetAPI().getMessageManager().reportSuccess( 'Message here' );

Regards

Abhimanyu L

Former Member
0 Kudos

Hi! Suresh,

Create an Object of MessageManager by this code :--

MessageManager msgMgr = (MessageManager)

wdThis.wdGetAPI().getComponent().getMessageManager();

Now use msgMgr object to print the message from MessagePool Like:--

msgMgr.reportMessage

(IMessageRemoveUserComp.WARNING_USER_ID, null, false);

enjoy,

Mithileshwar

Former Member
0 Kudos

Hi Suresh

IWDNodeElement task = node.getElement();

manager = wdComponentAPI.getMessageManager();

IWDAttributeInfo attibute = node.getNodeInfo().getAttribute(XX);

String message = wdComponentAPI.getTextAccessor().getText(IMessageXX.Messagepool_Name);

manager.raiseInvalidContextAttributeException(task, attibute, message, true);

manager.raisePendingException();

Regards

Chaitanya.A