Spin Contribution: FR: Export Format From Report

From ADempiere ERP Wiki
Jump to navigationJump to search
Logo erp.png

Initial Problem[edit]

The current export format in ADempiere ERP reporting are very static, it don't allows create new export formt for a custom client. Sometimes is necessary a custom format like XML or TXT.


Is nice if ADempiere ERP can generate a custom format without change many class in core. The proposal is allow to System user create a custom class for export data and add a reference in Report View:

Source Structure[edit]

Abstract Class Definition[edit]

Now exists a parent class for handle the data for export from Report Engine. The class can be extended:

The follow is a example of export data class using a existing helper class. See the example of source code of org.spin.util.ReportExportTest:

 * Product: Adempiere ERP & CRM Smart Business Solution                       *
 * This program is free software; you can redistribute it and/or modify it    *
 * under the terms version 2 of the GNU General Public License as published   *
 * by the Free Software Foundation. This program is distributed in the hope   *
 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
 * See the GNU General Public License for more details.                       *
 * You should have received a copy of the GNU General Public License along    *
 * with this program; if not, write to the Free Software Foundation, Inc.,    *
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.                     *
 * For the text or an alternative of this public license, you may reach us    *
 * Copyright (C) 2003-2015 E.R.P. Consultores y Asociados, C.A.               *
 * All Rights Reserved.                                                       *
 * Contributor(s): Yamel Senih www.erpcya.com                                 *
package org.spin.util;

import java.util.Properties;

import org.compiere.print.ReportEngine;

 * 	@author Yamel Senih, ysenih@erpcya.com, ERPCyA http://www.erpcya.com
 * 		<a href="https://github.com/adempiere/adempiere/issues/1400">
 * 		@see FR [ 1400 ] Dynamic report export</a>
public class ReportExportTest extends ReportExport {
	public ReportExportTest(Properties ctx, ReportEngine reportEngine) {
		super(ctx, reportEngine);
		addExportFormat(new ExportFormatTest(ctx, reportEngine));
}	//	AbstractReportExport

The java class is done.

Original Report[edit]

  • Example of Open Item (It report is generated from RV_OpenItem report view).

Spin Contribution FR 1400 ExportFormatOriginalReport.png

  • See the current Export options

Spin Contribution FR 1400 ExportFormatOldExportOption.png

Adding class reference in Import Format[edit]

  • After add the class, it must be referenced in Report View. Go to Main menu and find Report View window in Application Dictionary -> Report View:

Spin Contribution FR 1400 ExportFormatMenu.png

  • Fill the data like is showed:

Spin Contribution FR 1400 ExportFormatReportView.png

  • Image of class.

Spin Contribution FR 1400 ExportFormatClass.png

Using Custom Export Format[edit]

  • Go to your custom report

Spin Contribution FR 1400 ExportFormatOriginalReport.png

  • Press export button and select Custom Format

Spin Contribution FR 1400 ExportFormatExportButton.png

  • Verify the loaded data and press ok for import it

Spin Contribution FR 1400 ExportFormatDownload.png

  • Go to Import data for see the data loaded

Spin Contribution FR 1400 ExportFormatSeeFormat.png

Adempiere Change Set and Feature Request[edit]

Project Lead[edit]