cancel
Showing results for 
Search instead for 
Did you mean: 

Get Message from ABAP function module to web dynpro application

Former Member
0 Kudos

Hi,

How to get the messages which will be displayed in abap function module when u execute it. And i want to display those messages in my application.

Regards,

H.V.Swathi

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

HI

Simply ask your Abaper to put the message in a attribute of string . or char ...

you can capture the attribute in String abc..;

call your RFC

ex. String abc = wdcontext.currentcontext.getMessage();

wdcomponentAPI.getmessagemanager.reportSuccess(abc);

Edited by: murali krishna reddy on Mar 13, 2009 11:42 AM

former_member185086
Active Contributor
0 Kudos

Hi

Its a simple and straight forward solution ,but please understand it first then only ask any question .

1. BAPI returns a different kind of message like ERROR,WARNING and information .

2.So write one generic method which will take care about all the message of any kind . this method require a parameter of type IWDNode

public void populateMessage( com.sap.tc.webdynpro.progmodel.api.IWDNode messageNode )  {
    //@@begin populateMessage()
		String msg = null;
		for (int i = 0; i < messageNode.size(); i++)
		{
			if (messageNode.getElementAt(i).getAttributeValue(IPublicModelComp.IIt_ReturnElement.TYPE) != null
					&& messageNode.getElementAt(i).getAttributeValue(IPublicModelComp.IIt_ReturnElement.TYPE)
							.toString().trim().length() > 0)
			{
				if (messageNode.getElementAt(i).getAttributeValue(IPublicModelComp.IIt_ReturnElement.TYPE)
						.equals(ERROR))
				{
					msg = messageNode.getElementAt(i).getAttributeValue(IPublicModelComp.IIt_ReturnElement.MESSAGE)
							.toString();
					wdComponentAPI.getMessageManager().reportException(msg);
				} else if (messageNode.getElementAt(i).getAttributeValue(IPublicModelComp.IIt_ReturnElement.TYPE)
						.equals(WARNING))
				{
					msg = messageNode.getElementAt(i).getAttributeValue(IPublicModelComp.IIt_ReturnElement.MESSAGE)
							.toString();
					wdComponentAPI.getMessageManager().reportWarning(msg);
				} else
				{
					msg = messageNode.getElementAt(i).getAttributeValue(IPublicModelComp.IIt_ReturnElement.MESSAGE)
							.toString();
					wdComponentAPI.getMessageManager().reportSuccess(msg);
				}
			}
		}

3. When u have to call this method :

Whenever u execute any BAPI/RFC immediately after that u have to call like

executeModelClass(wdContext.nodeOutput_Create_Serv_Pro(), createRecordDHC);
		*populateMessage(wdContext.nodeReturn_Create_Serv()*);

Dont confused here I have written generic method for model execution also,

Best Regards

Satish Kumar

Former Member
0 Kudos

Can u explain me about

com.sap.tc.webdynpro.progmodel.api.IWDNode messageNode

this code.

Regards,

H.V.Swathi

former_member197348
Active Contributor
0 Kudos

Hi Swathi,

Which are the messages you are talking about?

If you are talking about the messages that are displayed in return table of teh BAPI, try this.

Create a table and bind it with the Return node inside the Output node of the BAPI.

OR

you can use TextView UI element and bind it message attribute in Return node

OR

wdComponentAPI.getMessageManager().reportSuccess/Warning("BAPI:"+wdContext.getReturnElementAt(0).getMessage());

regards,

Siva

Former Member
0 Kudos

Hi,

Thanks a lot to your reply.

But i have a doubt. In the method

public void populateMessage( com.sap.tc.webdynpro.progmodel.api.IWDNode messageNode )

Your passing one parameter Called messageNode of type com.sap.tc.webdynpro.progmodel.api.IWDNode

What does it means. what value your passing.

Can you please explain me about this.

Regards,

H.V.Swathi

former_member185086
Active Contributor
0 Kudos

Hi

For example here

1.First I execute the model

executeModelClass(wdContext.nodeOutput_Create_Serv_Pro(), createRecordDHC);

2.and populate the messsage

populateMessage(wdContext.nodeReturn_Create_Serv());

This node wdContext.nodeReturn_Create_Serv() which is passed to the parameter of this method is that node of BAPI/RFC which contain the message and bound in our context node.

Best Regards

Satish Kumar

Former Member
0 Kudos

Hi Thanks for ur help.

But i am getting This error in the code of populatevalue method.

IPublicExcelTestCust.IZup_Desig12_InputElement.TYPE cannot be resolved.

what might be the problem.

Regards,

H.V.Swathi

former_member185086
Active Contributor
0 Kudos

Hi Swati

IPublicExcelTestCust.IZup_Desig12_InputElement.TYPE cannot be resolved.

Since you are passing the element rather than node .

At least u have to understand this first that what is the structure of RFC/BAPI about input ,Output and Message Node(Take help from any person who knows RFC/BAPI structure)

Then u will come to know that All message are there in one Node and from this node u have to fetch the value.

I already mentioned Its a Node still u are passing element.

Best Regards

Satish Kumar