cancel
Showing results for 
Search instead for 
Did you mean: 

Backend error message in webdynpro java

Former Member
0 Kudos

Hi all,

i need to show the backned r/3 error message in webdynpro java, the backned error message as a String type.

when ever i click on inputfield or search button or checkbox in my view layout in webdynpro java , i need to show the successul message as blue color mark or error message as red color mark, as the data is available in backend or the data is not available in backned.

help me in doing this step by step, thanks in advance

Thanks&Regards

jay

Accepted Solutions (0)

Answers (3)

Answers (3)

pradeep_kumar5
Active Participant
0 Kudos

Hi Jagadeesh,

Ask your ABAP'er to use Export parameter in that RFC.

Assume we have one RFC, it takes name as input parameter, it inserts / updates name in that table and gives status as successful if inserted / updated else any error message. He will write code in RFC like this.

//Import parameter:

TName TYPE Z<Tablename>-name.

//Export Parameter:

Status TYPE String.

//Source code:

insert / update z<tablename> set name = TName.

IF sy-subrc =0.

status = 'Record Updated / inserted successfully '.

else

status = 'No Record Update / Inserted'.

END IF.

Activate RFC.

In webdynpro java,

//set the name for RFC:

wdContext.currentZ<RFCName>Element().setName("SAP SDN");

//excecute RFC:

wdThis.wdGet<component name>Controller().execute<RFCMethod name>();

String status = wdContext.current<Output RFCName>Element().getStatus();

if(status.equals("Record Updated / inserted successfully")){

wdComponentAPI.getMessageManager.reportSuccess(status); // Automatically displays in Green color

}

else{

wdComponentAPI.getMessageManager.reportWarning(status); // Automatically displays in Red color

}

Hope it helps

Regards,

Pradeep Kumar G

Former Member
0 Kudos

Hi ,

Use the Try and catch .like below

try {

wdContext.currentFMElement().modelObject().execute();

for (int i = 0; i < wdContext.nodeFM_Return().size(); i++) {

Message = wdContext.currentFM_ReturnElement().getMessage();

// wdComponentAPI.getMessageManager().reportSuccess(

// Message);

if (wdContext

.currentFM_ReturnElement()

.getType()

.equalsIgnoreCase("E")) {

wdComponentAPI.getMessageManager().reportException(

Message,

true);

}

}

} catch (WDDynamicRFCExecuteException exRFC) {

wdComponentAPI.getMessageManager().reportException(

exRFC.getNestedLocalizedMessage(),

true);

}

Here the ABAPer is returng the message of Type "E" .

Regards,

Govindu

former_member185879
Active Contributor
0 Kudos

Hello Jagdeesh,

1. You can search in SDN on how to execute RFC or how to work on RFC's!

2. Once you executed, ask the ABAP'ers to give you the message like follows(following are the sample one):

MSg_type MSG

"S" Hello World - Success

"E" Hello Wordl - Error.

3. Now loop the output table node which coming from RFC and check for the Error Type. if Err Type is "S" then go for ReportSuccess and etc.,

if(wdContext.nodeOutput().getOutputElementAt(i).getMsg_Type().equalsIgnoreCase("S")

{

wdComponentAPI.messageManager().reportSuccess(wdContext.nodeOutput().getOutputElementAt(i).getMsg());

}

else if("E")

{

reportException();

}

and so on.

Regards

Nizamudeen SM