How to download data into excel by displaying field names in top 2 rows

Hi experts,
         i am trying to download an internal table data into excel(open office) by reserving top 2 rows. In 1st row i want to display tech.name where as in 2nd row i want to display discription of tech name of the fields. Well, i tried with FM gui_upload and used fieldnames  parameter and even its working too but i'm unable to work with 2nd col.
Please help me out....
with regards.
Praveen.

Try this code:
If IT_FINAL is the internal table containing the data that you want to download :
IF IT_FINAL[] IS INITIAL.
    WRITE : 'No Data Fetched'.
  ELSE.
  Build header table Field catelague
    PERFORM UR_FIELDCAT_BUILD USING G_F_REPNM
                                    'IT_FINAL'
                             CHANGING IT_FCAT_001.
    DATA: L_F_LINES TYPE I,
          L_F_FROM TYPE I,
          L_F_TO TYPE I,
          L_F_DIFF TYPE I,
          L_TEMP_FINAL LIKE TABLE OF IT_FINAL.
    DESCRIBE TABLE IT_FINAL LINES L_F_LINES.
    IF L_F_LINES > 16000.
      L_F_FROM = 1.
      L_F_TO = 16000.
      DO.
        APPEND LINES OF IT_FINAL FROM L_F_FROM
                                          TO L_F_TO TO L_TEMP_FINAL.
        PERFORM DOWNLOAD_DATA_HEADER TABLES L_TEMP_FINAL
                                               IT_FCAT_001
                                         USING GF_FILE1.
        IF L_F_TO >= L_F_LINES.
          EXIT.
        ENDIF.
        L_F_FROM = L_F_TO + 1.
        L_F_DIFF = L_F_LINES - L_F_TO.
        IF L_F_DIFF >= 16000.
          L_F_TO = L_F_TO + 16001.
        ELSE.
          L_F_TO = L_F_LINES.
        ENDIF.
        REFRESH: L_TEMP_FINAL.
     ENDDO.
   ELSE.
     PERFORM DOWNLOAD_DATA_HEADER TABLES IT_FINAL
                                     IT_FCAT_001
                              USING GF_FILE1.
   ENDIF.
ENDIF.
FORM UR_FIELDCAT_BUILD
             USING P_REPID
                   P_TABNAM
CHANGING C_T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
   REFRESH C_T_FIELDCAT.
   CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
             I_PROGRAM_NAME         = P_REPID
             I_INTERNAL_TABNAME     = P_TABNAM
           I_STRUCTURE_NAME       = 'TY_FLODAT'
             I_INCLNAME             = P_REPID
             I_BYPASSING_BUFFER     = 'X'
        CHANGING
             CT_FIELDCAT            = C_T_FIELDCAT
        EXCEPTIONS
             INCONSISTENT_INTERFACE = 1
             PROGRAM_ERROR          = 2
             OTHERS                 = 3.
ENDFORM.
FORM DOWNLOAD_DATA_HEADER
              TABLES T_OUTTAB
              T_FIELDCAT
              USING P_FILENAM.
   TYPE-POOLS: SLIS.
   REPLACE 'YYYYMMDD' WITH SY-DATUM INTO P_FILENAM.
   DATA: T_GXXLT_O    TYPE TABLE OF GXXLT_O WITH HEADER LINE,
         T_GXXLT_H    TYPE TABLE OF GXXLT_H WITH HEADER LINE,
         T_GXXLT_H_TEMP TYPE TABLE OF GXXLT_H WITH HEADER LINE,
         T_GXXLT_P    TYPE TABLE OF GXXLT_P WITH HEADER LINE,
         T_GXXLT_S    TYPE TABLE OF GXXLT_S WITH HEADER LINE,
         T_GXXLT_V    TYPE TABLE OF GXXLT_V WITH HEADER LINE,
         L_S_FIELDCAT TYPE SLIS_FIELDCAT_ALV..
   DATA: F_FILE       TYPE GXXLT_F-FILE,
         F_ATT_COLS   TYPE I,
         F_HRZ_KEYS   TYPE I,
         F_VRT_KEYS   TYPE I.
TYPES: BEGIN OF TY_FLDNM,
           FIELDNAME(30) TYPE C,
        END   OF TY_FLDNM.
DATA : L_T_FLDNAME TYPE TABLE OF TY_FLDNM,
        L_R_FLDNAME TYPE TY_FLDNM.
REFRESH:  L_T_FLDNAME.
LOOP AT T_FIELDCAT INTO L_S_FIELDCAT .
   CLEAR L_R_FLDNAME.
   CONCATENATE  L_S_FIELDCAT-SELTEXT_S  '_'
                L_S_FIELDCAT-FIELDNAME
    INTO L_R_FLDNAME-FIELDNAME.
   APPEND L_R_FLDNAME TO L_T_FLDNAME.
ENDLOOP.
IF T_OUTTAB[] IS INITIAL.
   WRITE : /'No data Fetch !'.
ELSE.
   DESCRIBE TABLE T_FIELDCAT LINES F_ATT_COLS.
   LOOP AT T_FIELDCAT INTO L_S_FIELDCAT.
     T_GXXLT_H-COL_NO        = L_S_FIELDCAT-COL_POS.
     T_GXXLT_H-ROW_NO        = 1.
     T_GXXLT_H-COL_NAME      = L_S_FIELDCAT-FIELDNAME.
     APPEND T_GXXLT_H.
     CLEAR T_GXXLT_S.
     T_GXXLT_S-COL_NO        = L_S_FIELDCAT-COL_POS.
     T_GXXLT_S-COL_OPS       = 'NOP'.
     T_GXXLT_S-COL_SRC       = L_S_FIELDCAT-COL_POS.
     CASE L_S_FIELDCAT-INTTYPE.
       WHEN 'Z' OR 'P' OR 'I' OR 'F'.
         T_GXXLT_S-COL_TYP   = 'NUM'.
       WHEN 'C' OR 'X' OR 'T' OR 'N'.
         T_GXXLT_S-COL_TYP   = 'STR'.
       WHEN 'D'.
         T_GXXLT_S-COL_TYP   = 'DAT'.
      WHEN OTHERS.
        T_GXXLT_S-COL_TYP   = 'STR'.
    ENDCASE.
    APPEND T_GXXLT_S.
    IF L_S_FIELDCAT-KEY EQ 'X'.
      CLEAR T_GXXLT_H.
      T_GXXLT_H-COL_NO     = L_S_FIELDCAT-COL_POS.
      T_GXXLT_H-ROW_NO     = 1.
      T_GXXLT_H-COL_NAME   = L_S_FIELDCAT-FIELDNAME.
      APPEND T_GXXLT_H.
    ENDIF.
  ENDLOOP.
  MOVE P_FILENAM TO F_FILE.
  LOOP AT T_FIELDCAT INTO L_S_FIELDCAT.
    READ TABLE T_GXXLT_H WITH KEY COL_NAME = L_S_FIELDCAT-FIELDNAME.
    IF SY-SUBRC EQ 0.
      T_GXXLT_H_TEMP-COL_NO = T_GXXLT_H-COL_NO.
      T_GXXLT_H_TEMP-ROW_NO = 2.
      T_GXXLT_H_TEMP-COL_NAME =  L_S_FIELDCAT-SELTEXT_S.
      APPEND T_GXXLT_H_TEMP TO T_GXXLT_H.
      CLEAR T_GXXLT_H.
      ENDIF.
    ENDLOOP.
    CALL FUNCTION 'XXL_FULL_API'
         EXPORTING
              FILENAME          = F_FILE
              NO_START          = ''
              N_ATT_COLS        = F_ATT_COLS
              N_HRZ_KEYS        = F_HRZ_KEYS
              N_VRT_KEYS        = F_VRT_KEYS
              SEMA_TYPE         = ''
              SO_TITLE          = ''
         TABLES
              DATA              = T_OUTTAB
              HKEY              = T_GXXLT_H
              ONLINE_TEXT       = T_GXXLT_O
              PRINT_TEXT        = T_GXXLT_P
              SEMA              = T_GXXLT_S
              VKEY              = T_GXXLT_V
         EXCEPTIONS
              CANCELLED_BY_USER = 1
              DATA_TOO_BIG      = 2
              DIM_MISMATCH_DATA = 3
              DIM_MISMATCH_SEMA = 4
              DIM_MISMATCH_VKEY = 5
            ERROR_IN_HKEY     = 6
            ERROR_IN_SEMA     = 7
            FILE_OPEN_ERROR   = 8
            FILE_WRITE_ERROR  = 9
            INV_DATA_RANGE    = 10
            INV_WINSYS        = 11
            INV_XXL           = 12
            OTHERS            = 13.
  ENDIF.
ENDFORM.

Similar Messages

  • How to download data into  two different columns 2003 excel format in ole

    Hi ALL
    when we download data into excel using ole with delimiter it works fine in 2007 but when we check this with 2003 format
    both fields come in only one column .Can any one suggest  
      CONCATENATE WA_ALL-PERNR LV_ICNUM INTO WA_PERNR SEPARATED BY W_DELI   IN CHARACTER MODE.

    If you're already using OLE, you can fill in value for each cell separately instead of using a delimiter. Something like this fragment:
    FORM fill_cell USING p_row p_col p_value.
      CALL METHOD OF obj_excel 'CELLS' = obj_cell
        EXPORTING
        #1 = p_row
        #2 = p_col.
      SET PROPERTY OF obj_cell 'VALUE' = p_value.
    ENDFORM.                    "fill_cell

  • How to download data in excel from web report in sap ?

    how to download data in excel from web report made  in sap abap?
    through tcode smw0.

    for exemple using
    MS_EXCEL_OLE_STANDARD_DAT

  • How to download  data into XLSX file in ABAP ECC 6.0 using FM: GUI_DOWNLOAD or any other FunctionModules

    Hi ABAP Exterts,
    Any one help on this , there is a requirement to download the data into XLSX file only.
    I am able to to download the data into XLS file using the FM: GUI_DOWNLOAD in SAP ECC 6.0and also opening the file . But when i download the data into XLSX file . I am able to download the data into GUI_DOWNLOAD. But while opening the file i am getting the below mentioned error.
    'Excel cannot open the file 'filename.xlsx' because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file'
    Ok buttom is coming not able to open the file.
    When i use the FM: SAP_CONVERT_TO_XLS_FORMAT to download the XLS it self it is going abap DUMP that file type error.
    Any one help  any Function Module or how to download data through abap programing into XLSX file.
    Thanks.
    Murali.
    Message was edited by: Matthew Billingham - adjusted wording...

    If you want to download your ALV to an .XLXS format file, with all the formatting intact, please try the following code. I have tried to create a custom Function module Z_EXCEL_DOWNLOAD_TEST wherein I pass all the callback variables, the final ALV internal table and all the ALV details like field catalog, sort, layout, event list and so on, along with the concatenated file path and file name in I_FILE. I have used a custom class ZCL_SALVEXPORT_XML which is a copy of the standard class CL_SALV_EXPORT_XML_DIALOG, with few modifications in Method: EXECUTE and Method: DOWNLOAD. The methods where I have modified the code are also shown at the end.
    ****************Global declarations***********************
    TYPE-POOLS: slis,
    kkblo.
    TYPES: t_fccls(1) TYPE c OCCURS 0.
    TYPES: BEGIN OF ty_nosum,
    fieldname     TYPE kkblo_fieldname,           "Field name
    tabname       TYPE kkblo_tabname,             "Table name
    fieldname_dep TYPE kkblo_fieldname,           "Field name
    tabname_dep   TYPE kkblo_tabname,             "Table name
    index         TYPE sy-index,                  "Index
    END OF ty_nosum.
    TYPES: t_nosum TYPE TABLE OF ty_nosum INITIAL SIZE 0 WITH NON-UNIQUE DEFAULT KEY.
    TYPES: BEGIN OF ty_dep_field,
    s_dep_fieldcat TYPE kkblo_fieldcat,            "Field cat
    t_ref_fieldcat TYPE kkblo_t_fieldcat,          "Field cat
    END OF ty_dep_field.
    TYPES: BEGIN OF ty_ref_field,
    s_ref_fieldcat TYPE kkblo_fieldcat,           "Field cat
    s_dep_fieldcat TYPE kkblo_fieldcat,           "Field cat
    END OF ty_ref_field.
    TYPES: t_dep_field TYPE ty_dep_field OCCURS 0.        "
    TYPES: t_ref_field TYPE ty_ref_field OCCURS 0.
    TYPES: BEGIN OF ty_memory,
    object(20)  TYPE c,                        "Object
    memcount(4) TYPE c,                        "count
    END OF ty_memory.
    *ALV Customer Wrapper
    TYPES: BEGIN OF ty_type_header_info,
    tabname   TYPE kkblo_tabname,            "Table name
    fieldname TYPE kkblo_fieldname,          "Field name
    sequence  TYPE i,                        "Sequence
    field     TYPE char80,                    "Field
    pagno     TYPE sypagno,                   "Page num
    linno     TYPE sy-linno,                  "Current Line in List
    colno     TYPE sy-colno,                  "Current List Column
    END   OF ty_type_header_info,
    t_type_header_info TYPE SORTED TABLE OF ty_type_header_info
    WITH UNIQUE KEY tabname fieldname.
    TYPES: BEGIN OF ty_type_row_info,
    tabname   TYPE kkblo_tabname,            "Table name
    tabindex  TYPE syindex,                  "Index
    field     TYPE char80,                   "Field name
    pagno     TYPE sypagno,                  "Page num
    linno     TYPE sy-linno,                 "Current Line in List
    colno     TYPE sy-colno,                 "Current List Column
    END   OF ty_type_row_info,
    t_type_row_info TYPE SORTED TABLE OF ty_type_row_info
    WITH UNIQUE KEY tabname tabindex.
    TYPES: BEGIN OF ty_type_sel_header,
    tabname   TYPE kkblo_tabname,           "table name
    fieldname TYPE kkblo_fieldname,         "field name
    END   OF ty_type_sel_header,
    t_type_sel_header TYPE SORTED TABLE OF ty_type_sel_header
    WITH UNIQUE KEY tabname fieldname.
    TYPES: BEGIN OF ty_type_sel_row,
    tabname   TYPE kkblo_tabname,
    tabindex  TYPE syindex,
    END   OF ty_type_sel_row,
    t_type_sel_row TYPE SORTED TABLE OF ty_type_sel_row
    WITH UNIQUE KEY tabname tabindex.
    TYPES: BEGIN OF ty_type_sel_cell,
    tabname   TYPE kkblo_tabname,
    tabindex  TYPE syindex,
    fieldname TYPE kkblo_fieldname,
    END   OF ty_type_sel_cell.
    TYPES: BEGIN OF ty_type_selections,
    t_row_info         TYPE t_type_row_info,
    t_header_info      TYPE t_type_header_info,
    t_selected_headers TYPE t_type_sel_header,
    t_selected_rows    TYPE t_type_sel_row,
    s_current_cell     TYPE ty_type_sel_cell,
    set_headers        TYPE sap_bool,
    set_rows           TYPE sap_bool,
    set_current_cell   TYPE sap_bool,
    END   OF ty_type_selections.
    TYPES: BEGIN OF ty_stack3,
    r_grid         TYPE REF TO cl_gui_alv_grid,        "Y6DK050176
    r_salv_adapter TYPE REF TO if_salv_adapter,
    s_selections   TYPE ty_type_selections,
    r_print_state  TYPE REF TO if_alv_print_parameter_proxy, "Y6DK075821
    suppress_empty_data TYPE abap_bool,
    END OF ty_stack3.
    TYPES: t_stack3 TYPE ty_stack3 OCCURS 0.
    TYPES: BEGIN OF ty_stack,
    i_callback_program       TYPE sy-repid,
    i_callback_user_command  TYPE kkblo_formname,
    i_callback_top_of_page   TYPE kkblo_formname,
    i_callback_top_of_list   TYPE kkblo_formname,
    i_callback_end_of_page   TYPE kkblo_formname,
    i_callback_end_of_list   TYPE kkblo_formname,
    i_callback_pf_status_set TYPE kkblo_formname,
    i_callback_fieldcat_save TYPE kkblo_formname,
    i_callback_layout_save   TYPE kkblo_formname,
    i_tabname                TYPE kkblo_tabname,
    i_tabname_slave          TYPE kkblo_tabname,
    is_keyinfo               TYPE kkblo_keyinfo,
    is_layout                TYPE kkblo_layout,
    it_fieldcat              TYPE kkblo_t_fieldcat,
    i_fctype(1)              TYPE c,
    it_excluding             TYPE kkblo_t_extab,
    it_special_groups        TYPE kkblo_t_sp_group,
    it_sort                  TYPE kkblo_t_sortinfo,
    it_except_qinfo          TYPE kkblo_t_qinfo,
    is_sel_hide              TYPE kkblo_sel_hide,
    t_columns                TYPE kkblo_t_columns,
    t_filter                 TYPE kkblo_t_filter,
    s_lprint                 TYPE kkblo_lprint,
    print_line_break         TYPE char1,
    t_isetab                 TYPE kkblo_seldis,
    t_fccls                  TYPE t_fccls,
    t_sfinfo                 TYPE kkblo_t_sfinfo,
    t_ref_field              TYPE t_ref_field,
    t_dep_field              TYPE t_dep_field,
    flg_default_status(1)    TYPE c,
    flg_selections           TYPE char1,
    flg_allow_no_selection   TYPE char1,
    flg_input                TYPE char1,
    flg_called               TYPE char1,
    flg_popup                TYPE char1,
    flg_endlist              TYPE char1,
    listtype                 TYPE char1,
    actcols                  TYPE i,
    is_list                  TYPE char1,
    END OF ty_stack.
    TYPES: t_stack TYPE ty_stack OCCURS 0.
    TYPES: BEGIN OF ty_stack2,
    button_col1(20)                TYPE c,
    button_col2(20)                TYPE c,
    button_col3(20)                TYPE c,
    button_col4(20)                TYPE c,
    button_col5(20)                TYPE c,
    s_header                       TYPE kkblo_header,
    t_sfinfo_slave                 TYPE kkblo_t_sfinfo,
    t_suminfo                      TYPE kkblo_t_sfinfo,
    t_sfsave                       TYPE kkblo_t_sfinfo,
    t_nosum                        TYPE t_nosum,
    window_title                   TYPE rsmpe-tittext,  " Item_selection
    flg_scroll_to_line(1)          TYPE c, " Item_selection
    flg_top_of_page(1)             TYPE c,
    flg_subtot(1)                  TYPE c,
    flg_output_in_progress(1)      TYPE c,
    flg_grouplevels(1)             TYPE c,
    flg_groupedit(1)               TYPE c,
    flg_calculate_totals(1)        TYPE c,
    sumlevel                       TYPE sy-tabix,
    memory_stack1                  TYPE ty_memory,
    memory_stack2                  TYPE ty_memory,
    memory_outtab                  TYPE ty_memory,
    t_colmark                      TYPE kkblo_t_colmark,
    t_rowmark                      TYPE kkblo_t_rowmark,
    it_event_exit                  TYPE kkblo_t_event_exit,
    t_groups                       TYPE kkblo_t_grouplevels,
    t_filter_groups                TYPE kkblo_t_grouplevels,
    s_subtot_options               TYPE kkblo_subtot_options,
    flg_append_mode(1)             TYPE c,
    is_reprep_id                   TYPE kkblo_reprep_id,
    i_callback_before_line_output  TYPE kkblo_formname,
    i_callback_after_line_output   TYPE kkblo_formname,
    i_callback_foreign_top_of_page TYPE kkblo_formname,
    i_callback_foreign_end_of_page TYPE kkblo_formname,
    i_callback_list_modify         TYPE kkblo_formname,
    i_callback_top_of_coverpage    TYPE kkblo_formname,
    i_callback_end_of_coverpage    TYPE kkblo_formname,
    i_callback_grouplevel_change   TYPE kkblo_formname,
    i_callback_item_data_expand    TYPE kkblo_formname,
    i_callback_header_transport    TYPE kkblo_formname,
    i_callback_reprep_sel_modify   TYPE kkblo_formname,
    i_callback_subtotal_text       TYPE kkblo_formname,
    END OF ty_stack2.
    TYPES: t_stack2 TYPE TABLE OF ty_stack2 INITIAL SIZE 0.
    ** *--- iTables
    DATA: it_stack  TYPE t_stack WITH HEADER LINE.
    DATA: it_stack2 TYPE t_stack2 WITH HEADER LINE.
    ***ALV Customer Wrapper
    DATA: it_stack3 TYPE t_stack3 WITH HEADER LINE.
    CONSTANTS: BEGIN OF c_con_listtype,
    simple(1)    TYPE c VALUE 'S',
    hier_sequ(1) TYPE c VALUE 'H',
    matrix(1)    TYPE c VALUE 'M',
    END OF c_con_listtype.
    DATA:   gv_callback_program1      TYPE sy-repid,
    gv_callback_user_command1 TYPE kkblo_formname,
    gv_callback_top_of_page1  TYPE kkblo_formname,
    gv_callback_top_of_list1  TYPE kkblo_formname,
    gv_callback_end_of_page1  TYPE kkblo_formname,
    gv_callback_end_of_list1   TYPE kkblo_formname,
    gv_callback_pf_status_set1  TYPE kkblo_formname,
    gv_callback_layout_save1    TYPE kkblo_formname,
    gv_callback_fieldcat_save1  TYPE kkblo_formname,
    gv_callback_grouplevel_change1  TYPE kkblo_formname,
    gv_callback_before_line_otput1  TYPE kkblo_formname,
    gv_callback_after_line_otput1  TYPE kkblo_formname,
    gv_callback_foreign_top_of_pg1  TYPE kkblo_formname,
    gv_callback_foreign_end_of_pg1  TYPE kkblo_formname,
    gv_callback_list_modify1          TYPE kkblo_formname,
    gv_callback_top_of_coverpge1     TYPE kkblo_formname,
    gv_callback_end_of_coverpge1     TYPE kkblo_formname,
    gv_callback_item_data_expand1     TYPE kkblo_formname,
    gv_callback_header_transport1     TYPE kkblo_formname,
    gv_callback_reprep_sel_modify1    TYPE kkblo_formname,
    gv_callback_subtotal_text1       TYPE kkblo_formname,
    gv_layout1   TYPE  kkblo_layout,
    gv_fieldcat1  TYPE  kkblo_t_fieldcat,
    gv_fctype1  TYPE c,
    gv_event_exit1  TYPE  kkblo_t_event_exit,
    gv_excluding1   TYPE  kkblo_t_extab,
    gv_special_groups1  TYPE  kkblo_t_sp_group,
    gv_sort1  TYPE  kkblo_t_sortinfo,
    gv_filter1  TYPE  kkblo_t_filter,
    gv_except_qinfo1  TYPE  slis_t_qinfo_alv,
    gv_sel_hide1  TYPE  slis_sel_hide_alv,
    gv_reprep_id1   TYPE  slis_reprep_id,
    gv_screen_start_column1  TYPE i,
    gv_salv_adapter1   TYPE REF TO if_salv_adapter,
    gv_suppress_empty_data1  TYPE  sap_bool.
    FUNCTION z_excel_download_test.
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(I_BYPASSING_BUFFER) TYPE  CHAR01 OPTIONAL
    *"     REFERENCE(I_BUFFER_ACTIVE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_PROGRAM) TYPE  SY-REPID OPTIONAL
    *"     REFERENCE(I_CALLBACK_USER_COMMAND) OPTIONAL
    *"     REFERENCE(I_CALLBACK_TOP_OF_PAGE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_TOP_OF_LIST) OPTIONAL
    *"     REFERENCE(I_CALLBACK_END_OF_PAGE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_END_OF_LIST) OPTIONAL
    *"     REFERENCE(I_CALLBACK_PF_STATUS_SET) OPTIONAL
    *"     REFERENCE(I_CALLBACK_LAYOUT_SAVE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_FIELDCAT_SAVE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_GROUPLEVEL_CHANGE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_BEFORE_LINE_OUTPUT) OPTIONAL
    *"     REFERENCE(I_CALLBACK_AFTER_LINE_OUTPUT) OPTIONAL
    *"     REFERENCE(I_CALLBACK_FOREIGN_TOP_OF_PAGE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_FOREIGN_END_OF_PAGE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_LIST_MODIFY) OPTIONAL
    *"     REFERENCE(I_CALLBACK_TOP_OF_COVERPAGE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_ITEM_DATA_EXPAND) OPTIONAL
    *"     REFERENCE(I_CALLBACK_END_OF_COVERPAGE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_HEADER_TRANSPORT) OPTIONAL
    *"     REFERENCE(I_CALLBACK_REPREP_SEL_MODIFY) OPTIONAL
    *"     REFERENCE(I_CALLBACK_SUBTOTAL_TEXT) OPTIONAL
    *"     REFERENCE(I_TABNAME) TYPE  SLIS_TABNAME OPTIONAL
    *"     REFERENCE(I_FCTYPE) DEFAULT 'R'
    *"     REFERENCE(IT_EXCEPT_QINFO) TYPE  SLIS_T_QINFO_ALV OPTIONAL
    *"     REFERENCE(IS_SEL_HIDE) TYPE  SLIS_SEL_HIDE_ALV OPTIONAL
    *"     REFERENCE(IS_REPREP_ID) TYPE  SLIS_REPREP_ID OPTIONAL
    *"     REFERENCE(I_SCREEN_START_COLUMN) DEFAULT 0
    *"     REFERENCE(I_OO_ALV) OPTIONAL
    *"     REFERENCE(IR_SALV_ADAPTER) TYPE REF TO  IF_SALV_ADAPTER OPTIONAL
    *"     REFERENCE(I_SUPPRESS_EMPTY_DATA) TYPE  SAP_BOOL DEFAULT
    *"       ABAP_FALSE
    *"     REFERENCE(I_FILE) TYPE  STRING OPTIONAL
    *"     REFERENCE(IT_FIELDCAT) TYPE  SLIS_T_FIELDCAT_ALV OPTIONAL
    *"     REFERENCE(IS_LAYOUT) TYPE  SLIS_LAYOUT_ALV OPTIONAL
    *"     REFERENCE(IT_SORT) TYPE  SLIS_T_SORTINFO_ALV OPTIONAL
    *"     REFERENCE(IT_FILTER) TYPE  SLIS_T_FILTER_ALV OPTIONAL
    *"     REFERENCE(IT_EXCLUDING) TYPE  SLIS_T_EXTAB OPTIONAL
    *"     REFERENCE(IT_SPECIAL_GROUPS) TYPE  SLIS_T_SP_GROUP_ALV OPTIONAL
    *"     REFERENCE(IS_KEYINFO) TYPE  SLIS_KEYINFO_ALV OPTIONAL
    *"     REFERENCE(IT_EVENT_EXIT) TYPE  SLIS_T_EVENT_EXIT OPTIONAL
    *"     REFERENCE(IS_LIST_SCROLL) TYPE  SLIS_LIST_SCROLL OPTIONAL
    *"     REFERENCE(IS_PRINT) TYPE  SLIS_PRINT_ALV OPTIONAL
    *"     REFERENCE(IS_LINEINFO) TYPE  SLIS_LINEINFO OPTIONAL
    *"     REFERENCE(I_REPID) TYPE  SYREPID OPTIONAL
    *"  TABLES
    *"      T_OUTTAB TYPE  STANDARD TABLE OPTIONAL
    *********** Local data declarations******************
    DATA: gv_list TYPE char1.
    DATA: gv_fcat_complete TYPE sap_bool.
    DATA: gv_buffer_active TYPE char01,
    wa_variant TYPE disvariant.
    DATA: gv_controller TYPE REF TO cl_salv_export_c8r.
    DATA: gv_xml           TYPE xstring.
    DATA: gv_s_xml_choice TYPE if_salv_bs_xml=>s_type_xml_choice.
    DATA: gv_t_xml_choice TYPE if_salv_bs_xml=>t_type_xml_choice.
    DATA: gv_param_lvc TYPE if_salv_export=>s_type_param_lvc.
    DATA: gv_data       TYPE REF TO data.
    DATA: gv_result_data TYPE REF TO cl_salv_ex_result_data_table.
    DATA: gv_flavour TYPE string.
    DATA: gv_version TYPE string.
    DATA:

  • How to download data using excel vba.

    I'm trying to download data from web sites to excel using VBA.  I've found a bunch of resources like this one on stackoverflow, but they all refer to excel being run on windows.
    Does anyone know how to either scrape data or to use an API to pull data into excel?

    for exemple using
    MS_EXCEL_OLE_STANDARD_DAT

  • Back ground job to download data into excel in the given path on sel-screen

    Hi Friends,
      I have 2 radion buttons on the selection screen 1. Online 2. Back ground.
    If i select the back ground radion button all program should run in back ground only, and finally the data should be downloaded to excel file on the given path in selection screen.
    Does any one have code for this.
    Thanks in advance
    Ajay
    Edited by: Ajay kumar on Aug 30, 2010 11:03 AM

    Hi Ajay,
    try this way..
    If sy-batch = 'X' . "background Job
    *   Submit report in background and creating spool
      SUBMIT (w_rname) USING SELECTION-SET p_var
          TO SAP-SPOOL WITHOUT SPOOL DYNPRO
          SPOOL PARAMETERS wa_pri_params AND RETURN.
      COMMIT WORK AND WAIT.
    *   To fetch the spool number from TSP01 table
      IF sy-subrc EQ 0.
        SELECT rqident
               FROM tsp01
               INTO p_spool
    *             UP TO 1 ROWS
               WHERE rq2name = wa_pri_params-plist.
        ENDSELECT.
      ENDIF.
    ENDIF.
    * Fetching Spool data into internal table
      CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
        EXPORTING
          rqident              = p_spool
        TABLES
          buffer               = t_Excel_data.
    "Now format the Data into excel format or Comma seperated format and download to Appl server.
    Prabhudas

  • How to Download Data in Excel Formate

    Hi  Friend,
    I have one doubt on webdynpro with java.  Req: For download data in Excel formate.
    I will follow this http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/3596. [original link is broken] [original link is broken] [original link is broken]
      i am doing upto 3rd Step here.. Up to Step 3 i am doing after 3rd Step  I am not understand. Could u explain 4step.
    1. I have to place TableUtilities.java
    2. I have Create tableutilities value attribute
    3. in Modify view--- This is -SecondView -
    This is having Table UI Element.
         if(firstTime)
    IWDTextView tv = (IWDTextView)view.getElement("total");
    wdContext.currentContextElement().setTableutility(new TableUtilities(wdContext.nodeDepartments()));
    //Returns attribute info of a dynamically created attribute which can be bound to the UI element neeed.
    tv.bindText(wdContext.currentContextElement().getTableutility().CalculateSum("Departments","NoOfPeople"));
    4. Creating an Excel File
    How to Create Excel File here can u explain
    I am not understand this 4th step. Pls give me Breef Explanation. How to write this code...here...
    Regards
    Vijay Kalluri
    Edited by: KalluriVijay on May 4, 2010 8:00 PM
    Edited by: KalluriVijay on May 4, 2010 8:02 PM

    Hi Vijay,
    Please open Microsoft Excel from your system and then create some entries (ex. having 3 columns and 3 rows). Save this file to some location in your system. Later you will need to give the location path of this saved file when uploading it from your web dynpro application.
    Creating of an Excel file (i.e the 4th step) is no where related to Web Dynpro and NWDS.
    Hope this helps!
    Regards,
    Kishan

  • Download date into excel sheet without changing the properties of column

    Hi All,
    I am trying to download a date field from SAP to Excel sheet. But the date is getting downloaded successfully, but the format of the column is getting changed to DATE. Is there any way to restrict it?
    I am using GUI_DOWNLOAD for downloading the data.
    I have declared the date field as CHAR10  Eg (09/13/2011) and moving the data into excel.
    Result i need : data should be downlaoded as 09/13/2011 but format of the cell should not be changed.
    Regards
    Eswar.

    Hi Eswar,
    Change the date format type dats instead of char format or any standards like erdat from vbak.Then you can in proper format.
    Regards,
    Madhu.

  • How to download data into one cell of excel in different lines

    Hi All,
    My Report downloads data from R/3 to excel. Now one particular field contains multiple lines, which i needs to download into different lines into that particular cell(of excel). how can i do this.
    I found one method for this and that is cl_abap_char_utilities=>newline.But this is in abap version 6.0.
    But i am working in version 4.6c. do we have any method or anything that meets my requirement in 4.6c.
    Please let me know.
    Thanx in Advance
    Subhani.

    why do you split them to the internal table ,then download it?
    Is you special field long text?
    If is ,you can use FM READ_TEXT to put it into an internal table ,then download it.

  • Problem in Download data into Excel File

    Hi Friends,
    I have one doubt on WDJ.
             I have got the data from the Back and display the data into Table UI Element. Depending upon po_status equals to OA Pending that time conf_Ship_date Column is Empty. That time we can Select All Checkbox Click on Download Button Excel file is not download. Why it not download? Conf_Ship_date Column is Empty. Conf_Ship_date Column is data available that time data download into Excel File.
    My Req: if Conf_Ship_date Column is empty that time click on Download that data will download in to Excel. In Excel Conf_Ship_date Column will display in NULL or 00.00.0000 Like this also.
    Code:ExcelEle.setConf_Shp_Date(StockEle.getConf_Shp_Date()); 
    This means I am getting date from PoDetails_OutTab(StockEle)this node and add this date to PoDetails_ExcelData(ExcelEle) this node.Finally the date will available in PoDetails_ExcelData this node. By Using this node I will download data.
    How to do this work?
    Regards
    Vijay

    Hi Arun,
    For Example in Table 4 rows and 14 columns data is available. Select all check boxes click on download button total 4 rows and 14 columns data is downloaded.
    Table 4 rows and 14 columns data is available. But in some cells data not available in that time I m getting null values from ECC System. That time I am not able to download.
    In Particularly this problem I am getting only date colums.
    So now I have develop this code
    public void onActiondownloadToExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActiondownloadToExcel(ServerEvent)
         IPrivatePO_Details_ResultView.IPoDetails_ExcelDataNode ExcelNode = wdContext.nodePoDetails_ExcelData();
         IPrivatePO_Details_ResultView.IPoDetails_ExcelDataElement ExcelEle; 
         IPrivatePO_Details_ResultView.IPoDetails_OutTabNode StockNode = wdContext.nodePoDetails_OutTab();
         IPrivatePO_Details_ResultView.IPoDetails_OutTabElement StockEle ;
         for(int i = 0 ;i<StockNode.size();i++)
         StockEle = StockNode.getPoDetails_OutTabElementAt(i);
         if(StockEle.getCheckBox()== true)
         ExcelEle = ExcelNode.createPoDetails_ExcelDataElement();// Create Element
         if(StockEle.getConf_Shp_Date()==null)
         java.sql.Date deliverydate1=new java.sql.Date(0,0,0);
         ExcelEle.setConf_Shp_Date(deliverydate1);
         else
         ExcelEle.setConf_Shp_Date(StockEle.getConf_Shp_Date()); 
    By using this code i have to download total Records but in this Conf_Shp_Date colums i am getting 31-12.1899 this output in Excel. But i need in Excel to print Null or 00.00.0000 like
         ExcelEle.setQuantity(StockEle.getQuantity());
         ExcelEle.setDeliv_Date(StockEle.getDeliv_Date());
         if(StockEle.getExpt_Shp_Date()==null)
         java.sql.Date deliverydate2=new java.sql.Date(0,0,0);
         ExcelEle.setExpt_Shp_Date(deliverydate2);
         else
         ExcelEle.setExpt_Shp_Date(StockEle.getExpt_Shp_Date());
         ExcelEle.setVendor_Material(StockEle.getVendor_Material());
         ExcelNode.addElement(ExcelEle);
         if(ExcelNode.size()>0)
         wdThis.wdGetCO_POPendingController().downloadData(wdContext.nodePoDetails_ExcelData());// This is for Downalod data Method
         wdThis.wdGetCO_POPendingController().DownLoadToExcel();// This is for Open Popup Window
         wdContext.nodePoDetails_ExcelData().invalidate();
         else
         wdComponentAPI.getMessageManager().reportException("Please select any one po item from the table",true);
        //@@end
    Regards
    Vijay
    Edited by: KalluriVijay on May 18, 2010 10:05 AM

  • How to download output into Excel with Header?

    Dear Friends,
        I want to download a my list output into excel format with <b>Column heading</b>. How will I do this?
        Another question is i want name of database table in Which SAP stores <b>DDIC object name and its property</b>, so that i can write Select * from ' ' where .... For example i have table ZABC with three fields so i need In which table it stores ZABC as table and a table in which it stores Its field name.

    Hi,
    Look at the sample code for Download into Excel.
    data: begin of excel_sum_it occurs 0,
          bukrs(80),
          belnr(80),
          gjahr(80),
          blart(80),
          budat like bkpf-budat,
          monat(80),
          cpudt like bkpf-cpudt,
          cputm like bkpf-cputm,
          usnam(80),
          tcode(80),
          xblnr(80),
          waers(80),
          dwrbtr(25),
          cwrbtr(25),
          end of excel_sum_it.
    data: begin of titles_it occurs 10,
          title(80),
    end of titles_it.
    at user-command.
      case sy-ucomm.
        when 'SUMMARY'.
          perform summary_download.
        when 'DETAIL'.
          perform detail_download.
        when others.
      endcase.
    ******Create one PF-STATUS for one push button for download.
    Before this FM you need to move your date to Execl_sum_it Internal table.
    For example here I used this table for down load.
    *&      Form  summary_download
          text
    -->  p1        text
    <--  p2        text
    form summary_download.
      data: fname like rlgrap-filename value 'Summary_Details.xls'.
      perform fill_titles.
      check not excel_sum_it[] is initial.
      call function 'DOWNLOAD'
           exporting
                filename                = fname
                filetype                = 'DAT'
           tables
                data_tab                = excel_sum_it
                fieldnames              = titles_it
           exceptions
                invalid_filesize        = 1
                invalid_table_width     = 2
                invalid_type            = 3
                no_batch                = 4
                unknown_error           = 5
                gui_refuse_filetransfer = 6
                customer_error          = 7
                others                  = 8.
      if sy-subrc ne 0.
        message e000 with text-e07.
      endif.
    endform.                    " summary_download
    *&      Form  fill_titles
          text
    -->  p1        text
    <--  p2        text
    form fill_titles.
      refresh titles_it.
      concatenate text-h06 text-h16 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h07 text-h17 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h08 text-h18 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h07 text-h19 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h09 text-h20 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h08 text-h21 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h11 text-h22 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h11 text-h23 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h12 text-h24  into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h13 text-h25 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h07 text-h26 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h13 text-h28  into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h14 text-h27 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h15 text-h27 into titles_it-title
                                          separated by space.
      append titles_it.
    endform.                    " fill_titles
    ***Here in the FILL_TITLES you give you own HEADER .
    Thanks.
    If this helps you reward with points.

  • How to extract data into excel file from more than one internal table

    Hi Guys
                 I want to extract the data from module pool screen.
                 In screen there are two internal tables
                      1. header
                      2. items.
                 I want to extract the data as same format looking in the screen.
                 With simple Download FM we cannot do this one, because in this we   will display as continuous rows.
    <b> But my requirement is saving as table with heading, date, header details</b>
    Note that it is not the simple down load . Suggest me with example  coding

    Hi Guys,
      I think it depends on which software you will use to see the result.
      If U are using Excel, it's very easy to achieve it.
      1. Define a structure as string, the lenth depend on your need.And use the structure to define a internal table, supposed is as A..
      2. Concatenate the head data using some separator, for ex. a comma; and then add this into A.
      3. The above step's concatenate is depend on your format for request;For ex, you want to place the date at the 4th cell in excel, that means you should put three separator before the date field.
      4 Concatenate the item data into the download table.
      5. Download the table to file.
      6. Display the file, using your defined separator.
    Hope this helpful.
    Bob

  • Regarding downloading data into excel from internal table

    hi all ,
    i'm using the function module  SAP_CONVERT_TO_XLS_FORMAT to download data of internal table into excel . now i need to know . when user presses the button for downlading it should download after downloading if he again tries to download it in the same  should not allow him to download or  it should refresh the excel of the speecific path and then it should downlaod . please let me know how  make it.

    Hi,
    Use below FM
    call function 'MS_EXCEL_OLE_STANDARD_DAT'
    exporting
    file_name = p_file " path offile where u need to download
    CREATE_PIVOT = 0
    DATA_SHEET_NAME = ' '
    PIVOT_SHEET_NAME = ' '
    PASSWORD = ' '
    PASSWORD_OPTION = 0
    tables
    PIVOT_FIELD_TAB =
    data_tab = <dyn_table>  "internal table with data
    *fieldnames = int_head "internal table with header
    exceptions
    file_not_exist = 1
    filename_expected = 2
    communication_error = 3
    ole_object_method_error = 4
    ole_object_property_error = 5
    invalid_filename = 6
    invalid_pivot_fields = 7
    download_problem = 8
    others = 9
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Regards,
    Prashant

  • How to Download data into Chunks?

    Hi Guys,
                 Can anybody tell me How to download the data into chunks for ex consider BSEG table for this table ?how can we download the data into chunks from SAP Database?
                Can anybody tell me how to use Open Cursor and what is meant by Open Cursor?
    Thanks,
    Gopi.

    Hi Gopi,
    The only change that you have to do is vary the PACKAGE SIZE according to your need. Instead of 300,000 which is set right now, give the PACKAGE SIZE as 1,000,000. But that all depends upon your requirement.
    Now, I think your limit is 350,000. If that is the case, then give PACKAGE SIZE 350,000 and instead of writing open dataset outside SELECT, put in before ENDSELECT.
    i.e.
    DATA : it_bseg    TYPE TABLE OF bseg,
           v_size     TYPE i VALUE '350000',
           v_filename TYPE string VALUE give application server path + file name.
    SELECT *
      FROM bseg
      INTO TABLE it_bseg PACKAGE SIZE v_size
      WHERE condition.
    IF it_bseg[] IS NOT INITIAL.
      OPEN DATASET v_filename FOR APPENDING IN TEXT MODE ENCODING DEFAULT.
      SORT IT_BSEG BY BELNR.
      LOOP AT it_bseg INTO x_bseg
        TRANSFER x_bseg TO  v_filename.
      ENDLOOP.
      CLOSE DATASET v_filename.
    ENDIF.
    ENDSELECT.
    Reward points if the answer is helpful.
    Thankx,
    Mukul

  • How to download report into excel using button?

    Hello Friends,
    I am creating one simple classical report.
    Now, I put one "Download" button on the report output screen.
    I want to do is....
    When I press this download button, One pop-up should be called and should ask for where to download on local PC.and downloaded file should be in excel.
    How to do this?
    Regards,
    RH

    hi..
    First explain that, we hav a standard functionality in ALV to download into EXCEL to your FUNCTIONAL CONSULTANT or to your CTM. It is our duty to explain the technical functionality and make use of it wisely. There's nothing wrong in expressing your thoughts regarding requirement. And dont blindly accept requirements and try to interact with FC about it. To me, using a button to download to excel in ALV report is not wise.
    regards,
    Padma

Maybe you are looking for