Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Error handling in Table records

hai to everyone ,

i have one table in madatory field is there , enter records 5 records in 5 of 3 records are not entered mandatory records.

i written message for incase not entered filed.

but here problem is , It showing for each record showing message that is 3 lines are coming.

instead of 3 lines we can make in single line which are records are not given madatory fileds.

is it possible in message pool..

below is i written code .

if(TableElement.getClientName()!=null&&TableElement.getClientName()!="")
   
  	{
wdThis.wdGetTaskManagerCompController().insertClient(clientName,region,vertical);

}
else{
	wdComponentAPI.getMessageManager().reportException(TableElement.getClientName()+ ":ClientNames"+"fields are mandatory",false);  
		
	}

replied

Hi Eswar..

In order to display a message only once what you can do is,

in ur else stmt where you r displaying the exception msg, you can jst set a boolean flag to true.

Outside the for loop of the table u can chck for that boolean flag and accordingly display the

error msg. U can create a separate function for such error msg dislay so that they can be called wherever

u have to make such missing input validations.

example:

{
boolean flag = false;
for(i=0;i<wdcontext.nodetable.size;i++)
{
.......
........
if(TableElement.getClientName()!=null&&TableElement.getClientName()!="")
    	{
wdThis.wdGetTaskManagerCompController().insertClient(clientName,region,vertical);
 }
else{
flag = true;
	}
........
.......
} // end of for loop

if(flag)
{
checkmandatory(wdcontext.node<table node>,Ipublic<Component name>.I<table element which is empty>,"<label u want to display>");

}
}

 public boolean checkMandatory( com.sap.tc.webdynpro.progmodel.api.IWDNode currentNode, java.lang.String attributeName, java.lang.String fieldLabel )
  {

    IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
    IWDAttributeInfo attributeInfo = currentNode.getNodeInfo().getAttribute(attributeName);
	Object attributeValue =currentNode.getCurrentElement().getAttributeValue(attributeName);

	msgMgr.reportContextAttributeMessage(currentNode.getCurrentElement(), attributeInfo,IMessageGenClmApp.MISSING_INPUT,new Object[] {fieldLabel},true);
			return true;
}	

the MISSING_INPUT here is the msg maintained in the component msg pool.

Hopefully i have answered ur question.

Regards

Asha

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question