Showing results for 
Search instead for 
Did you mean: 

Redwood Report Definition Format HTMLText - SAP BPA

0 Kudos


We have a fairly large report definition that reports a list of jobs in Redwood CPS (SAP BPA).
It has a custom SQL as the query source and the uses standard HTMLText as the output format.
This works no problem.

What would be even better, is if I can create a custom HTML format for output.
I would like to make certain columns "GREEN" and certain columns "RED" depending on the value of the column.
I can't see how this is done in the usual report definition User Interface, so I have delved into the RedwoodScript side and I can see that I need to do something like the following:


// Define a jobfile for storing the report HTML output.
JobFile newJobReport = jcsJob.createJobFile();
// Some Code to setup the job file number.
// Create the report.
Reporter reporter = jcsSession.createReporter(writer);
// Capture the default CSS.

// Submit the report job.


I then get the CSS from the report job and customise it accordingly, with my colour changes etc.
Now I have some CSS, and a way of running the job in RedwoodScript, but how do I set the CSS to be used on the job when I execute the report?

I've tried messing with: ReportDestination destination = reporter.getHTMLReportDestination("myCustomFormat");

But I'm really at a loss as to how to apply my custom CSS to the report.

Anyone ever done this successfully?

View Entire Topic
Active Contributor
0 Kudos

Hi Darryl,

Here we go. As you might have seen, the generated css tags are all prefixed with report-. What you can do is create your own version of it, and label the prefixes the way you want (ie darryl-).

Now you write a little bit of RedwoodScript to build the html frame (also don't forget to set the output format to HTMLText in the options of your definition (this will change stdout.log to stdout.html):

  jcsOut.println("  <head>\n");
  jcsOut.println("    <style type=\"text/css\">\n");
  jcsOut.println("    </style>\n");
  jcsOut.println("  </head>\n");
  jcsOut.println("  <body>\n");

now we get to writing the report table, here you pass in the style tag prefix as the argument to the HTML destination (you can see that I am using jcsOut here, that saves you from setting up an additional JobFile):

  String sql = "<your query>";
  Reporter r = jcsSession.createReporter(jcsOut);
  jcsSession.executeQuery(sql, null, r.getHTMLReportDestination("darryl"));

and finally we close it all off:

  jcsOut.println("  </body>\n");

Regards Gerben

0 Kudos

Hey Gerben,

Thanks for that. At least I'm on the right track now.

OK, I can see that I'm going to need to implement my own ReportDestination to do the next part of the requirement. To be able to apply a style to a HTML table data element, I'm going to need to be able to see each result set entry.
In the call to ReportResultSet.callback() I guess I need to check the data in the required column, then apply the HTML element to it?

I don't suppose you've got an example for that?

Active Contributor
0 Kudos

Hi Darryl,

Then you are on your own writing the entire html table yourself, and you do not necessary have to implement a ReportDestination, you also just implement the APIResultSetCallback on the executeQuery and leave the Reporter out of the equation.

Before you go that route. Fields with status codes will get their own css tag assigned based on their status. So with some smart css it should be straightforward to color an entire row RED or GREEN based on the status in the status column.

When you run the reporter with emitStandardStyleTag() the report will print the default css implementation, you can use that as the basis and start exploring what you want to have changed.

Regards Gerben

0 Kudos

Thanks again for this.
I can see the CSS for ".report-error" and ".report-completed".
But I don't have columns that correspond to those values. I'll try and re-work the report to use the inbuilt style first and see how I get on.