2007 Feb 08 2:54 PM
Hi
I have a alv report which is showing fine but when i try to export it to say excel sheet or do print preview some of the data is missing. Can anyone tell me how to fix this. or at least point to some document that discuss this problem.
Here is my ALV CODE
************************************************************************
* CALL_ALV
************************************************************************
form call_alv.
* v_repid = sy-repid.
perform build_field_catalog using field_tab[].
perform build_eventtab using events[].
perform comment_build using header_alv[].
perform build_sorttab using gt_sort[].
* perform build_layout.
* v_variant-variant = '/TEST3'.
* Call ABAP List Viewer
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = v_repid
i_callback_user_command = ''
i_structure_name = 'REC'
it_fieldcat = field_tab[]
it_special_groups = gt_sp_group[]
it_sort = gt_sort[]
i_save = v_save
is_variant = v_variant
it_events = events[]
* is_layout = gd_layout
tables
t_outtab = REC
exceptions
program_error = 1
others = 2.
endform.
From my Catalog this data is missing
************************************************************************
* BUILD_FIELD_CATALOG
************************************************************************
form build_field_catalog USING pt_fieldcat type
slis_t_fieldcat_alv.
data: ls_fieldcat type slis_fieldcat_alv.
clear: fieldcat, pt_fieldcat[].
ls_fieldcat-tabname = 'REC'.
ls_fieldcat-edit = ' '.
**********************************************************************
ls_fieldcat-fieldname = 'PERNR'.
ls_fieldcat-seltext_s = 'Employee # '.
ls_fieldcat-seltext_m = 'Employee # '.
ls_fieldcat-seltext_l = 'Employee # '.
ls_fieldcat-datatype = 'C'.
append ls_fieldcat to pt_fieldcat.
There r coupole that's missing
But there couple that show's up like this one
**********************************************************************
ls_fieldcat-fieldname = 'STIME'.
ls_fieldcat-seltext_s = 'ST '.
ls_fieldcat-seltext_m = 'St Tm '.
ls_fieldcat-seltext_l = 'Start Time '.
ls_fieldcat-datatype = 'C'.
append ls_fieldcat to pt_fieldcat.
**********************************************************************
ls_fieldcat-fieldname = 'ETIME'.
ls_fieldcat-seltext_s = 'ET '.
ls_fieldcat-seltext_m = 'Et Tm '.
ls_fieldcat-seltext_l = 'End Time '.
append ls_fieldcat to pt_fieldcat.
I always reward points.
Thanks
2007 Feb 08 3:18 PM
Hello,
It could be linked to security settings in MS Office. here is an interesting link on this subject http://www.leeds.ac.uk/iss/projects/sap_upgrade/ALV_Superuser_message.doc
2007 Feb 08 3:02 PM
hi Anwarul,
Try the following code:
************************************************************************
* CALL_ALV
************************************************************************
form call_alv.
* v_repid = sy-repid.
perform build_field_catalog using field_tab[].
perform build_eventtab using events[].
perform comment_build using header_alv[].
perform build_sorttab using gt_sort[].
* perform build_layout.
* v_variant-variant = '/TEST3'.
* Call ABAP List Viewer
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = v_repid
i_callback_user_command = ''
i_structure_name = 'REC'
it_fieldcat = field_tab[]
it_special_groups = gt_sp_group[]
it_sort = gt_sort[]
i_save = v_save
is_variant = v_variant
it_events = events[]
* is_layout = gd_layout
tables
t_outtab = REC
exceptions
program_error = 1
others = 2.
endform.
form build_field_catalog USING pt_fieldcat type
slis_t_fieldcat_alv.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
I_PROGRAM_NAME = sy-repid
I_STRUCTURE_NAME = 'REC'
changing
CT_FIELDCAT = pt_fieldcat.
When you export to excel, the character fields and numeric columns gets re-arranged, but all the fields will be displayed in this case.
hope this helps.
2007 Feb 08 3:54 PM
Thanks for the code. Now Excell is opening within my program and showing all the data but still if i try to save it or print it its doing the same old thing. One thing I want mention is I am actually missing some data not just columns r rearranging or something.
If my columns starts from
Employee #, Name, Type, Date, Daily Schedule, Start time, End Time...
Data starts from (in print preview/ exporting datat)
Start Time, End Time...
2007 Feb 08 3:18 PM
Hello,
It could be linked to security settings in MS Office. here is an interesting link on this subject http://www.leeds.ac.uk/iss/projects/sap_upgrade/ALV_Superuser_message.doc