Excel Download-Background

Hi,
Is it possible to download the data in the internal table into an excel sheet when the report is executed in the background.
Thanks,
K.Kiran.

However,i can give you another way to download data in background,at last the file will be sent as an email
attachment.
Step1: get the data into an internal table
Step2: If running in batch, get from spool
data: l_requestid  like tsp01-rqident,
          t_attachment  like solisti1   occurs 0 with header line.
if sy-batch eq 'X'.
    new-page.
    commit work.
    move sy-spono to l_requestid.
    call function 'RSPO_RETURN_SPOOLJOB'
      exporting
        rqident              = l_requestid
      tables
        buffer               = t_attachment
      exceptions
        no_such_job          = 1
        job_contains_no_data = 2
        selection_empty      = 3
        no_permission        = 4
        can_not_access       = 5
        read_error           = 6
        type_no_match        = 7
        others               = 8.
    if sy-subrc ne 0.
      message 'Spool request not found' type 'E'.        
    endif.
Step3: * Set up email message content
Set up packing list
Set up mail document attributes
data: t_packlist    like sopcklsti1 occurs 2 with header line,
      t_attachment  like solisti1   occurs 0 with header line,
      t_textmsg       like solisti1   occurs 0 with header line,
      t_receivers     like somlreci1  occurs 8 with header line,
      g_docdata      like sodocchgi1.
Step4: * Send data to a Mail Inbox
  call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    exporting
      document_data              = g_docdata
      commit_work                = 'X'
    tables
      packing_list               = t_packlist
      contents_bin               = t_attachment
      contents_txt               = t_textmsg
      receivers                  = t_receivers
    exceptions
      too_many_receivers         = 1
      document_not_sent          = 2
      document_type_not_exist    = 3
      operation_no_authorization = 4
      parameter_error            = 5
      x_error                    = 6
      enqueue_error              = 7
      others                     = 8.
  if sy-subrc eq 0.
  else.
  endif.

Similar Messages

  • How to download background color of ALV with button "Export to Excel"

    Dear Experts:
    I can download the data of ALV in webdynpro for ABAP, but the color is missing.
    Does anybody know how to download background color of the ALV cells also by "Export to Excel" button?
    Could anybody help on this?
    Thanks in advance!
    Best Regards
    Lingxing Meng

    never experienced that...
    [chk this link|Download colored ALV output in to EXCEL sheet;
    a couple of intersting posts, they talk abt general ALV...
    try one of the last post ...when downloading
    use local file->HTML only.. but while choosing the file location to save give extension as XLS.

  • 'REUSE_ALV_GRID_DISPLAY' Excel-download without dialog

    Hi everybody,
    we have a couple of reports displayed in dialog mode by using FM 'REUSE_ALV_GRID_DISPLAY'.
    Now the question arose if there might be a possibility to perform an Excel-download NOT by pressing the dialog function button but instead with parameters such as path and filename given by the calling program, without any user-interaction, maybe even without having the report started in dialog but in batch/background mode instead. I don't see a solution to this. Does anybody else?
    regards
    Andreas

    basically what you are saying is that as soon as the user executes the program, the output also should get downloaded to a predefined location in the user PC, without any further user interaction.
    Right? if yes
    you have the data in an itab (which is passed to T_OUTTAB tables parameter)
    in the PBO (immediately after filling the itab with data before calling the function 'REUSE_ALV_GRID_DISPLAY'
    call gui_download and pass filename, and the itab.
    but you have to make sure thru a check to see this download happens only once during a session.
    and this wont work in batchmode.
    REgards
    Raja

  • Reagrding Excel download

    Hi,
    I have a query reagrding Excel download. Is it possible to download an Excel from SAP GUI in background using GUI_DOWNLOAD/WS_DOWNLOAD/DOWNLOAD?.
    Please let me know any alternatives for my situation.
    Thanks in advance
    Ravi.

    hi,
    <b>reward if useful</b>
    <b>GUI_* and WS_* function modules do not work in background</b>
    When scheduling a job in the background the appropriate statement to read in your file is OPEN DATASET, and the file must be on the file system that the SAP server can see.
    At anytime, a user can switch of the Personal Computers even though the job is still running in the background.  Therefore GUI_* and WS_* function modules are not designed to work in that way, as they need to access your personal computer  file.
    Download in Background in Excel Format
    How to download the data in excel format directly while executing in background mode? 
    If you will execute it in bacground with ws_download or download, it will be aoutomatically cancel. so what is the procedure to do this.  How is can directly read the spool from program?
    <b>Download from background is possible, if you could setup the environment</b>
    1. create a custom table first
        Table  : Y001
        Displayed fields:   4 of   4  Fixed columns:
           MANDT BNAME       Y_SITE    Y_PATH
           010      <userid>     <site>      cd <novell_path>
    2. rewrite ws_download to z_download (light modification required, see attachment)
    3. ask your basis team to make a copy of command FTP and CHMOD to ZFTP and ZCHMOD resp., make the setting according to your environment.
        1  *----
        2  * Changed By :
        3  * Changed On :
        4  * Changed    : NOVELL directory path based on SAP login id.
        5  *----
        6  TABLES: Y001.                                           
        7
        8  CONSTANTS: C_PATH(14) VALUE '/home/ftpuser/'.
        9
       10  DATA: BEGIN OF C_TAB,
       11          X(1) TYPE X VALUE '09',
       12        END OF C_TAB.
       13
       14  DATA: BUFFER(8000),
       15        FIELDNAME_OFFSET TYPE I,
       16  *     FULLPATH(128),
       17        FULLPATH LIKE SXPGCOLIST-PARAMETERS,
       18  *     CMDFULLPATH(128),
       19        CMDFULLPATH LIKE SXPGCOLIST-PARAMETERS,
       20        CMD(40),
       21        IBTCXPM LIKE BTCXPM OCCURS 0.
       22
       23  FUNCTION Z_DOWNLOAD.
       24  *"----
       25  ""Local interface:
       26  *"  IMPORTING
       27  *"     VALUE(FILENAME)
       28  *"     VALUE(LOCATION)
       29  *"  TABLES
       30  *"      DATA_TAB
       31  *"      FIELDNAMES OPTIONAL
       32  *"----
       33
       34    DATA: WS_LINE TYPE I.
       35
       36    FIELD-SYMBOLS: <F>.
       37
       38    CHECK NOT FILENAME IS INITIAL.
       39
       40    CONCATENATE C_PATH FILENAME INTO FULLPATH.
       41    OPEN DATASET FULLPATH IN TEXT MODE FOR OUTPUT.
       42
       43    DESCRIBE TABLE FIELDNAMES LINES WS_LINE.
       44    IF WS_LINE NE 0.
       45      PERFORM FIELDNAMES_2_BUFFER TABLES FIELDNAMES CHANGING BUFFER.
       46      FIELDNAME_OFFSET = STRLEN( BUFFER ).
       47      TRANSFER BUFFER TO FULLPATH LENGTH FIELDNAME_OFFSET.
       48    ENDIF.
       49
       50    LOOP AT DATA_TAB.
       51      CLEAR BUFFER.
       52      CLEAR FIELDNAME_OFFSET.
       53      DO.
       54        ASSIGN COMPONENT SY-INDEX OF STRUCTURE DATA_TAB TO <F>.
       55        IF SY-SUBRC NE 0.  EXIT.  ENDIF.
       56        WRITE <F> TO BUFFER+FIELDNAME_OFFSET.
       57        CONDENSE BUFFER.
       58        FIELDNAME_OFFSET = STRLEN( BUFFER ).
       59        WRITE C_TAB TO BUFFER+FIELDNAME_OFFSET(1).
       60        ADD 1 TO FIELDNAME_OFFSET.
       61      ENDDO.
       62      TRANSFER BUFFER TO FULLPATH LENGTH FIELDNAME_OFFSET.
       63    ENDLOOP.
       64
       65    CLOSE DATASET FULLPATH.
       66
       67    CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
       68         EXPORTING
       69              COMMANDNAME                   = 'ZCHMOD'
       70              ADDITIONAL_PARAMETERS         = FULLPATH
       71         TABLES
       72              EXEC_PROTOCOL                 = IBTCXPM
       73         EXCEPTIONS
       74              NO_PERMISSION                 = 1
       75              COMMAND_NOT_FOUND             = 2
       76              PARAMETERS_TOO_LONG           = 3
       77              SECURITY_RISK                 = 4
       78              WRONG_CHECK_CALL_INTERFACE    = 5
       79              PROGRAM_START_ERROR           = 6
       80              PROGRAM_TERMINATION_ERROR     = 7
       81              X_ERROR                       = 8
       82              PARAMETER_EXPECTED            = 9
       83              TOO_MANY_PARAMETERS           = 10
       84              ILLEGAL_COMMAND               = 11
       85              WRONG_ASYNCHRONOUS_PARAMETERS = 12
       86              CANT_ENQ_TBTCO_ENTRY          = 13
       87              JOBCOUNT_GENERATION_ERROR     = 14
       88              OTHERS                        = 15.
       89
       90    CONCATENATE C_PATH FILENAME '_cmd' INTO CMDFULLPATH.
       91    OPEN DATASET CMDFULLPATH IN TEXT MODE FOR OUTPUT.
       92    CASE LOCATION.     "location A, B, C, D on a network
       93      WHEN 'A  '.
       94 
       95        TRANSFER 'open xx.xxx.xx.xx' TO CMDFULLPATH.        
       96        TRANSFER 'user sapftp <pwd>' TO CMDFULLPATH.      
       97      WHEN 'B  '.                                           
       98        TRANSFER 'open xx.xxx.xx.xx' TO CMDFULLPATH.        
       99        TRANSFER 'user sapftp <pwd>' TO CMDFULLPATH.    
      100      when 'C  '.
      101        TRANSFER 'open xx.xxx.xx.xx' TO CMDFULLPATH.
      102        TRANSFER 'user sapftp <pwd>' TO CMDFULLPATH.
      103      when 'D  '.
      104        TRANSFER 'open xx.xxx.xx.xx' TO CMDFULLPATH.
      105        TRANSFER 'user sapftp <pwd>' TO CMDFULLPATH.
      106      WHEN OTHERS.
      107    ENDCASE.
      108
      109
      110
      111
      112  *start>
      113    CLEAR Y001.
      114    SELECT SINGLE Y_PATH INTO Y001-Y_PATH
      115                         FROM Y001 WHERE BNAME = SY-UNAME
      116                                     AND Y_SITE = LOCATION.  
      117    TRANSFER Y001-Y_PATH TO CMDFULLPATH.
      118  *<end
      119    CONCATENATE 'lcd' C_PATH INTO CMD SEPARATED BY SPACE.
      120    TRANSFER CMD TO CMDFULLPATH.
      121    CLEAR CMD.
      122    CONCATENATE 'put' FILENAME INTO CMD SEPARATED BY SPACE.
      123    TRANSFER CMD TO CMDFULLPATH.
      124    TRANSFER 'bye' TO CMDFULLPATH.
      125    CLOSE DATASET CMDFULLPATH.
      126
      127    CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
      128         EXPORTING
      129              COMMANDNAME                   = 'ZCHMOD'
      130              ADDITIONAL_PARAMETERS         = CMDFULLPATH
      131         TABLES
      132              EXEC_PROTOCOL                 = IBTCXPM
      133         EXCEPTIONS
      134              NO_PERMISSION                 = 1
      135              COMMAND_NOT_FOUND             = 2
      136              PARAMETERS_TOO_LONG           = 3
      137              SECURITY_RISK                 = 4
      138              WRONG_CHECK_CALL_INTERFACE    = 5
      139              PROGRAM_START_ERROR           = 6
      140              PROGRAM_TERMINATION_ERROR     = 7
      141              X_ERROR                       = 8
      142              PARAMETER_EXPECTED            = 9
      143              TOO_MANY_PARAMETERS           = 10
      144              ILLEGAL_COMMAND               = 11
      145              WRONG_ASYNCHRONOUS_PARAMETERS = 12
      146              CANT_ENQ_TBTCO_ENTRY          = 13
      147              JOBCOUNT_GENERATION_ERROR     = 14
      148              OTHERS                        = 15.
      149
      150    CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
      151         EXPORTING
      152              COMMANDNAME                   = 'ZFTP'
      153  **          commandname                   = 'ZFTP'
      154              ADDITIONAL_PARAMETERS         = CMDFULLPATH
      155         TABLES
      156              EXEC_PROTOCOL                 = IBTCXPM
      157         EXCEPTIONS
      158              NO_PERMISSION                 = 1
      159              COMMAND_NOT_FOUND             = 2
      160              PARAMETERS_TOO_LONG           = 3
      161              SECURITY_RISK                 = 4
      162              WRONG_CHECK_CALL_INTERFACE    = 5
      163              PROGRAM_START_ERROR           = 6
      164              PROGRAM_TERMINATION_ERROR     = 7
      165              X_ERROR                       = 8
      166              PARAMETER_EXPECTED            = 9
      167              TOO_MANY_PARAMETERS           = 10
      168              ILLEGAL_COMMAND               = 11
      169              WRONG_ASYNCHRONOUS_PARAMETERS = 12
      170              CANT_ENQ_TBTCO_ENTRY          = 13
      171              JOBCOUNT_GENERATION_ERROR     = 14
      172              OTHERS                        = 15.
      173
      174  ENDFUNCTION.
      175
      176  ----
      177  *       FORM FIELDNAMES_2_BUFFER                                      *
      178  ----
      179  *       ........                                                      *
      180  ----
      181  *  -->  FIELDNAMES                                                    *
      182  *  -->  BUFFER                                                        *
      183  ----
      184  FORM FIELDNAMES_2_BUFFER TABLES FIELDNAMES CHANGING BUFFER.
      185    CLEAR BUFFER.
      186    CLEAR FIELDNAME_OFFSET.
      187    LOOP AT FIELDNAMES.
      188      WRITE FIELDNAMES TO BUFFER+FIELDNAME_OFFSET.
      189      CONDENSE BUFFER.
      190      FIELDNAME_OFFSET = STRLEN( BUFFER ).
      191      WRITE C_TAB TO BUFFER+FIELDNAME_OFFSET(1).
      192      ADD 1 TO FIELDNAME_OFFSET.
      193    ENDLOOP.
      194    FIELDNAME_OFFSET = FIELDNAME_OFFSET - 1.
      195    IF FIELDNAME_OFFSET >= 0.
      196      WRITE SPACE TO BUFFER+FIELDNAME_OFFSET(1).
      197    ENDIF.
      198  ENDFORM.
    Message was edited by: Ashok Kumar Prithiviraj

  • Excel Download of a Web SAP BW Report asks userid and password.please help

    Dear BW folks,
    Issue: When I run a specific SAP BW Report from Web and download the same into excel & csv.
    When I open the excel file downloaded, it asks me user name and password to enter. csv file downloaded doesn't ask.
    The report has 0cust_sales hierarchy and SBU hierarchy.
    Is there any thing to do with these hierarchies that the excel download is asking user name and password?
    Please help me out!!!!! This report needs to be downloaded into excel sent to my manager.....
    Regards
    Pavan

    Hi Pavan
    It is possible,please refer the below link
    Report execution without prompting user id
    Providing un-secured access to a web report.
    Also, for the time being, you can run the query and save a workbook and sent across
    These will resolve the issue
    Thanks
    Pavan Agarwal

  • Problem in ALV to Excel Download

    Good Morning Experts,
      I am facing one issue related ALV to excel Download.
    I Developed one custom report the output is correct displaying.
    the output is like for example i am taking 3 columns (plant, material, amt).
    plant material amt
    1001  aaa     1000
    1001  bbb     2000
    while downloading to excel
    it displaying like
    plant
    material
    amt
    1001
    aaa
    1000
    1001
    bbb
    2000
    I dont know why its coming like that.
    this is my code
    DEFINE field_cat.
    wa_field-row_pos = &1.
    wa_field-fieldname = &2.
    wa_field-tabname = &3.
    wa_field-seltext_m = &4.
    wa_field-outputlen = &5.
    wa_field-currency = &6.
    wa_field-ref_fieldname = &7.
    wa_field-ref_tabname = &8.
    APPEND wa_field to it_field.
    clear wa_field.
    END-OF-DEFINITION.
    field_cat '1' 'BUKRS' 'IT_FINAL' 'Company Code' '6' '' '' ''.
    field_cat '2' 'BUTXT' 'IT_FINAL' 'Comp Descrip' '25' '' '' ''.
    field_cat '3' 'LIFNR' 'IT_FINAL' 'Vendor No' '10' '' '' ''.
    field_cat '4' 'NAME1' 'IT_FINAL' 'Vendor Name' '35' '' '' ''.
    field_cat '5' 'STRAS' 'IT_FINAL' 'Vendor Addres' '35' '' '' ''.
    field_cat '6' 'FDGRV' 'IT_FINAL' 'Nature Of Work' '30' '' '' ''.
    field_cat '7' 'DMBTR' 'IT_FINAL' 'Net Amount' '16' 'X' 'WAERS' 'IT_FINAL'.
    field_cat '8' 'QBSHB' 'IT_FINAL' 'TDS Amount' '16' 'X' 'WAERS' 'IT_FINAL'.
    field_cat '9' 'TOTAL' 'IT_FINAL' 'Total Amount' '16' 'X' 'WAERS' 'IT_FINAL'.
    it_layout-zebra = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = sy-repid
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
       IS_LAYOUT                         = it_layout
       IT_FIELDCAT                       = it_field
       I_SAVE                            = 'X'
      TABLES
        t_outtab                          = it_final
    EXCEPTIONS
       PROGRAM_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.
    endform.                    " DISPLAY_ALV
    FORM TOP_OF_PAGE.
    REFRESH it_head. CLEAR it_head.
    wa_head-typ = 'H'.
    wa_head-info = 'Vendorwise Expense Details'.
    APPEND wa_head to it_head.
    wa_head-typ = 'S'.
    IF NOT s_MONAT-high is INITIAL.
      CONCATENATE 'Period : ' p_gjahr '.' s_MONAT-low ' to ' p_gjahr '.' s_MONAT-high INTO wa_head-info.
    ELSE.
      CONCATENATE 'Period : ' p_gjahr '.' s_MONAT-low INTO wa_head-info.
    ENDIF.
    APPEND wa_head to it_head.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        it_list_commentary       = it_head.
    ENDFORM.
    Regards,
    Dhina..

    Hi,
    You can also try in this way
    in the output screen
      click List (in app tool bar) -> Export -> Spreadsheet
    and save at your desired location.
    (It will be save in .mhtml format , just rightclick on it and you can open it with excel )
    Then you will be able to view in your required format.
    Regards,
    koolspy.

  • Excel download feature in Web Dynpro Abap using OAOR document

    Hi Friends,
    I am facing an issue in implementing excel download feature in Web Dynpro.
    Problem: I have stored an excel document in OAOR. I am displaying data on screen using ALV display in WDA.
    I will provide a button to download excel in toolbar of ALV. When user clicks on this button i need to pick the document from OAOR and fill that with my screen values and download it to users desktop.
    Please help me in this. Problem is when i am calling these classes c_oi_container_control_creator=>get_container_control and cl_gui_custom_container from my View's method they are returning error.
    Thanks & Regards,
    Saud

    HI,
    You cannot use GUI classes and methods in web dynpro . That will dump.
    Instead you can use file down load UI element or..
    If you have the content in xstring format use ATTACH_FILE_TO_RESPONSE method of CL_WD_RUNTIME_SERVICES class.
    Regards,
    Madhu

  • Dump while running a program with OLE Excel download facility in ITS

    Hi,
    Because of some complex requirment, I had created a report program which will download the data to an Excel sheet using SAP OLE Automation Controller. For this report i had created a tcode too.
    The report which i developed is perfectly working fine in SAPGUI. But if i access the same report throught SAP ITS serice. I am getting a dump. Please find below the dump details. I am not able to figure it out why the dump is not coming in SAPGUI.
    Runtime Errors         MESSAGE_TYPE_X
    Date and Time          09.03.2010 05:35:41
    Short text
    The current application triggered a termination with a short dump.
    What happened?
    The current application program detected a situation which really
    should not occur. Therefore, a termination with a short dump was
    triggered on purpose by the key word MESSAGE (type X).
    |
    Error analysis
    Short text of error message:
    Control Framework : Error processing control
    Long text of error message:
    Diagnosis
    An error occurred when the system tried to process the commands
    from the Automation Queue on the presentation server.
    There are several possible reasons for this:
    - The installation of the SAP GUI on the presentation server is
    faulty or obsolete.
    - There is an error in the application program
    - There is an error in the SAPGUI or an integrated control
    Procedure
    1. Make sure that you have imported the appropriate Support
    Package, the current kernel, and GUI patch for the release of your
    system
    2. Check whether the error occurs locally on one or a few PCs, or
    generally on all PCs. Note whether the error only occurs for some
    users, for example because of a specific Customizing setting.
    If it only occurs locally, this suggests an installation problem
    with the PC. Check the installation; if necessary, reinstall the
    software. In the dump, search for the SY-MSGLI field, since it may
    point to the cause of the error.
    3. Activate the Automation Trace (in accordance with SAP Note
    158985).
    4.Start the transaction and continue until the screen immediately
    before the dump.
    5. From the System -> Utilities menu, choose Autom. Queue,
    Synchronous Processing.
    The status bar of the GUI displays the text:
    "Automation synchron flush mode on"
    6. If you now proceed with the application, the short dump will
    display the ABAP call that caused the error; the Automation Trace
    will contain the error on the presentation server.
    7. If necessary, load the short dump and trace files on to
    sapservX, so that SAP can analyze them.
    Technical information about the message:
    Message class....... "CNDP"
    Number.............. 006
    Variable 1.......... " "
    Variable 2.......... " "
    Variable 3.......... " "
    Variable 4.......... " "
    How to correct the error
    Probably the only way to eliminate the error is to correct the program.
    If the error occures in a non-modified SAP program, you may be able to
    find an interim solution in an SAP Note.
    If you have access to SAP Notes, carry out a search with the following
    keywords:
    "MESSAGE_TYPE_X" " "
    "SAPLOLEA" or "LOLEAU02"
    "AC_SYSTEM_FLUSH"
    If you cannot solve the problem yourself and want to send an error
    notification to SAP, include the following information:
    1. The description of the current problem (short dump)
    To save the description, choose "System->List->Save->Local File
    (Unconverted)".
    2. Corresponding system log
    Display the system log by calling transaction SM21.
    Restrict the time interval to 10 minutes before and five minutes
    after the short dump. Then choose "System->List->Save->Local File
    (Unconverted)".
    3. If the problem occurs in a problem of your own or a modified SAP
    program: The source code of the program
    In the editor, choose "Utilities->More
    Utilities->Upload/Download->Download".
    4. Details about the conditions under which the error occurred or which
    actions and input led to the error.
    User and Transaction
    Client.............. 120
    User................ "XXXXXX"
    Language Key........ "E"
    Transaction......... "ZGA_BEACON_SOX_RPT "
    Transactions ID..... "4B95E2560EB62F9AE10000000A241C33"
    Program............. "SAPLOLEA"
    Screen.............. "ZGA_REP_BEACON_SOX_REPORT 9000"
    Screen Line......... 0
    Information on Caller ofr "HTTP" Connection:
    Plug-in Type.......... "HTTP"
    Caller IP............. "10.36.28.52"
    Caller Port........... 8000
    Universal Resource Id. "/sap/bc/gui/sap/its/webgui/~flNUQVRFPTIzNzIxLjAxNC4wNC4
    wNA=="

    Hi All,
    FYI.....
    As I said because of my complex requirement, i am using OLE excel download facilities to download the data. ITS wont support this OLE download facility.  This can be done only through local SAP GUI.
    The reason for this is that, when i am using this download facility through SAP GUI, OLE object thats used in my report program will directly talk to the Local OLE excel objects (i.e. the local installed Excell application) and download the data. But if it's through ITS, my program wont be able to communicate with the local excel OLE objects because of this i am getting a DUMP.
    Thank You all for the support. All the best in future. 
    Regards
    Maneesh Chandran

  • Excel download from ALV grid, for characters more than 1020

    Hi,
    When i am trying to download the report which is having character more than 1020, it is coming in two rows. I want all fields in one row. Please give solutions.
    I am using below field catalog.
    Car Eligibility
      CLEAR lw_fieldcat.
      lw_fieldcat-fieldname = text-001.
      lw_fieldcat-reptext_ddic = text-011.
      lw_fieldcat-tabname = text-021
      APPEND lw_fieldcat TO gt_fieldcat.
    I am using below FM.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = sy-repid
          is_layout          = gt_layout
          it_fieldcat        = gt_fieldcat[]
          it_sort            = gt_sort[]
          it_events          = gt_events[]
        TABLES
          t_outtab           = gt_data
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
    Thanks in Advance,
    Ravi Kumar

    ravi,
    its not about how you have used your field catalog or how you called ALV FM. its excel download functionality,
    what you need to do is:
    set pf-status '<<some value>>' -> you can find where to pass in ALV FM call.
    then add a application toolbar button though this pf status.
    then at  use_command event, check sy-ucomm and if its the same as your new icons fcode then use the method to download it in excel.

  • Excel download not working in REUSE_ALV_GRID_DISPLAY

    hi,
    can someone tell me why excel download funtionality doesnt work in grid display. i tried examples like balvst0*_grid and it seems those doesnt work too.
    is there any example where i can see excel download working with grid.
    regards,
    ravi.

    Hi,
    Also check this program for FM REUSE_ALV_GRID_DISPLAY..You can use LIST -> EXPORT -> SPREADSHEET to see the values in a excel..
    TYPE-POOLS: slis.
    DATA: BEGIN OF itab OCCURS 0,
            vbeln TYPE vbeln,
          END OF itab.
    DATA: BEGIN OF itab1 OCCURS 0,
            selkz TYPE char1,
            vbeln TYPE vbeln,
            posnr TYPE posnr,
            netpr TYPE netpr,
            matnr TYPE matnr,
          END OF itab1.
    DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
    DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    s_fieldcatalog-col_pos = '1'.
    s_fieldcatalog-fieldname = 'SELKZ'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-checkbox  = 'X'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: S_FIELDCATALOG.
    s_fieldcatalog-col_pos = '2'.
    s_fieldcatalog-fieldname = 'VBELN'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'VBELN'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    s_fieldcatalog-col_pos = '3'.
    s_fieldcatalog-fieldname = 'POSNR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'POSNR'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '4'.
    s_fieldcatalog-fieldname = 'NETPR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'NETPR'.
    s_fieldcatalog-do_sum    = 'X'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '5'.
    s_fieldcatalog-fieldname = 'MATNR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'MATNR'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    DATA: s_layout TYPE slis_layout_alv.
    s_layout-subtotals_text            = 'SUBTOTAL TEXT'.
    SELECT vbeln UP TO 10 ROWS
           FROM
           vbak
           INTO TABLE itab.
    IF NOT itab[] IS INITIAL.
      SELECT vbeln posnr
             FROM vbep
             INTO CORRESPONDING FIELDS OF TABLE itab1
             FOR ALL ENTRIES IN itab
             WHERE vbeln = itab-vbeln.
    ENDIF.
    DATA: v_repid TYPE syrepid.
    v_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
              i_callback_program = v_repid
              it_fieldcat        = t_fieldcatalog
              is_layout          = s_layout
         TABLES
              t_outtab           = itab1
         EXCEPTIONS
              program_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.
    Thanks,
    Naren

  • ALV Excel Download problem ( Special Character)

    Hi,
    I am unable to download completely in XLS format from ALV grid. When i tried in couple of ways there is a special character( " ) in one of the filed. Due to the same Excel download has some problem. I tested by removing those and it worked fine, 
    Please suggest me to solve the issue.
    Thanks,
    Bhanu Gattu,

    Data strings with special characters can not be downloaded into XLS format from ALV grid. In my case, I replaced the special character " with space and I could download the data into excel.

  • Excel download truncated characters

    Hi,
    I have a strange problem. I am trying to download an ALV report in a excel format to the work station and the last character of one of the many fields,Vendor Number, gets truncated. Strangely this problem is confined to quality and production environments, and the same excel download works fine in the development environment.
    I have searched for replies in the forum that suggest program corrections but I would like to know how the same report download works correctly in development.

    Hi,
    The issue is due to fieldcatalog not being populated properly and in the Layout - Column width optimize is checked. In this case the contents are display till the heading ( For ex: if the heading is 'Vendor' ) the conents will be displayed with a maximum length of 6 characters instead of 10 with ".."  at the end truncating the output.
    The reason why its working in development and not in Quality or production is that the maximum vendor number in development is less than or equal to 6 digits where as in quality or production its more. Please check.
    Solution: If you are populating the field catalog manuallly, populate the ref_field and ref_table ( For ex: wth 'LIFNR' and 'LFA1' respectively ).
    Edited by: Suman Jagu on May 9, 2011 11:48 AM

  • Excel download from ALV not working inproduction

    Hi all,
    I am using "set_table_for_first_display" for alv display. the excel download from alv is woking fine in development and quality stystem but in production only first 3-4 rows are getting downloaded. Other rows donot appear in excel.
    Any Idea !!!
    Thanks
    Madhu

    Hi Experts,
    I have noticed that same problem is occuring in development system also with same set of data . The ascii file created has some missing rows. I guess its due to some special characters though i am not able to see any special character . Any solution for this.
    Regs
    madhu

  • Excel in background with formating option

    Hi,
      Is it possible to add logo, column width to excel in background. My requirement is to send excel as a attachment.This program run in background where i need to send excel as attachement via mail with logo and column width and demicals formatting etc.
      Is it possible to do this in background with excel. some links r code will help more.
    Regards,
    Karthik

    I read somewhere that simple excel creation and formatting is possible if you use open dataset and create an xml file
    it is a very complex approach and yet you will still not be able to put things such as the logo an column width
    the main reason for not being able to do this is the fact that excel creation is normally done by using Object Linking and Embedding (OLE)
    This works only by having the document open in the foreground and cannot work in the background

  • Repetition of header in ALV output once excel download is selected

    Hi Experts,
    I have alv report where I use FM as below
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program     = w_repid
          i_callback_top_of_page = 'TOP-OF-PAGE'  "see FORM
          is_layout              = l_layout
          it_fieldcat            = lt_fieldcat
          it_sort                = l_sort
          i_save                 = 'X'
        TABLES
          t_outtab               = itab
        EXCEPTIONS
          program_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.
    and top of page as below
    FORM top-of-page.
    * Title
      w_header-typ  = 'H'.
      w_header-info = text-033.
      APPEND w_header TO t_header.
      CLEAR w_header.
    * Report Name
      w_header-typ  = 'S'.
      w_header-key = text-034.
      w_header-info =  sy-repid.
      APPEND w_header TO t_header.
      CLEAR w_header.
    * Date
      w_header-typ  = 'S'.
      w_header-key = text-035.
      CONCATENATE  sy-datum6(2) '.'+
                   sy-datum4(2) '.'+
                   sy-datum(4) INTO w_header-info.
      APPEND w_header TO t_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = t_header.
    ENDFORM.                    "top-of-page
    Its displaying well in output, but when I select excel download, the header is getting printed 4 times in the alv output and in the excel download it is printing twice. Please advise how to keep the header once. Note : I am not using any paging concept, simple header at the top.
    Please advise.
    Regards,
    Kiran.

    Hi kiran,
    While creating top-of-page,
    You have to refresh your header internal table before populating it with data i.e,
    FORM TOP.
    Refresh IT_HEADER                   -->with this the header text will not get repeatedly printed
    WA_HEADER-TYP = 'S'.
    WA_HEADER-KEY = TEXT-001.
    WA_HEADER-INFO = SY-REPID.
    APPEND WA_HEADER TO IT_HEADER.
    CLEAR WA_HEADER.
    WA_HEADER-TYP = 'S'.
    WA_HEADER-KEY = TEXT-002.
    WA_HEADER-INFO = SY-UNAME.
    APPEND WA_HEADER TO IT_HEADER.
    CLEAR WA_HEADER.
    WA_HEADER-TYP = 'S'.
    WA_HEADER-KEY = TEXT-003.
    WA_HEADER-INFO = SY-DATUM.
    APPEND WA_HEADER TO IT_HEADER.
    CLEAR WA_HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        it_list_commentary       = IT_HEADER
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.
    Hope it helps you
    Regards
    Mansi

Maybe you are looking for

  • Itune's & Seagate External Hard Drive

    I just FINALLY figured out how to get my songs on my new laptop. I was able to transfer the songs from my external hard drive to my laptop hard drive. When I disconnect the external hard drive, I am not able to play the songs b/c for some reason its

  • Field that is not visible in my editing screen but showing in web preview. How to remove it?

    Hi Support, When I preview my form in web preview, I am seeing a field that is not visible in my editing screen. It starts at the left margin of the web preview and runs off the edge of the right side of the page. The form is also crashing when I att

  • CSS Themes in ABAP Web Dynpro

    Hi friends, did anybody follow the steps in http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/7015b1f9-535c-2910-c8b7-e681fe75aaf8 successfully  ??? It seems I cannot use the Eclipse Theme Editor to modify the Themes because I am using basis com

  • WiFi - Static IP Address

    I'm trying to use a static IP address on my BlackBerry 9700. I am able to obtain a dynamic IP address but not static one for Wifi. I have unchecked "Automatically obtain IP address and DNS" and I'm using the following: IP Address: xxx Subnet mask: xx

  • Setting System Status for CRM Contract

    Hi I need urgent help for changing the system status in CRMD_ORDER, once the Contract is saved. I tried to use the Function Module CRM_ORDER_MAINTAIN for setting the status. But this FM provides status change on user level. Please guide me how to set