cancel
Showing results for 
Search instead for 
Did you mean: 

Alert message when No Data Found

Former Member
0 Kudos

Hi All,

In my WebDynPro form, I have a field UserId. When the user gives some value (0003,0004) the user details are populated in the form.

I want that when the user gives some wrong value in the filed eg. 9999 then BAPI will not return any data. So an alert message should be given "No Data Found" and the focus should go back to the User Id field.

Please provide some inputs.

Regards

Nikhil Bansal

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

After Executing the Function module u need to find the size of your Outputnode

And based on size u have to display the error message and terminationg the control like this.

try{

wdContext.current<FNMOdule>_Inputele.modelObject().execute();

wdcontext.nodeOutput().invalidate();

int i= wdContext.node<outputnode>.size();

if(i == 0)

{

wdThis.wdGetAPI().getComponent().getMessageManager().reportException("No Records Found",true);

}

}

catch (Exception ex)

{

throw new WDRuntimeException(ex);

}

It might helps you.

Thanks,

Lohi.

Former Member
0 Kudos

Hi Lohitha,

Thanks for the input.

When the Bapi is not returning any data then also the nodesize is 1.

So I am unable to check if the data is found or not.

Plz provide some help.

Regards

Nikhil Bansal

Former Member
0 Kudos

Hai,

may be your function module may return some data other wise

wdContext.nodeOuput().size() becomes zero.

to set focus on a ui element

in wdDOModifyView(){

IWDInputField input = (IWDInputField)view.getElement("inputField");

input.requestFocus();

}

or you can use view.requestFocus() method

regards,

naga

Former Member
0 Kudos

In place of "report success" you can use many report warning or exceptions....

Former Member
0 Kudos

Lets think you are validating customer id,

String custid = wdContext.currentXXXElement().getVaCustId();

if ((custid == null)) {

wdComponentAPI.getMessageManager().reportSuccess(

"No data found");

}

this will throw the WD error message.

regards,

Deepu