How to get Account Structure reports while dumping account

2011-06-08 Thread Sanju
Can anybody plz help me, am getting Exception while Account Structure
dumping
exception:
[ReportDefinitionError.CUSTOMER_SERVING_TYPE_REPORT_MISMATCH @
operations]


my code is shown here:

 String fileName = appPath + /GleSync +
gleSer.getBusAssSeaEngAccountInfo().getBusAssSeaEngAccountId() +
.xml;
try {
rs =
(ReportDefinitionServiceInterface)gleSer.getService(9);
//String aggrType[] = {Keyword};
String repType[] = {Structure};
String[] customOptions = new String[] {AdGroupId,Id,
KeywordText,KeywordMatchType, IsNegative};
 Selector selector = new Selector();
  selector.setFields(customOptions);
  Calendar fromDate=new ReportDate().toCalendar();
Calendar toDate=new ReportDate().toCalendar();
String DATE_FORMAT = MMdd;
SimpleDateFormat sdf =new
SimpleDateFormat(DATE_FORMAT);
String fromDt=sdf.format(fromDate.getTime());
  String toDt=sdf.format(toDate.getTime());
  selector.setDateRange(new DateRange(fromDt, toDt));
  if(adGrpIds!=null){
Predicate[] adGroupPredicate = new
Predicate[adGrpIds.length];
for(int i=0;iadGroupPredicate.length;i++){
 adGroupPredicate[i].setField(AdGroupId);
 
adGroupPredicate[i].setOperator(PredicateOperator.IN);
  adGroupPredicate[i].setValues(new String[]
{String.valueOf(adGrpIds[i])});
 }
selector.setPredicates(adGroupPredicate);
 }

  if(cmpIds!=null){
Predicate[] campaignPredicate = new
Predicate[cmpIds.length];
for(int i=0;icampaignPredicate.length;i++){

 campaignPredicate[i].setField(CampaignId);
 
campaignPredicate[i].setOperator(PredicateOperator.IN);
  campaignPredicate[i].setValues(new String[]
{String.valueOf(cmpIds[i])});
 }
selector.setPredicates(campaignPredicate);
 }

  ReportDefinition reportDefinition = new
ReportDefinition();

  reportDefinition.setReportName(Keyword
SynchronizeReport);
 
reportDefinition.setDateRangeType(ReportDefinitionDateRangeType.CUSTOM_DATE);
  if(repType[0].equals(Keyword))
{reportDefinition.setReportType(ReportDefinitionReportType.KEYWORDS_PERFORMANCE_REPORT);}
  else if(repType[0].equals(AdGroup))
{reportDefinition.setReportType(ReportDefinitionReportType.ADGROUP_PERFORMANCE_REPORT);}
  else if(repType[0].equals(Structure))
{reportDefinition.setReportType(ReportDefinitionReportType.KEYWORDS_PERFORMANCE_REPORT);}
 
reportDefinition.setDownloadFormat(DownloadFormat.XML);
  reportDefinition.setCrossClient(true);
  //Client
  reportDefinition.setClientSelectors(new
ClientSelector[]{new
ClientSelector(gleSer.getBusAssSeaEngAccountInfo().getClientName(),null)});
  reportDefinition.setSelector(selector);

  ReportDefinitionOperation operation = new
ReportDefinitionOperation();
  operation.setOperand(reportDefinition);
  operation.setOperator(Operator.ADD);
  ReportDefinitionOperation[] operations = new
ReportDefinitionOperation[] {operation};
  ReportDefinition[] result = rs.mutate(operations);
  //reportDefinitionResult.getId();
  if (result != null) {
for (ReportDefinition reportDefinitionResult :
result) {
  System.out.println(Report definition with name
\+ reportDefinitionResult.getReportName() + \ and id \
  + reportDefinitionResult.getId() + \
was added.);
}
  } else {
System.out.println(No report definitions were
added.);
  }

TNX in Aav

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups AdWords API Forum group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en


Re: How to get Account Structure reports while dumping account

2011-06-08 Thread Anash P. Oommen
Hi Sanju,

I've responded to your other thread.

Cheers,
Anash P. Oommen,
AdWords API Advisor.

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups AdWords API Forum group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en