on 09-24-2008 8:12 PM
Hi ,
I am trying to use fpm.getMessageManager().reportMessage( to print a message on the screen
I put the message in the message pool as
warn_rej ---employee has been rejected and mail has been sent to for employee
I am writing the following code to call getMessageManger() as follows
String[] employeeName = new String[2];
employeeName[0] = this.getEmployeeName(pernr);
employeeName[1] = Manager;
fpm.getMessageManager().reportMessage(
wdThis.wdGetAPI().getComponent(),
"",
WDMessageType.WARNING,
wdThis
.wdGetBEcmPlanningCompInterface()
.getMessagePoolTextExt(
"Warn_Rej",
employeeName));
But the output is like this
employee AAAA has been rejected and mail has been sent to for employee
How will I print the entire message.How do i need to pass the parameters to the method
Thanks
Bala Duvvuri
Hi Bala:
String[] values = {"1","2"};
msgMgr.reportWarning(wdComponentAPI.getTextAccessor().getText(IMessage.MESSAGENAME, values));
good luck!.
Rocío.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bala,
I am trying to customise a ESS iView by adding some error validation to a field. But, I am not sure of the
coding with FPM. Could you help me in this regard. I would appreciate your help. I am explaining my scenario below:-
I have created 3 message in my message pool. They are:-
NoMilesEntered - "Error" You should enter Number of miles travelled.
ZeroMiles - "Error" Please enter valid number of miles for field . You entered , which is not valid.* MoreThanLimit - "Error" *You have entered . You are not allowed to enter more than 500 miles.
Later I have created three methods. They are :-
1)checkMandatory
2)checkMaxLimit
3)checkZeroInput
Later I have written the following code in the implementation tab of the iView.
public void checkMandatory( java.lang.String Miles )
{
//@@begin checkMandatory()
//Get reference to Message Manager
IWDMessageManager msgMan = wdComponentAPI.getMessageManager();
// Get field value of attribute under investigation
String value = wdContext.nodeGeneralData().currentGeneralDataElement().getAttributeAsText(Miles);
// Get field properties of attribute under investigation
IWDAttributeInfo milesAttr = wdContext.nodeGeneralData().getNodeInfo().getAttribute(Miles);
// Check if any input is provided
if(value.length()==0){
//if no: report error, which is related to context attribute under investigation
msgMan.reportContextAttributeMessage(
wdContext.nodeGeneralData().currentGeneralDataElement(),
milesAttr, IMessageVcTreGeneralData.NO_MILES_ENTERED,
new Object[] {Miles}, true);
}
//@@end
}
//@@begin javadoc:checkZeroInput()
/** Declared method. */
//@@end
public void checkZeroInput( java.lang.String Miles )
{
//@@begin checkZeroInput()
// Get reference to the Message Manager
IWDMessageManager msgMan = wdComponentAPI.getMessageManager();
//Get field value of attribute under investigation
String value = wdContext.nodeGeneralData().currentGeneralDataElement().getAttributeAsText(Miles);
int i = Integer.parseInt(value);
//Get field properties of attribute under investigation
IWDAttributeInfo milesAttr = wdContext.nodeGeneralData().getNodeInfo().getAttribute(Miles);
//Check if the input is Zero
if(i == 0){
msgMan.reportContextAttributeMessage(
wdContext.nodeGeneralData().currentGeneralDataElement(),
milesAttr, IMessageVcTreGeneralData.ZERO_MILES,
new Object[] {Miles, value}, true);
}
//@@end
}
//@@begin javadoc:checkMaxLimit()
/** Declared method. */
//@@end
public void checkMaxLimit( java.lang.String Miles )
{
//@@begin checkMaxLimit()
// Get reference to the Message Manager
IWDMessageManager msgMan = wdComponentAPI.getMessageManager();
//Get field value of attribute under investigation
String value = wdContext.nodeGeneralData().currentGeneralDataElement().getAttributeAsText(Miles);
int i = Integer.parseInt(value);
//Get field properties of attribute under investigation
IWDAttributeInfo milesAttr = wdContext.nodeGeneralData().getNodeInfo().getAttribute(Miles);
//Check if the input is Zero
if(i >= 500){
msgMan.reportContextAttributeMessage(
wdContext.nodeGeneralData().currentGeneralDataElement(),
milesAttr, IMessageVcTreGeneralData.MORE_THAN_LIMIT,
new Object[] {value}, true);
}
//@@end
}
After this on the Submit button I have writtent he following code
public void onActionNextStep(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionNextStep(ServerEvent)
LOGGER.traceEnter("onActionNextStep");
wdThis.wdGetFcTraUtilsInterface().viewValidation(wdControllerAPI).validate(true);
//Check if the Value for the Input field "Number of Miles" is provided
this.checkMandatory("MILES");
wdComponentAPI.getMessageManager().raisePendingException();
//Check if the Value entered in the Input field "Number of Miles" is not Zero
this.checkZeroInput("MILES");
wdComponentAPI.getMessageManager().raisePendingException();
//Check if the Value entered in the Input field "Number of Miles" is not greater than 500
this.checkMaxLimit("MILES");
wdComponentAPI.getMessageManager().raisePendingException();
wdComponentController.raiseFPMEvent(TravelConstants.EVENT_NAVIGATE_NEXT);
LOGGER.traceExit("onActionNextStep");
//@@end
}
When I have deployed this on to J2EE engine and clicked on the Next step button, it is throwing a java.lang.nullPointerException.
Please help me to figure this out. I would appreciate your help.
Regards,
PG.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.