on 03-07-2007 2:43 PM
Hi,
in my application I have to call a BAPI from the backend system. If I get no values from the backend I get the Internal Server Error 500. How can I avoid this message by showing my own message. I tried it with the following piece of code but it doesn't work.I call this method from my View.
try{
__Nextevo__Zcm_Prv_Get_Doc_Links_Input input = new __Nextevo__Zcm_Prv_Get_Doc_Links_Input();
wdContext.nodeBAPI_GLOBAL_STRUC_FROM_R3().bind(input);
wdContext.nodeBAPI_GLOBAL_STRUC_FROM_R3_SORT().bind(input);
input.setIm_Casid(WDWebContextAdapter.getWebContextAdapter().getRequestParameter("GUID"));
wdContext.currentBAPI_GLOBAL_STRUC_FROM_R3Element().modelObject().execute();
}catch(Exception e){
msg.reportException("My own Message.............................", false);
}
regards,
sharam
Hi Sharam
You can do the binding in your executeBapi () as well in case you are calling this method on some action or initially itself as well. You can always close the connection in the end of the method.
Secondly, after wdContext.currentBAPI_GLOBAL_STRUC_FROM_R3Element().modelObject().execute(); statement, you have to invalidate the model node's output node as well.
If you want to print your own message in case of no data, after executing the bapi, check for the size n then print ur message. If you place it in Exception case, that will be raised when the bapi execution itself throws an exception - which could be due to not passing some import parameters or could be because the bapi itself is not working roperly and throwing exception when it is run at the R/3 level itself.
So, firstly check if your bapi on dry run is running properly without any exception , and then check the parameters you are passing. Plus, add the invalidate code above.
Regards,
Anupreet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sharam,
U can do this By 2 ways ,
Way1:
Before Executing the Bapi set default values to ur Output Node elements.
This can be done By,
input.setAttriBute1(default Value);
Way2:
After The Bapi Execution Chk ur Node size.If its Null/0, Raise a Message.
Regards,
Ramganesan K.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
First of all you are getting the exception message( Internal Server Error 500) means there is some error lies in your code.Try to correct the errors first.
After execute statement you haven't invalidated output node.
Binding of node to model class instance should be done once.So it should be wrriten separately in wdDoInit.
To check whether BAPI has returned values or not :
if(wdContext.node<OutputNode>()==null||wdContext.node<OutputNode>().size==0)
{
msgMgr.reportException("Your message....",false);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
try
{
find the node size and try
if(i==0)
{
displaymessage
}
}
(Exception e)
{
throw new WDRuntimeException(e)
}
It might helps
thanks,
Lohi.
Message was edited by:
Lohitha M
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lohi,
I try your piece of Code but I get the Internal Server Error 500 again. Now with the Message:
The initial exception that caused the request to fail, was:
com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFC_Fault_Exception:
at sun.reflect.GeneratedConstructorAccessor386.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:308)
at java.lang.Class.newInstance(Class.java:261)
... 46 more
My purpose is to show only a Web-Dynpro-Page with one Message.
Like: msg.reportException("...message.....", false);
regards,
Sharam
try{
__Nextevo__Zcm_Prv_Get_Doc_Links_Input input = new __Nextevo__Zcm_Prv_Get_Doc_Links_Input();
wdContext.nodeBAPI_GLOBAL_STRUC_FROM_R3().bind(input);
wdContext.nodeBAPI_GLOBAL_STRUC_FROM_R3_SORT().bind(input);
input.setIm_Casid(WDWebContextAdapter.getWebContextAdapter().getRequestParameter("GUID"));
wdContext.currentBAPI_GLOBAL_STRUC_FROM_R3Element().modelObject().execute();
int size = wdcontext.nodeOutput().size();
if(i==0)
{
wwdComponentApi.getMessageManager().reportsuccess("error");
}catch(Exception e){
throw new WDRuntimeException(e)
}
Thanks,
Lohi.
Hi Lohi,
sorry but it doesn't work. I couldn't catch the NullPointerException.
try{
__Nextevo__Zcm_Prv_Get_Doc_Links_Input input = new __Nextevo__Zcm_Prv_Get_Doc_Links_Input();
wdContext.nodeBAPI_GLOBAL_STRUC_FROM_R3().bind(input);
wdContext.nodeBAPI_GLOBAL_STRUC_FROM_R3_SORT().bind(input);
input.setIm_Casid(WDWebContextAdapter.getWebContextAdapter().getRequestParameter("GUID"));
wdContext.currentBAPI_GLOBAL_STRUC_FROM_R3Element().modelObject().execute();
int size = wdContext.nodeOutput().size();
if(size == 0){
wdComponentAPI.getMessageManager().reportSuccess("error");
}
}catch(Exception e){
throw new WDRuntimeException(e);
}
Thanks,
Sharam
Hi,
try{
__Nextevo__Zcm_Prv_Get_Doc_Links_Input input = new __Nextevo__Zcm_Prv_Get_Doc_Links_Input();
// change here u instantiating one class and bind to another node.
wdContext.node__Nextevo__Zcm_Prv_Get_Doc_Links_Input().bind(input);
//wdContext.nodeBAPI_GLOBAL_STRUC_FROM_R3_SORT().bind(input);
input.setIm_Casid(WDWebContextAdapter.getWebContextAdapter().getRequestParameter("GUID"));
wdContext.current__Nextevo__Zcm_Prv_Get_Doc_Links_InputElement().modelObject().execute();
int size = wdcontext.nodeOutput().size();
if(i==0)
{
wwdComponentApi.getMessageManager().reportsuccess("error");
}catch(Exception e){
throw new WDRuntimeException(e)
}
Or therwise send ur node structure once then I will give u the code.
Thanks,
Lohi.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.