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: 

Export xlsx from Alv Report

afifnuzia_alasadi
Participant
0 Kudos

Hi guys, i have little problem from my report. I want to export to excel from alv report, the header have be export, but the conatin is no like this

from alv report this

And why always there is a checkbox? even though i didnot make the checkbox.

this my code

*Declare for ALV

type-pools : slis.

*declare for internal table type

types: begin of t_gb,

           sel,

           no(3type i,

           matnr  type afpo-matnr,

           aufnr  type afpo-aufnr,

           maktx  type makt-maktx,

           erfmg  type resb-erfmg,

           erfme  type resb-erfme,

           mtart  type mara-mtart,

           lgort  type resb-lgort,

         end of t_gb.

*Work area ALV

data: wa_tgb type t_gb,

       i_wa_tgb type standard table of t_gb.

*ALV report

data: tgb_f         type slis_fieldcat_alv,

       wa_tgb_f      type slis_t_fieldcat_alv,

       wa_gb_layout  type slis_layout_alv,

       r_ucomm       type sy-ucomm,

       rs_selfield   type slis_selfield,

       f_selfield    type slis_selfield-value,

       f_program     type sy-repid.

*decare list dropdown

DATA :

       name  type vrm_id,

       list  type vrm_values,

       value type vrm_value,

       xlow_aufnr  TYPE afko-aufnr,

       xhigh_aufnr TYPE afko-aufnr,

       qtyerfmg    TYPE resb-erfmg,

       no(3)    type i.

*initialixation

initialization.

       f_program  = sy-repid.


clear:tgb_f, wa_tgb_f.

     data lv_col type i value 0.


lv_col          = 1 + lv_col.

     tgb_f-col_pos   = lv_col.

     tgb_f-fieldname = 'no'.

     tgb_f-tabname   = 'i_wa_tgb'.

     tgb_f-seltext_l = 'No'.

     append tgb_f to wa_tgb_f.

     clear tgb_f.

     lv_col          = 1 + lv_col.

     tgb_f-col_pos   = lv_col.

     tgb_f-fieldname = 'matnr'.

     tgb_f-tabname   = 'i_wa_tgb'.

     tgb_f-seltext_l = 'Component'.

     append tgb_f to wa_tgb_f.

     clear tgb_f.

     lv_col          = 1 + lv_col.

     tgb_f-col_pos   = lv_col.

     tgb_f-fieldname = 'maktx'.

     tgb_f-tabname   = 'i_wa_tgb'.

     tgb_f-seltext_l = 'Description'.

     append tgb_f to wa_tgb_f.

     clear tgb_f.

     lv_col          = 1 + lv_col.

     tgb_f-col_pos   = lv_col.

     tgb_f-fieldname = 'erfmg'.

     tgb_f-tabname   = 'i_wa_tgb'.

     tgb_f-seltext_l = 'Qty'.

     append tgb_f to wa_tgb_f.

     clear tgb_f.

     lv_col          = 1 + lv_col.

     tgb_f-col_pos   = lv_col.

     tgb_f-fieldname = 'erfme'.

     tgb_f-tabname   = 'i_wa_tgb'.

     tgb_f-seltext_l = 'UoM'.

     append tgb_f to wa_tgb_f.

     clear tgb_f.

     lv_col          = 1 + lv_col.

     tgb_f-col_pos   = lv_col.

     tgb_f-fieldname = 'lgort'.

     tgb_f-tabname   = 'i_wa_tgb'.

     tgb_f-seltext_l = 'Sloc'.

     append tgb_f to wa_tgb_f.

     clear tgb_f.

     lv_col          = 1 + lv_col.

     tgb_f-col_pos   = lv_col.

     tgb_f-fieldname = 'mtart'.

     tgb_f-tabname   = 'i_wa_tgb'.

     tgb_f-seltext_l = 'Mat Type'.

     append tgb_f to wa_tgb_f.

     clear tgb_f.

     wa_gb_layout-zebra = 'X'.

     wa_gb_layout-colwidth_optimize = 'X'.

     wa_gb_layout-box_fieldname = 'SEL'.

     if i_wa_tgb is not initial and wa_tgb_f is not initial.

     call function 'REUSE_ALV_LIST_DISPLAY'

      exporting

*      I_INTERFACE_CHECK              = ' '

*      I_BYPASSING_BUFFER             =

*      I_BUFFER_ACTIVE                = ' '

        i_callback_program             = f_program

*      i_callback_pf_status_set       = ' '

*       i_callback_user_command        = 'UCOMM_EKKO'

*      I_STRUCTURE_NAME               =

        is_layout                      = wa_gb_layout

        it_fieldcat                    = wa_tgb_f

*      IT_EXCLUDING                   =

*      IT_SPECIAL_GROUPS              =

*      IT_SORT                        =

*      IT_FILTER                      =

*      IS_SEL_HIDE                    =

*      I_DEFAULT                      = 'X'

*      I_SAVE                         = ' '

*      IS_VARIANT                     =

*       it_events                      = it_event_ekko

*      IT_EVENT_EXIT                  =

*      IS_PRINT                       =

*      IS_REPREP_ID                   =

*      I_SCREEN_START_COLUMN          = 0

*      I_SCREEN_START_LINE            = 0

*      I_SCREEN_END_COLUMN            = 0

*      I_SCREEN_END_LINE              = 0

*      IR_SALV_LIST_ADAPTER           =

*      IT_EXCEPT_QINFO                =

*      I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE

*    IMPORTING

*      E_EXIT_CAUSED_BY_CALLER        =

*      ES_EXIT_CAUSED_BY_USER         =

      tables

        t_outtab                       = i_wa_tgb

      exceptions

        program_error                  = 1

        others                         = 2.

   endif.

thank you guys

5 REPLIES 5

former_member182915
Active Contributor
0 Kudos

Hi Afif,

Which icon you use for excel download ?

0 Kudos

Hi Swadhin

i choose number 1

raymond_giuseppi
Active Contributor
0 Kudos

You wrote


And why always there is a checkbox? even though i didnot make the checkbox.

But also


     wa_gb_layout-box_fieldname = 'SEL'.

Else did you try the multiple option for Excel export/inplace, read 358644 - ALV Export Excel: Recommendations and known errors. Which format did you select at popup (I prefer MHTML)

Regards,

Raymond

0 Kudos

hi raymond.

i dont know if it use to checkbox. Ok thank you.

afifnuzia_alasadi
Participant
0 Kudos

Hei guys how can i fix it? Can any one help me to solve this?

Cause this important in my jobdesk