cancel
Showing results for 
Search instead for 
Did you mean: 

Reg: Message Pool

Former Member
0 Kudos

Hi All,

Can anybody tell me about Message Pool. How can we use Message pool for validations. Actually when we are working on tutorial 3 error messages Application. I am unable to understand the code in that tutorial. Please help me on that.

Thanks

Madhav

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

For validation..

public boolean CheckValidation( )

{

//@@begin CheckValidation()

IWDMessageManager msg=wdComponentAPI.getMessageManager();

String value=wdContext.nodePassenger().currentPassengerElement().getAttributeAsText("NAME");

int value1=wdContext.nodePassenger().currentPassengerElement().getAGE();

String value2=wdContext.nodePassenger().currentPassengerElement().getAttributeAsText("GENDER");

if(value.length()==0)

{

msg.reportMessage(IMessageFlightComp.MISSINGNAME,new Object[]{"NAME"},false);

return false;

}

else

{

String name = wdContext.nodePassenger().currentPassengerElement().getNAME();

int i,len = name.length();

for(i=0;i<len;i++)

{

if(!((name.charAt(i)<=90 && name.charAt(i)>=65) || (name.charAt(i)<=122 && name.charAt(i)>=97) || name.charAt(i)==32 || name.charAt(i)==46))

{

msg.reportMessage(IMessageFlightComp.NAME_ALPHABETS,new Object[]{"NAME"},false);

return false;

}

}

Urs GS

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi Kodalivenu,

The Message Pool is mainly used for internationalization.Look here to understand the purpose you'll require to open the Message Pool and try creating a message within it.Now the dialog box that appears will ask you for the message text type and there'll be a checkbox checked for translatable.This I guess clarifies the

relevance.Now for understanding the code:

IWDMessageManager msgMan = wdComponentAPI.getMessageManager();
    msgMan.reportMessage(msgItem,null,false);
// here you'll have msgItem = which is the Message Key of the Message Created.
/// null = represents an object argument which Object[].
/// boolean value represents the navigation =  ... If you have to cancel navigation the basis of the Message ... pass true

Now there is another way of accessing the Messages and that is through the text

accessor take a look at the following code:


IWDTextAccessor textAccessor = wdThis.wdGetAPI().getComponent().getTextAccessor();
		textAccessor.getText(String MessageKey);

I think the code is self explanatory.

Regards

Amit

Former Member
0 Kudos

Hai,

You can create no.of messages in a pool in key value type format

eg:

key type value

Missing Input error Please Enter . here means avariable, when you call this message you need to send this variable, like you can send any variable to message ,,,.... below code is to get the message manager IWDMessageManager msgMgr = wdComponentAPI.getMessageManager(); now you are reporting an exception to an attribute IMessageSimpleErrors.MISSING_INPUT :This Represent an access key for message. new Object[] {"Name"} : you are apssing value to variable, as you defined message pool.

now the message look like Please Enter name (repalced eith name).

msgMgr.reportContextAttributeMessage(

wdContext.currentContextElement(), attributeInfo, IMessageSimpleErrors.MISSING_INPUT, new Object[] {"Name"},

true);

Regards,

Naga

Former Member
0 Kudos

Hi,

Workout below application,u will get idea about that,

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20jav...

[REMOVED BY ADMIN]

Message was edited by:

Craig Cmehil

Former Member
0 Kudos

Hi

Check this link this maybe helpful to you

See http://help.sap.com/saphelp_nw04/helpdata/en/72/1d6526263ff24995016a152705eab2/content.htm

Regards

SURYA

Former Member
0 Kudos
Former Member
0 Kudos

Hi ,

Here is a sample code to know how to use message pool in validation.

public boolean CheckValidation( )

{

//@@begin CheckValidation()

IWDMessageManager msg=wdComponentAPI.getMessageManager();

String name=wdContext.nodePassenger().currentPassengerElement().getAttributeAsText("NAME");

if(name.length()==0)

{

msg.reportMessage(IMessageFlightComp.MISSINGNAME,new Object[]{"NAME"},false);

return false;

}

else

{

return true;

}

}

Here MISSINGNAME is the message Key, with message type 'error' , and message text "Please enter Name"...

And NAME is the context Element...

Hope it will help you...

Message was edited by:

Prabhakaran T.K.

Former Member
0 Kudos

Hi ..

Message Pool:

Creating a Message

...

1. Start the Message Editor in subnode Message Pool of the appropriate Web Dynpro component by double-clicking or by selecting the entry Message editor in the context menu. The user interface of the Message Editor appears.

2. If you choose Add Message, a dialog box appears in which you can create a message. Enter any name that is unique in this Message Pool for the message key, and select the message type from the dropdown box or using the input help F4.

3. Now enter the corresponding message text. Save the messages by placing the cursor on the project name in the Web Dynpro Explorer and choosing Save all Metadata in the context menu. See also Message Editor.

1. Open the Message Editor as described above. A dialog box appears that contains the messages already created.

2. Click on an entry to select it.

3. If you choose Edit this Message –Open Editor Dialog, a dialog box appears in which you can edit or change an existing message.

4. After you have made your modifications, choose OK to confirm the changes. To save the modifications, choose Save all Metadata in the context menu for the Web Dynpro project in the Web Dynpro Explorer.

Deleting a Message

...

1. Open the Message Editor as described above.

2. Click on an entry to select it.

3. If you choose Delete this Message, the system deletes the message immediately without asking for confirmation. After you have deleted the entry, you save the modifications by choosing Save all Metadata in the context menu for the Web Dynpro project in the Web Dynpro Explorer.

Hop it will help u..

URs GS

Former Member
0 Kudos

Satish,

why dont you try

<a href="http://help.sap.com/saphelp_erp2005/helpdata/en/36/d4528e6dbf084b9d79a50fb8d08e86/content.htm">http://help.sap.com/saphelp_erp2005/helpdata/en/36/d4528e6dbf084b9d79a50fb8d08e86/content.htm</a>

I think the link would have given the same information you copy pasted from there.

Amit

Former Member
0 Kudos

hi kesari...

cool buddy..

Tht person only wants the explanation... Not to paste links ... Ok...

If the links contains massive amt of data, then only we can paste those links... ok..

Urs GS.......

Former Member
0 Kudos

Hi Kesari,

What Sathish did is correct.

If all are pasting the links as you said above, it would be a double work for every user. If there is massive data, in that link then you can paste the link...

Thanks and Regards,

Arun..

Former Member
0 Kudos

Hi Satish,

I am no controller of this forum.Niether do I want to make such posts.What I meant of the post is that one should rather write his/her own experience rather paste some help.sap.com link or data .The assumption over here that others dont have access to help.sap.com is not required.Preserve your post for something you want to share which you have experienced rather than posting help.sap links or data which does'nt make any sense over here with a particular.I dont get the concept in this case of what you are trying to achieve because this is a forum and if you dont have anything original or pertaining to your experience to say.There'll be others who will be definitely help. So dont be so desperate to help that you start posting help.sap data directly and

also

If I take ur point that you gave in you previous post lets see what you did :

If you look at the first link which also comes from the help.sap.com compare the size of content you have pasted to the size of the information on the page ;).

maybe that will clear your own doubt 😊

Happens sometime.Dont worry I am cool man!

Regards

Amit

Message was edited by:

Amit Kesari

Message was edited by:

Amit Kesari

Former Member
0 Kudos

Hi kesari..

Ok fine.But, Hereafter Don give your personal opinions in others thread. Try to avoid tht. Bcz forum is only for sharing our experiences and helping to others. Dont Interfare and disturb others by giving opinions..

Urs GS...

Former Member
0 Kudos

Now I will give you my opinion which happens to also be part of the guidelines of this community.

1) Keep the conversation cordial no ATTACKS.

2) If a user is asking something and the answer is right there in help.sap.com which EVERYONE has access then post the link is the right way to go.

If every user jumps in (and I see multiple cases right here in this thread) and adds their thoughts then why should a user ever have to actually search and do a bit of research (and thus learn) on their own. This is not a place of "quick answers" but rather a place to interact with your peers and learn from one another not to simply get the answer and be done with it.

So if the answer is already there "LINK TO IT" don't repost the answer. Users should learn from the example of all of us and "SEARCH FIRST".

The other thing to remeber 90% of experience is opinion, it's your interpretation of "how it's supposed to be"