on 04-06-2009 12:04 PM
Dear Expert,
I am new to the Java webdynpro. I have a requirement which is to edit the ess~cod for the employee communication. I have copy out the function group ZHRXSS_COD_INTERFACE. I created my own function module ZCOD_VALIDATE and attached to the function group. My funtion module are just returning an export parameter and a table without getting any import parameter.
I have create a ZCodModel (pointing to the ECC function group) and the model class is ZCod_Validate_Output. I have done all the reimporting and context binding. My question is why i still not getting any value from the function module. I tested the fm in ecc and it works well.
Do i need to do any java code for that? I saw in the component controller where my ex developer written some customize code like below:
import com.sap.xss.hr.cod.model1.Zhrxss_Cod_Get_Details_Input;
private void callRFCGetDetails() {
wdContext.nodeGet_Details_Input().bind(new Zhrxss_Cod_Get_Details_Input());
try {
wdContext.currentGet_Details_InputElement().setPernr(pernr);
wdContext.currentGet_Details_InputElement().modelObject().execute();
} catch (Exception ex) {
fpm.getMessageManager().raiseException(wdThis.wdGetAPI().getComponent(), ex);
}
wdContext.nodeGet_Details_Output().invalidate();
fpm.getMessageManager().deleteAllMessages(wdThis.wdGetAPI().getComponent());
if (!"000".equals(wdContext.currentReturn_TableElement().getNumber())) {
if ("004".equals(wdContext.currentReturn_TableElement().getNumber())) {
fpm.getMessageManager().raiseException(
wdThis.wdGetAPI().getComponent(),
IMessageManager.DEFAULT_EXCEPTION,
wdContext.currentReturn_TableElement());
} else {
fpm.getMessageManager().reportMessage(wdThis.wdGetAPI().getComponent(), wdContext.currentReturn_TableElement());
}
}
}
Please advise me....Thanks in Advance
Regards,
Bryan
Thanks All
Problem solved
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi brain,
Try to solve this code below..
private void callRFCGetDetails() {
Zhrxss_Cod_Get_Details_Input input=new Zhrxss_Cod_Get_Details_Input();
wdContext.nodeGet_Details_Input().bind(input);
try {
input.setPernr(pernr);
wdContext.currentGet_Details_InputElement().modelObject().execute();
} catch (Exception ex) {
fpm.getMessageManager().raiseException(wdThis.wdGetAPI().getComponent(), ex);
}
wdContext.nodeGet_Details_Output().invalidate();
fpm.getMessageManager().deleteAllMessages(wdThis.wdGetAPI().getComponent());
int size=wdContext.nodeGet_Details_Output().size();
for(int i=0;i<size;i++){
if (!"000".equals(wdContext.nodecurrentReturn_Table().getReturn_TablerElementAt(i).getNumber())) {
if ("004".equals(wdContext.nodecurrentReturn_Table().getReturn_TablerElementAt(i).getNumber())) {
fpm.getMessageManager().raiseException(
wdThis.wdGetAPI().getComponent(),
IMessageManager.DEFAULT_EXCEPTION,
wdContext.currentReturn_TableElement());
} else {
fpm.getMessageManager().reportMessage(wdThis.wdGetAPI().getComponent(), wdContext.currentReturn_TableElement());
}
}
}
}
Hope this will work fine.
Thanks
jati
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Brian,
Please replace this code snippet with the code I have manetioned below. Your code:
if (!"000".equals(wdContext.currentReturn_TableElement().getNumber())) {
if ("004".equals(wdContext.currentReturn_TableElement().getNumber())) {
fpm.getMessageManager().raiseException(
wdThis.wdGetAPI().getComponent(),
IMessageManager.DEFAULT_EXCEPTION,
wdContext.currentReturn_TableElement());
} else {
fpm.getMessageManager().reportMessage(wdThis.wdGetAPI().getComponent(), wdContext.currentReturn_TableElement());
}
}
Here you should note that the you are always gettin gthe current return_table element and checking it. instead I guess since it is a call details method (callRFCGetDetails()) therefore you should iterate over all the elements of return_table and then check for the conditon to raise the exception..
Please try and replace the code above with this code:
for(int i=0;i<size;i++){
if (!"000".equals(wdContext.nodecurrentReturn_Table().getReturn_TablerElementAt(i).getNumber())) {
if ("004".equals(wdContext.nodecurrentReturn_Table().getReturn_TablerElementAt(i).getNumber())) {
fpm.getMessageManager().raiseException(
wdThis.wdGetAPI().getComponent(),
IMessageManager.DEFAULT_EXCEPTION,
wdContext.currentReturn_TableElement());
} else {
fpm.getMessageManager().reportMessage(wdThis.wdGetAPI().getComponent(), wdContext.currentReturn_TableElement());
}
}
}
In this code you will iterate over all the node elemetns and then raise the exception based on some checks which yiu have done.
I hope this solves the issue. Please revert back in case of any other issue.
Thanks and Regards,
Pravesh
Hi Pravesh,
I have done the model binding and context binding and add the following code to the do init
Zhrxss_Cod_Validate_Input Input = new Zhrxss_Cod_Validate_Input();
wdContext.nodeZhrxss_Cod_Validate_Input().bind(Input);
try {
wdContext.currentZhrxss_Cod_Validate_InputElement().modelObject().execute();
wdContext.nodeCod_Validate_Output().invalidate();
} catch (Exception ex) {
fpm.getMessageManager().raiseException(wdThis.wdGetAPI ().getComponent(), ex);
}
When i run the application, i am getting java.lang.ArrayIndexOutOfBoundsException: -1 ?
Can u give me some idea where i have gone wrong?
Thanks.
Regards,
Bryan.
Hi brain,
You are missing to set the pernr ..
Zhrxss_Cod_Validate_Input Input = new Zhrxss_Cod_Validate_Input();
wdContext.nodeZhrxss_Cod_Validate_Input().bind(Input);
Input .setPernr(pernr);
try {
wdContext.currentZhrxss_Cod_Validate_InputElement().modelObject().execute();
wdContext.nodeCod_Validate_Output().invalidate();
} catch (Exception ex) {
fpm.getMessageManager().raiseException(wdThis.wdGetAPI ().getComponent(), ex);
}
thanks
jati
Refer this link for understanding:
http://help.sap.com/saphelp_nw04/helpdata/en/66/8b3c413b456e24e10000000a155106/frameset.htm
Edited by: Anagha Jawalekar on Apr 7, 2009 12:07 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.