cancel
Showing results for 
Search instead for 
Did you mean: 

rom R3 Internal table to Excel Export in front end

Former Member
0 Kudos

Hi All,

In sapR/3 I have created a function module to get the tranaction data from differnt table into one Internal table (not like standard table(mara or any table) ) and convert this data into EXCEL in WEBDYNPRO.

I have used SAP_CONVERT_TO_XML_FORMAT to convert from internal table.I did n't get a XML file but with error file has created.

Instead of own internal table I used any ref with std table structure (mara) like internal table I am getting XML file with out any erro.

If I am getting XML in binary mode I am planning to convert the binary xml file into EXCEL FILE in front end Webdynpro.

I have strucked with conversion of internal table into XML binary mode in back end(SAP R/3).

If any guys did the same type of assignment Kindly help me to proceed further.

Thanks in Advance.

Yours,

Ram

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Srinivasa!

I did a DC that generates a report (html format) and the user have the option to export to excel. To export the data, I did it:

In custom controller I create a method called excelExport.

In this method, I navigate though the context, to obtain the data, and I use an external lib to generate the excel (I have used the Jakarta POI but you can use the JExcel too).

After generated the excel, I convert it to binary data and send to the user:


  try
  {

    byte[] bytesArq = // method to convert the report to byte array

    if (bytesArq != null)
    {
      IWDCachedWebResource resource =
        WDWebResource.getWebResource(bytesArq, WDWebResourceType.getWebResourceTypeForFileExtension("XLS"));
      resource.setResourceName("FILENAME.XLS");

      IWDWindow window =
        wdComponentAPI.getWindowManager().createExternalWindow(resource.getURL(), "Window Title", true);
      window.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
      window.removeWindowFeature(WDWindowFeature.MENU_BAR);
      window.removeWindowFeature(WDWindowFeature.STATUS_BAR);
      window.removeWindowFeature(WDWindowFeature.TOOL_BAR);
      window.setWindowSize(780, 430);
      window.setWindowPosition(20, 140);
      window.open();
    }
  }
  catch (ReportException e)
  {
    wdComponentAPI.getMessageManager().reportException(e.getMessage(), true);
  }
  catch (WDURLException e)
  {
    wdComponentAPI.getMessageManager().reportException(e.getMessage(), true);
  }

References:

<a href="http://jakarta.apache.org/poi/">Jakarta POI</a>

<a href="http://jexcelapi.sourceforge.net">JExcel</a>

Remember that you must create an external library DC to use these libs, ok?

I hope that it helps you.

Regards,

Marcelo