cancel
Showing results for 
Search instead for 
Did you mean: 

Validation Problem in WDJ

Former Member
0 Kudos

Hi Friends,

I have one doubt in Validation. When Click on u201CActionSearchViewDemandForeCastu201D

This Button I want some error Message in FV.

So I have to develop Some code but it is not working. Pls give any help.

This is Validation Method

public void Validation( )

{

//@@begin Validation()

IWDMessageManager manager = wdComponentAPI.getMessageManager();

String Bucket = wdContext.currentYmm_Sc_Bapi_Dmndstk_Getlist_InputElement().getP_Bucket();

manager.reportSuccess(" Bucket = " +Bucket);

if( Bucket == null && Bucket.equals(""))

{

// manager.reportSuccess(" Please Enter id ");

//manager.reportException(" Please enter id ",true);

manager.reportMessage(IMessageCom_ViewDemandForeCast.BUCKET,null,true);

}

This Validation Method I was called to Search Method

i.e

public void onActionSearchViewDemandForeCast(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionSearchViewDemandForeCast(ServerEvent)

//$$begin ActionButton(-1313177891)

wdThis.Validation();

wdThis.wdGetCom_ViewDemandForeCastController().executeYmm_Sc_Bapi_Dmndstk_Getlist_Input();

//$$end

//@@end

}

But I m not getting error message when click on Search Button

Req: I want to display error message when click on Search button

Reagards

Vijay Kalluri

Accepted Solutions (1)

Accepted Solutions (1)

Greg_Austin
Active Participant
0 Kudos

Hi Vijay,

Check this line in your code:

if( Bucket == null && Bucket.equals(""))

The Bucket string can never be null and equal to an empty string. I think you want an OR here instead of the AND.

-Greg

Answers (1)

Answers (1)

p330068
Active Contributor
0 Kudos

Hi Vijay

Please print the value of the Bucket

If it null or empty that causing the problem than try with and check the logic what yuu wanted to do exactly

if( Bucket.equals(null)) && Bucket.equals(""))

Hope it helps

Regards

Arun