If you are creating a user custom report and wish to output the report definition, the following code fragment will be useful. This may be used when the behavior setting named GRANULAR_REPORT_DEFINITIONS has a value of YES.
ReportDefinition rd = new ReportDefinition();
fp.put("p_output_type", "BROWSER"); // note: need to generate unescaped HTML, esp. for PDF output
fp.put(ReportDefinition.OUTPUT_REPORT_DEFINITION_PARAM, "yes");
fp.put(ReportDefinition.OUTPUT_REPORT_PROPERTY_PARAM, "yes");
fp.put(ReportDefinition.OUTPUT_FILTER_DEFINITION_PARAM, "yes");
fp.put(ReportDefinition.OUTPUT_CUSTOM_FILTER_PARAM, "yes");
String reportDefinitionHtml = rd.doOutputReportDefinition(session, dbconn, fp, report, null);