Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

reuse webdynpro ALV conversion to pdf in sapgui alv

Former Member
0 Kudos

Hi Experts,

I would like to know : if and how it's possible to reuse the functionality for

converting webdynpro ALV to pdf (using ADS server) :

purpose : quick generation of e-mail attachment from internal table

Reusing wanted in : SapGui OO ALV (CL_GUI_ALV_GRID) or CL_SALV_TABLE or new ALV for Hana CL_SALV_GUI_TABLE_IDA


i know obviously the way to print ALV to spool and convert_abapspool_to_pdf but the look is not

well enough for mail attachment...

i already reuse the AlvWDA .xls function conversion, but don't find the way with pdf conversion out of webdynpro application.

.xls conversion code sample :

data l_my_result_data type ref to cl_salv_ex_result_data_table.
data l_flavour        type string.
data l_version        type string.


   l_my_result_data = cl_salv_ex_util=>factory_result_data_table( r_data           = my_data          "(type ref to data)
                                                                                              t_fieldcatalog = tfieldcatalog ).  "(type lvc_t_fcat)

case cl_salv_bs_a_xml_base=>get_version( ).
     when if_salv_bs_xml=>version_25.
       l_version = if_salv_bs_xml=>version_25.
     when if_salv_bs_xml=>version_26.
       l_version = if_salv_bs_xml=>version_26.
   endcase.
   l_flavour = if_salv_bs_c_tt=>c_tt_xml_flavour_export.

  cl_salv_bs_tt_util=>if_salv_bs_tt_util~transform( exporting  xml_type        = if_salv_bs_xml=>c_type_excel_xml
                                                                                       xml_version     = l_version
                                                                                       r_result_data   = l_my_result_data
                                                                                       xml_flavour      = l_flavour
                                                                                       gui_type          = if_salv_bs_xml=>c_gui_type_gui
                                                                                       importing  xml  = me->xstring
                                                                                          mimetype     = me->type ).

Kind regards,

Fred

Message was edited by: Frédéric Voirol no idea, no solution ?

2 REPLIES 2

Former Member
0 Kudos

Hi Frédéric,

Did you find any solution for your post? As i too have a similar requirement working on.

Thanks,

Prema

0 Kudos

Hi Prema,

I tried differents ways but not able to get the solution.

For example, this below... but no succes...

************************************

data l_my_result_data    type ref to cl_salv_ex_result_data_table.

   data l_my_wd_c_table     type ref to cl_salv_wd_c_table.
   data l_my_exp_pdf        type ref to cl_salv_wd_export_pdf_acc.
   data l_my_result_data_wd type ref to cl_salv_wd_result_data_table.
   data l_my_comp_factory   type ref to cl_salv_wd_comp_factory.
   data l_my_node           type ref to if_wd_context_node.


   data l_flavour        type string.
   data l_version        type string.

  l_my_comp_factory ?= cl_salv_wd_comp_factory=>get_instance( ).
   l_my_wd_c_table   ?= l_my_comp_factory->if_salv_wd_comp_factory~get_component_table( ).
   l_my_wd_c_table->if_salv_wd_comp_table_if~set_data( changing r_data_source = my_data->my_data_table->my_data ).

   xstring  = cl_salv_wd_pdf_util=>generate_pdf_xml( l_my_wd_c_table->r_result_data ).

**********


In conclusion, I'll use the classical (not pretty) solution :



   data l_tdata_lvc type lvc_t_data.
   data l_tinfo_lvc type lvc_t_info.
   data l_thtml     type w3htmltab.
   data l_xstring   type xstring.
   data l_my_tbi    type ref to zcl_tbi.
   field-symbols <l_tdata> type standard table.
data l_my_alv type ref to cl_gui_alv_grid.
   data l_sprint type lvc_s_prnt .

   l_sprint-print = 'X'.
    l_sprint-prnt_title = '0'.

call function 'REUSE_ALV_GRID_DISPLAY_LVC'
     exporting
*     i_callback_program = l_repid
       it_fieldcat_lvc    = my_alv->tfieldcatalog
       i_save             = 'A'
       i_default          = 'X'
*     it_sort            = t_sort[]
       is_layout_lvc      = my_alv->is_layout
       is_print_lvc       = l_sprint
     tables
       t_outtab           = <l_tdata>
     exceptions
       program_error      = 1
       others             = 2.
* commit work.
   zcl_utilities=>convert_abapspooljob_2_pdf( exporting i_spoolid = sy-spono importing e_xstring = l_xstring ).

If you find something, you are welcome...


Kind regards,

Fred