Skip to Content
0
Sep 14, 2011 at 12:25 PM

Error Setting Blob - Crystal Layout for Addon

34 Views

Hi all,

i'm facing a problem when i try to add a rpt file inside BO, see bellow like i do:

SAPbobsCOM.ReportLayoutParams oNewReportParams = null;
            SAPbobsCOM.BlobParams oBlobParams = null;
            SAPbobsCOM.BlobTableKeySegment oKeySegment;
            SAPbobsCOM.Blob oBlob = null;
            string newReportCode = "";
            bool retval = true;
            try
            {
 
                SAPbobsCOM.ReportLayoutsService oLayoutService = (SAPbobsCOM.ReportLayoutsService)Modulo.ServicosDaEmpresa.GetBusinessService(SAPbobsCOM.ServiceTypes.ReportLayoutsService);
                SAPbobsCOM.ReportLayout oReport = (SAPbobsCOM.ReportLayout)oLayoutService.GetDataInterface(SAPbobsCOM.ReportLayoutsServiceDataInterfaces.rlsdiReportLayout);
 
 
                oReport.Name = "MLT_RNG00";
                oReport.TypeCode = "RCRI";
                oReport.Author = Modulo.Empresa.UserName;
                oReport.Category = SAPbobsCOM.ReportLayoutCategoryEnum.rlcCrystal;
 
                oNewReportParams = oLayoutService.AddReportLayout(oReport);
 
                newReportCode = oNewReportParams.LayoutCode;
 
                oBlobParams = (SAPbobsCOM.BlobParams)Modulo.ServicosDaEmpresa.GetDataInterface(SAPbobsCOM.CompanyServiceDataInterfaces.csdiBlobParams);
                oBlobParams.Table = "RDOC";
                oBlobParams.Field = "Template";
                oKeySegment = oBlobParams.BlobTableKeySegments.Add();
                oKeySegment.Name = "MLT_RNG00";
                oKeySegment.Value = newReportCode;
 
 
                oBlob = (SAPbobsCOM.Blob)Modulo.ServicosDaEmpresa.GetDataInterface(SAPbobsCOM.CompanyServiceDataInterfaces.csdiBlob);
 
 
                FileStream oFile = new FileStream(Modulo.ReportFilePath, System.IO.FileMode.Open);
                int fileSize = (int)oFile.Length;
                byte[] buf = new byte[fileSize];
                oFile.Read(buf, 0, fileSize);
                oFile.Close();
 
                oBlob.Content = Convert.ToBase64String(buf, 0, fileSize);
  // Fail here when SetBlob......
                Modulo.ServicosDaEmpresa.SetBlob(oBlobParams, oBlob);

When i SetBlob i've got this error: Internal error occured. Operation failed. Error Code:'|' . Did I something wrong? I follow the SDK example...Oh almost forgot it, i'm using SAP 8.81 PL 07...Someone faced it too?

Thanks and Regards,

Leonard Azevedo.