cancel
Showing results for 
Search instead for 
Did you mean: 

How display a message of an exception in Webdynpro Java

Former Member
0 Kudos

Good Morning.

I am creating a Webdynpro Java using a Function Module(RFC) in the system ECC.

The RFC send an exception when the employee want register overtime in the Planned Working Time.

The employee work with a Working Time between 8:00 and 17:00. The employee not can register overtime in this time.

The system in the test of the RFC display the exception.

How can i display the message of this exception in the portal in the development of Webdynpro Java that i am creating?

Kind Regards

Accepted Solutions (1)

Accepted Solutions (1)

christiansche
Active Participant
0 Kudos

to use a table, you won't have to write javacode. go to layout of the view. In the Outline select a Container. Right click on it. Select "Apply Template", Select "Table". click next. Mark the return node and its elements. click next. check that "textView" is set as editor. click finish.

now you will have a new table, that displays the content of the retun table.

best regards,

christian

Former Member
0 Kudos

Hi Cristian,

I have a parameter of output in the RFC that have the text of the error.

How can display the text in the webdynpro?

What is the statement òr source code?

Kind Regards

christiansche
Active Participant
0 Kudos

Add a MessageArea to your View Layout.

in your code add:

IWDMessageManager messMan = wdComponentAPI.getMessageManager();

messMan.reportException(wdContext.currentYourRFCNodeElement.getYourParameterName(), true);

Then messageManeger will show the Message in the MessageArea.

Answers (3)

Answers (3)

christiansche
Active Participant
0 Kudos

hi,

as Sinivasan Rajam... said, this will be usually in the return table of the function module. Chech your RFC for the Table. In Webdynpro, you should then have an imported reurn node. maybe it's called something like "bapireturn".

To display the messages, you can use the Webdynpro MessageArea or just a table to check if it works.

best regarsds,

christian

Former Member
0 Kudos

Good Morning.

I am new in webdynpro Java.

Can help me with What is the source code for display this message?

Kind regards

Former Member
0 Kudos

Hi,

See the below code,


try{
    execute your RFC....
}
catch(WDDynamicRFCExecuteException e){
   manager.reportException(e.getMessage());  "This print your exception.
 }

Regards,

Eduardo Campos

Former Member
0 Kudos

Hi eduardo.

If i use the source code:

try{

execute your RFC....

}

catch(WDDynamicRFCExecuteException e){

manager.reportException(e.getMessage()); "This print your exception.

}

The system display the message having in count the exception?

Kind Regards

former_member197348
Active Contributor
0 Kudos

Hi,

If you have multiple lines of message bind Output-> Return node to table in the appropriate place of the view.

If it single line message, then writ the code where you want to display the message.

wdComponentAPI.getMessageManager().reportException(wdContext.currentReturnElement().getMessage(),true);

regards,

Siva

Former Member
0 Kudos

Hi Siva Rama Krushna

I read in Internet the following:

The WDDynamicRFCExecuteException will only catch the exceptions that are thrown if under certain circumstances the RFC could not be executed. This will not catch the exceptions that are raised by the Function module.

How can catch exceptions that are raised by the Function module?

Kind Regards,

Former Member
0 Kudos

Hi,

Yes the system will display the exception that returns the RFC.

Regards,

Eduardo Campos.

Former Member
0 Kudos

Eduardo The portal display the code of the exception , not the reason or cause of the error.

Eduardo El portal visualiza el codigo de la excepcion que esta en el RFC, mas no la razon o la causa del error, por ejemplo NOT_PERN, mas no viasualiza un mensaje diciendo que el numero de personal no existe.

Kind Regards

former_member305573
Participant
0 Kudos

Hi

As per my understanding about yourquestion you want to display Exception message snt by the RFC.

For that You need to print the return message from RFC.

if (wdContext.current RFC Return Output Element() != null) {

Sring type = wdContext.currentReturnRFCuptputtElement().getType();
if (type.equals("S")) {
	IWDControllerInfo controllerInfo =wdControllerAPI.getViewInfo().getViewController();
	String dialogText =wdContext.RFC return outtputtElement()
				.getMessage();
	IWDConfirmationDialog dialog =wdComponentAPI.getWindowManager().createConfirmationWindow(
		dialogText,controllerInfo.findInEventHandlers("Eventhadlername"),"ok");
		dialog.show();
										}

if (type.equals("E")) {
	
	IWDControllerInfo controllerInfo =wdControllerAPI.getViewInfo().getViewController();
	String dialogText =wdContext.current RFCReturnoutputElement().getMessage();
	IWDConfirmationDialog dialog =wdComponentAPI.getWindowManager().createConfirmationWindow(dialogText,
	controllerInfo.findInEventHandlers("Event handeler name"),"ok");
	dialog.show();
											}

	}

In Above code "S" Represent the success message and "E" Represents the error message.

In the above code I m checking the return message type withh null , Because if message will not matined in Backend than it will give null pointer exception.

I Hope this code will solve yor Problem.

Prashant Krishen

Former Member
0 Kudos

Hi,

This will be available in the Return node of your response node.

Srini