cancel
Showing results for 
Search instead for 
Did you mean: 

ALV Export

Former Member
0 Kudos

Hi all,

I am able to export the file with the attached code. But the problem is it is not working like standard ALV Export functionality. My requirement is i want to export selected reccords from ALV. But Standard ALV exports all the records and only visible fields. In my case , i need to export all the fields of the records but selected records only with column header. I am able to do it but it is downloading as .xml file.

But following code is working fine only the problem is , headers are coming as technical fieldname. How to overcome this. It has to work like ALV Standard export functionality with selected records and selected columns.

Please help me if anybody has the idea or experience with the same kind of problem.

Thanks in Advance,

Best Regards,

Vijay


  data : xmlstr type xstring.
*  data : lv_data type Xstring.
  DATA lr_conv TYPE REF TO cl_abap_conv_out_ce.
  DATA lv_xfile TYPE xstring.
  data : lv_file_name type string.
  data : lv_file_type type string.
  data:   converter              TYPE REF TO cl_rpe_convert.
  CREATE OBJECT converter.

CALL METHOD CONVERTER->TRANSFORM_TO_XML
  EXPORTING
    DATA              = lt_employees
*    TAGNAME           = 'XMLSTR' " 'ZPDS_ALL_EMPLOYEES'
*    IGNORE_INIT_VALUE =
  CHANGING
    XML               = XMLSTR
*  EXCEPTIONS
*    XML_WRITE_ERROR   = 1
*    others            = 2
        .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


*  lv_data = XMLSTR.

  cl_abap_conv_out_ce=>create( RECEIVING conv = lr_conv ).
  lr_conv->convert( EXPORTING data = XMLSTR
  IMPORTING buffer = lv_xfile ).

  Concatenate 'C:\PDS export' sy-datum '.xls' into lv_file_name separated by space.

  cl_wd_runtime_services=>attach_file_to_response(
  EXPORTING
  i_filename = lv_file_name
  i_content = lv_xfile
  i_mime_type = 'text/xml' ).         " text/xml 'application/vnd.ms-excel' "application/winword'

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Did you try setting Column header Text??

Thank You,

Gajendra.

Answers (0)