on 11-04-2008 6:23 PM
Hi!!!!
I am calling a BAPI that gets the partner list of a given customer. The function below is used to find the partner with the role "SP", obviusly I give to the BAPI a customer that has a partner with such role. I am debugging the app and I see that I always get the function of the first partner (in variable x) and it doesn't go to the second element and so on. The partner that have the SP role is the fourth element, so I never get it.
public java.lang.String getP( )
{
String funcion = "";
int sizePartners = wdContext.nodePartners().size(); //It gets the correct size of the result
for (int i=0; i < sizePartners; i++){
wdContext.nodePartners().getPartnersElementAt(i); //Here is where something is wrong
String x = wdContext.currentPartnersElement().getParvw();
if (wdContext.currentPartnersElement().getParvw() == "SP"){
funcion = wdContext.currentPartnersElement().getKunn2();
}
}
return funcion;
}
Can you tell me if something is wrong? Please help me
Thanks
Hi,
Fixed code
public java.lang.String getP( )
{
String funcion = "";
int sizePartners = wdContext.nodePartners().size(); //It gets the correct size of the result
for (int i=0; i < sizePartners; i++){
IPartnersElement element = wdContext.nodePartners().getPartnersElementAt(i); String x = element.getParvw();
if (element.getParvw().equals("SP")){
funcion = element.getKunn2();
}
}
return funcion;
}
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Use ur code in this way
public java.lang.String getP( )
{
String funcion = "";
int sizePartners = wdContext.nodePartners().size(); //It gets the correct size of the result
for (int i=0; i < sizePartners; i++){
String x = wdContext.nodePartners().getPartnersElementAt(i).getParvw();
if (x.equalgnoreCase("SP")){
funcion = wdContext.currentPartnersElement().getKunn2();
}
}
return funcion;
}
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Miguel,
Yes, you already pointed where it is wrong. Just change the line of code from
wdContext.nodePartners().getPartnersElementAt(i); //Here is where something is wrong
to
wdContext.nodePartners().setLeadSelection(i);
Regards
Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
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.