on 10-02-2008 8:10 AM
Hi,
I am importing 2 bapis into my model. and i am executing them in different actions of webdynpro application.
when i execute the first bapi and then continue with the next one, then its giving null pointer exception for the second one.
but when i import these 2 bapis seperately they worked fine.
kindly suggest me what could be the problem.
Regards,
Prasanthi.
hi,
u must not have a prob in putting 2 bapis in a single model.i have done this many times without any issues
u will get a null pointer exception only if u dont
execute the bapi and try to get or set values of its attributes...
can u elaborate on ur problem
Regards,
Satya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This action is for dropdown.
I can select either RBU code or Dealer grp.
If i select RBU code from output it gives correct values.
if i select Dealer grp....it ll give correct values.
But if i go to the Output and first select RBU code it gives correct values. And by any chance if i select dealer grp agn its not coming up.....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Code is correct, I think your requirement is when you enter input value as "by rbu code" then node nodeVn_RBUCode() should be
filled and if input value is "by dealer group" then node nodeVn_DealerGroup() should be filled. To be clear only one node will
be filled on each action. Where are you writing your code is it in Button Action or what?
Check these
1) check the conditional parameters "by rbu code" "by dealer group" exactly matches with the model data.
2) check the import parameters setTable("TVKBT");
setVkbur("*");
setTable("T077D");
setKtokd("*"); matches with the backend. Test execute the bapi in Backend ECC system(SE37) by
giving the above import parameters and make sure the bapi is executing output values with the above import parameters.
Regards
Raghu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
public void onActionselectCriteria(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionselectCriteria(ServerEvent)
if(wdContext.currentVn_SelectCriteriaElement().getVa_SelectCriteria().trim().equalsIgnoreCase("by rbu code"))
{
wdContext.currentZbapi_Display_All_InputElement().setTable("TVKBT");
wdContext.currentZbapi_Display_All_InputElement().setVkbur("*");
wdThis.wdGetCustomerHierarchyCompController().executeZbapi_Display_All();
List nodeElements = new ArrayList();
for (int i = 0; i <wdContext.nodeI_Tvkbt().size(); ++i)
{
IPrivateCustomerHierarchyView.IVn_RBUCodeElement xElement =wdContext.createVn_RBUCodeElement();
xElement.setVa_RBUCode(""wdContext.nodeI_Tvkbt().getI_TvkbtElementAt(i).getVkbur()"-"+wdContext.nodeI_Tvkbt().getI_TvkbtElementAt(i).getBezei());
wdComponentAPI.getMessageManager().reportSuccess(""wdContext.nodeI_Tvkbt().getI_TvkbtElementAt(i).getBezei()""+wdContext.nodeI_Tvkbt().getI_TvkbtElementAt(i).getVkbur());
nodeElements.add(xElement);
}
wdContext.nodeVn_RBUCode().bind(nodeElements);
}
else
if(wdContext.currentVn_SelectCriteriaElement().getVa_SelectCriteria().trim().equalsIgnoreCase("by dealer group"))
{
wdContext.currentZbapi_Display_All_InputElement().setTable("T077D");
wdContext.currentZbapi_Display_All_InputElement().setKtokd("*");
wdThis.wdGetCustomerHierarchyCompController().executeZbapi_Display_All();
List nodeElementsDealergrp = new ArrayList();
for (int j = 0; j <wdContext.nodeI_T077D().size(); ++j)
{
IPrivateCustomerHierarchyView.IVn_DealerGroupElement xElement_Dealergrp =wdContext.createVn_DealerGroupElement();
xElement_Dealergrp.setVa_DealerGroup(""wdContext.nodeI_T077D().getI_T077DElementAt(j).getKtokd()"-"+wdContext.nodeI_T077D().getI_T077DElementAt(j).getTxt30());
wdComponentAPI.getMessageManager().reportSuccess(""wdContext.nodeI_T077D().getI_T077DElementAt(j).getKtokd()""+wdContext.nodeI_T077D().getI_T077DElementAt(j).getTxt30());
nodeElementsDealergrp.add(xElement_Dealergrp);
}
wdContext.nodeVn_DealerGroup().bind(nodeElementsDealergrp);
}
//@@end
}
this is how i am using the code
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Different node that was what i mean dummy node. So you are executing your BAPI and then copying all values to different node and then executing the BAPI with other input values. So it is correct. make sure you have bind your UI element with that different node. Can you elaborate your requirement or paste your code what you have written such that we can know it better.
Regards
Raghu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
actually i am taking all those values into a different node after executing the BAPI. Then i dont thnink there is a need of dummy node again. Correct me if i am wrong.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prasanthi,
I am not sure what is your problem, but what i think is you want to execute the BAPI twice both in if and else part and get two different values out of it, which is not possible because the second execution of bapi will overwrite the node. So what you have to do is
create two dummy copy nodes one for if part and the other for else part and after executing the bapi in if and else part just copy the node values to the dummyif and dummyelse nodes and bind the dummy nodes to the respective UI elements. Hope this will solve your problem.
if
{
executeBAPI
WDCopyService.copyElements(sourceNode,targetNode);
}
else
{
executeBAPI
WDCopyService.copyElements(sourceNode,targetNode)
}
Regards
Raghu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But, I need to take different output values from the BAPI in IF ElSE conditions...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
ur question if i am correct.
In both the cases(if and else), i am executing the same bapi with different input parameters.
in both cases bapi will be executed with the i/p values u have given.If first case is right it takes i/p from "if" otherwise it takes i/p from "else" and bapi will be executed.
Regards,
Srikanth Reddy.T
Thanks for the answers. But, sorry that i framed the question in wrong way.
I have one BAPI that is being executed in a action. i am using if else inside the action. In both the cases(if and else), i am executing the same bapi with different input parameters. But its executing only for the first time and for the second time its giving null values. I tried invalidating the nodes...but dint work.
Kindly suggest.
Regards,
Prasanthi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
if you passing any input to bapi make sure it not be null.
Regards,
ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prasanthi,
Check whether your are suppling the necessary mandatory import parameters to the Bapi before executing the Bapi. Because you should have no problem in importing two Bapi's into One Model. Try Again.
Regards
Raghu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
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.