Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Creating variables in BO using BO SDK

Hi,

We can create variables which can be formulas applied on objects using infoview.

Is there any way, these variables can be created using java BO SDK?

Please paste some sample code for us.

Cheers,

Shruti

replied

The above code is for Crystal Reports only, using the Report Application Server SDK.

Below is for Web Intelligence, using the ReportEngine SDK:

    reportContainer = documentInstance.createReport("Report1");

    cell = reportContainer.getReportBody().createFreeCell(" Free Cell ");
    cell.setX(20.0);
    cell.setY(10.0);
    cell.getFont().setName("Arial");
    cell.getFont().setSize(16);
    cell.getFont().setStyle(StyleType.BOLD);

    reportBlock = reportContainer.getReportBody().createBlock();
    reportBlock.setAttachTo(cell, VAnchorType.BOTTOM, HAnchorType.NONE);

    dictionary = documentInstance.getDictionary();

    // Add variable
    variableExpression = dictionary.createVariable("Double floor size", ObjectQualification.MEASURE, 
            "=[Sales floor size sqFt]*2");

    // Add cells to report.
    blockAxis = reportBlock.getAxis(TableAxis.HORIZONTAL);
    blockAxis.addExpr(dictionary.getChildByName("Double floor size"));

where the relevant bit is where you create a VariableExpression using createVariable method on the ReportDictionary (it's actually simpler than in InfoView).

Sincerely,

Ted Ueda

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question