Down Loading ALV Output to Excel Sheet

Hi All,
I am working on Vendor Line Items Report which have both Header details as well as line item details.
So i developed Heirarical ALV to display the output and it is working fine.But my problem is Downloading output to Excel sheet functionality is not working.
In output screen LIST->EXPORT->SPREADSHEET functionality is not working.
Please give me suggestions regarding the same or is there any another way to do the same by using ALV List Display.
Points will be rewarded
Thanks and Regards,
Siva.

hi ,
this is a working example check this...
REPORT  zvenkattest0.
TABLES:pa0002,pa0008.
TYPE-POOLS:slis.
CONSTANTS:c VALUE 'X'.
DATA:BEGIN OF it_pa0008 OCCURS 0,
     pernr LIKE pa0008-pernr,
     begda LIKE pa0008-begda,
     endda LIKE pa0008-endda,
     preas LIKE pa0008-preas,
     ansal LIKE pa0008-ansal,
     lga01 LIKE pa0008-lga01,
     expand TYPE xfeld,
     END OF it_pa0008.
DATA:BEGIN OF it_pa0002 OCCURS 0,
     pernr LIKE pa0002-pernr,
     vorna LIKE pa0002-vorna,
     nachn LIKE pa0002-nachn,
     gbdat LIKE pa0002-gbdat,
     gblnd LIKE pa0002-gblnd,
     sprsl LIKE pa0002-sprsl,
     perid LIKE pa0002-perid,
     END OF it_pa0002.
DATA: wa_field_cat TYPE slis_fieldcat_alv,
      it_field_cat TYPE slis_t_fieldcat_alv,
      wa_keyinfo TYPE slis_keyinfo_alv,
      it_layout TYPE slis_layout_alv.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:s_pernr FOR pa0002-pernr NO INTERVALS.
SELECTION-SCREEN: SKIP.
PARAMETERS:p_expand AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM select_data.
PERFORM build_field_cat.
PERFORM disply_data.
*&      Form  SELECT_DATA
      text
-->  p1        text
<--  p2        text
FORM select_data .
SELECT pernr
       begda
       endda
       preas
       ansal
       lga01
       FROM pa0008
       INTO CORRESPONDING FIELDS OF TABLE it_pa0008
       UP TO 10 ROWS.
IF NOT it_pa0008[] IS INITIAL.
SELECT pernr
       vorna
       nachn
       gbdat
       gblnd
       sprsl
       perid
       FROM pa0002
       INTO CORRESPONDING FIELDS OF TABLE it_pa0002
       FOR ALL ENTRIES IN it_pa0008
       WHERE pernr = it_pa0008-pernr.
ENDIF.
SORT it_pa0008 BY pernr.
ENDFORM.                    " SELECT_DATA
*&      Form  BUILD_FIELD_CAT
      text
-->  p1        text
<--  p2        text
FORM build_field_cat .
    wa_field_cat-tabname = 'PA0008'.
    wa_field_cat-fieldname = 'PERNR'.
    wa_field_cat-seltext_l = 'personnelno'.
    APPEND wa_field_cat TO it_field_cat.
    wa_field_cat-tabname = 'PA0008'.
    wa_field_cat-fieldname = 'BEGDA'.
    wa_field_cat-seltext_l = 'begindate'.
    APPEND wa_field_cat TO it_field_cat.
    wa_field_cat-tabname = 'PA0008'.
    wa_field_cat-fieldname = 'ENDDA'.
    wa_field_cat-seltext_l = 'enddate'.
    APPEND wa_field_cat TO it_field_cat.
    wa_field_cat-tabname = 'PA0008'.
    wa_field_cat-fieldname = 'PREAS'.
    wa_field_cat-seltext_l = 'reason'.
    APPEND wa_field_cat TO it_field_cat.
    wa_field_cat-tabname = 'PA0008'.
    wa_field_cat-fieldname = 'ANSAL'.
    wa_field_cat-seltext_l = 'annualsalary'.
    APPEND wa_field_cat TO it_field_cat.
    wa_field_cat-tabname = 'PA0008'.
    wa_field_cat-fieldname = 'LGA01'.
    wa_field_cat-seltext_l = 'wagetype'.
    APPEND wa_field_cat TO it_field_cat.
    wa_field_cat-tabname = 'PA0002'.
    wa_field_cat-fieldname = 'VORNA'.
    wa_field_cat-seltext_l = 'firstname'.
    APPEND wa_field_cat TO it_field_cat.
    wa_field_cat-tabname = 'PA0002'.
    wa_field_cat-fieldname = 'NACHN'.
    wa_field_cat-seltext_l = 'lastname'.
    APPEND wa_field_cat TO it_field_cat.
    wa_field_cat-tabname = 'PA0002'.
    wa_field_cat-fieldname = 'GBDAT'.
    wa_field_cat-seltext_l = 'birhtdate'.
    APPEND wa_field_cat TO it_field_cat.
    wa_field_cat-tabname = 'PA0002'.
    wa_field_cat-fieldname = 'GBLND'.
    wa_field_cat-seltext_l = 'birthcountry'.
    APPEND wa_field_cat TO it_field_cat.
    wa_field_cat-tabname = 'PA0002'.
    wa_field_cat-fieldname = 'SPRSL'.
    wa_field_cat-seltext_l = 'languageused'.
    APPEND wa_field_cat TO it_field_cat.
    wa_field_cat-tabname = 'PA0002'.
    wa_field_cat-fieldname = 'PERID'.
    wa_field_cat-seltext_l = 'personnelid'.
    APPEND wa_field_cat TO it_field_cat.
ENDFORM.                    " BUILD_FIELD_CAT
*&      Form  DISPLY_DATA
      text
-->  p1        text
<--  p2        text
FORM disply_data .
  it_layout-group_change_edit = c.
  it_layout-colwidth_optimize = c.
  it_layout-zebra             = c.
  it_layout-detail_popup      = c.
  it_layout-get_selinfos      = c.
  IF p_expand = c.
  it_layout-expand_fieldname  = 'EXPAND'.
  ENDIF.
  wa_keyinfo-header01 = 'PERNR'.
  wa_keyinfo-item01 = 'PERNR'.
wa_keyinfo-item02 = 'SUBTY'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
    EXPORTING
      i_callback_program      = sy-cprog
      is_layout               = it_layout
      it_fieldcat             = it_field_cat
      i_tabname_header        = 'PA0008'
      i_tabname_item          = 'PA0002'
      is_keyinfo              = wa_keyinfo
    TABLES
      t_outtab_header         = it_pa0008
      t_outtab_item           = it_pa0002.
ENDFORM.                    " DISPLY_DATA
regards,
venkat.

Similar Messages

  • Problem in down loading Grid out to Excel

    Hi all ,
    when i down load grid output into excel using list->export->localfile ->spread sheet,
    Some columns headings are down loaded with medium texts and some with short texts (seltext_s) .The same is displayed in default output(with out dragging) .  I found that fields with short texts are because of field  data length is less than 10 char .customer is asking to  medium or long texts in excel when down loaded..
    1)Hence i expanded fileds and then down loaded , same short texts are down loaded to XL.
    2)I incresed output length for those  fields so as to take medium or long texts in default output of report(no need of dragging ) and then  down loaded to excel .Still it is taking short texts only in XL .
    Will there be any default settings to consider text to considered while down loading or do ineed to set explicitley .Please advise me ..
    a bit urgent .
    I constructed fieldcat  as follows
    ls_fieldcat-fieldname    = c_cname.
      ls_fieldcat-seltext_l    = text-004.
      ls_fieldcat-seltext_s    = text-004.
      ls_fieldcat-seltext_m    = text-004.
      ls_fieldcat-reptext_ddic = text-004.
      MODIFY p_fieldcat FROM ls_fieldcat TRANSPORTING seltext_l seltext_m
    seltext_s reptext_ddic WHERE fieldname = ls_fieldcat-fieldname.
    Many Thanks
    Dharma P

    Hi  A. Caglar Ozkor,
    Basically the parmeter layout-colwidth optimization  is set to  'X'. I tried out to increase outputlength after setting it to '   '  , then down loaded to excel .In that case also it picked only short texts , Hence I thought there would be  some settings  to decide what text to be picked while down loading  in to excel .
    Guys , Any ideas to solve this problem   ...
    Dharma P

  • Download ALV output to EXCEL

    Hi gurus,
       Cany anybody explain what is the procedure to download the alv output to EXCEL sheet?
    Marks will be awarded
    Thanks in Advance
    Ravi

    Hi
    when display the ALV . select from PF-STATUS menu bar select download option then SPEADSHEET. Thats all.
    Reward all the helpful answers..
    With Regards
    Navin Khedikar

  • Download ALV output to excel with formatting

    Hi All,
    i want to download ALV output to excel sheet and the uneditable fields in ALV oputput should be locked (uneditable) in excel also.
    Can you please tell me approach to achieve this functionality?
    Thanks in advance.

    Thanks Vamsi. Your Suggestion was helpful.
    I have used excel integration and used SET PROPERTY OF (COLUMN) 'LOCKED' = 1.
    For more details refer below mentioned link.
    http://webcache.googleusercontent.com/search?q=cache:SoY6hFC17PoJ:wiki.sdn.sap.com/wiki/display/Snippets/Download%2BData%2Binto%2BMultiple%2BSheet%2BExcel%2BDocument%2Bwith%2BNon%2BEditable%2BColumns%2B(Password%2Bprotected)%2BUsing%2BABAP%2BOLESetPropertynoteditableexcelsapABAP&cd=1&hl=en&ct=clnk&gl=in&source=www.google.co.in (http://webcache.googleusercontent.com/search?q=cache:SoY6hFC17PoJ:wiki.sdn.sap.com/wiki/display/Snippets/Download%2BData%2Binto%2BMultiple%2BSheet%2BExcel%2BDocument%2Bwith%2BNon%2BEditable%2BColumns%2B%28Password%2Bprotected%29%2BUsing%2BABAP%2BOLESetPropertynoteditableexcelsapABAP&cd=1&hl=en&ct=clnk&gl=in&source=www.google.co.in

  • Problem when dowloading the ALV report output to Excel Sheet.

    Hi ,
    I am dowloading the ALV report output to Excel Sheet.
    There is field Condition Unit(KOMP-KMEIN) in the output of the ALV, this has values PC and CSE , but when I download to Excel Sheet, CSE is appearing as CSE ,but PC is appearing as ******.
    Can you please help me in knowing the reson for this.
    Regards,
    Madhu.

    hi
    refer to following link
    http://www.****************/Tutorials/ALV/ColorSALV/Demo.htm
    http://www.sap-img.com/abap/download-to-excel-with-format-border-color-cell-etc.htm
    Cheers
    Snehi
    Edited by: snehi chouhan on Jul 11, 2008 12:42 PM

  • Downloading of ALV output to excel by asking the password

    Hi all,
               I need to down load the ALV output into the excel sheet. But the thing is that before going to download the output into excel sheet, the system has to prompt for password.once it happens then the user will enter the password and it should validate. if the validation is successful then the output should download to the excel sheet. This is the requirement, can anybody help me out regarding this.Please provide the function module names and sample code.
    Thanks & Regards.
    Laxman.P
    B'lore.

    Hi,
    Check this thread,
    Make excel sheet password protected through ABAP codeu0085
    Regards,
    Omkar.

  • Output to Excel sheet

    How to copy the contents of output into excel sheet?

    Hi,
    Check the below example, to download the ALV report output to an excel sheet.
    REPORT Z_CONCEPTALV .
    TABLES: KNA1,VBAK.
    DATA: ITAB TYPE TABLE OF VBAK,
    CONTAINER TYPE SCRFNAME VALUE 'ALVCONTROL',
    CUST TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
    GRID TYPE REF TO CL_GUI_ALV_GRID,
    L_CONTAINER TYPE SCRFNAME VALUE 'LOGO',
    I_PARENT TYPE REF TO CL_GUI_CONTAINER,
    L_CUST TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
    TREE TYPE REF TO CL_GUI_ALV_TREE_SIMPLE,
    LT_LIST_COMMENTARY TYPE SLIS_T_LISTHEADER,
    L_LOGO TYPE SDYDO_VALUE.
    DATA: OK_CODE(4).
    CALL SCREEN 1100.
    *& Module STATUS_1100 OUTPUT
    text
    MODULE STATUS_1100 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    CASE OK_CODE.
    WHEN 'DISP'.
    SELECT * FROM VBAK INTO TABLE ITAB WHERE KUNNR = KNA1-KUNNR.
    IF CUST IS INITIAL.
    CREATE OBJECT CUST EXPORTING CONTAINER_NAME = CONTAINER.
    CREATE OBJECT GRID EXPORTING I_PARENT = CUST.
    CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY EXPORTING I_STRUCTURE_NAME
    = 'VBAK' CHANGING IT_OUTTAB = ITAB.
    ENDIF.
    IF L_CUST IS INITIAL.
    CREATE OBJECT L_CUST EXPORTING CONTAINER_NAME = L_CONTAINER.
    CREATE OBJECT TREE EXPORTING I_PARENT = L_CUST.
    PERFORM BUILD_COMMENT USING LT_LIST_COMMENTARY.
    CALL METHOD TREE->CREATE_REPORT_HEADER EXPORTING IT_LIST_COMMENTARY =
    LT_LIST_COMMENTARY I_LOGO = L_LOGO.
    ENDIF.
    WHEN 'DOWN'.
    PERFORM F_DOWNLOAD_TO_EXCEL.
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    ENDCASE.
    ENDMODULE. " STATUS_1100 OUTPUT
    FORM BUILD_COMMENT USING LT_LIST_COMMENTARY.
    L_LOGO = 'ENJOYSAP_LOGO'.
    ENDFORM.
    FORM F_DOWNLOAD_TO_EXCEL.
    CALL FUNCTION 'DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = ' '
    CODEPAGE = ' '
    FILENAME = ' '
    FILETYPE = 'DAT'
    ITEM = ' '
    MODE = ' '
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    FILEMASK_MASK = ' '
    FILEMASK_TEXT = ' '
    FILETYPE_NO_CHANGE = ' '
    FILEMASK_ALL = ' '
    FILETYPE_NO_SHOW = ' '
    SILENT = 'S'
    COL_SELECT = ' '
    COL_SELECTMASK = ' '
    NO_AUTH_CHECK = ' '
    IMPORTING
    ACT_FILENAME =
    ACT_FILETYPE =
    FILESIZE =
    CANCEL =
    TABLES
    DATA_TAB = ITAB
    FIELDNAMES =
    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 <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.
    Refer these links:
    Export ALV List into Excel Sheet
    How to convert alv list into excel file?
    Reward points if found helpful...
    Cheers,
    Chandra Sekhar.

  • How to down load the output of smart form into .XLS(spreadsheet) File.

    Hi All,
    We have one requirement like we need to down load the output of smart form into .XLS(spreadsheet) File.
    This output is related to Shipment(VT03N) in the output we are not displaying the any logo.
    Just we are displaying the address and item detail.
    Anyone tell me, If possible please let me know how can solve that problem.
    Thanks and regards,
    Amjad Hussain,

    Hi Mohammed,
    Absolutly you can download output from smartforms to excel.
    After execution of  your Smartforms in that layout Menu bar Do below  navigation.
    GoTo =>  ListDisplay      after that
    System  =>   List
                            =>    Save
                                             => Local File
                                                               => Spread Sheet.
    if helpful REWARD points
    Thank you .
    Regards
    Ramana

  • ALV Output to Excel file

    Hi All,
    I am downloading the ALV output to Excel file.I am making use of  LIST--->EXPORT--->SPREADSHEET option.
    My list is having Header, Footer, sub totals and totals.When i transfer the list i am facing following problems
    1.Even i am getting the empty columns betweeen my output.
    2.In the Place of sub totals i am getting astericks
    3.On the top of the records downloaded,"DYNAMIC LIST DISPLAY" is found.I want to avoid this text on the top
    Thanks,
    Ravee...

    Hello Vinod,
    1.I am getting the empty columns betweeen my output.
    I am having 16 columns in the ALV output,but i got 19 columns in my excel file.
    2.In the Place of sub totals i am getting astericks.
    Generally there is no possibility to download the sub totals.i am using LIST->EXPORT->SPREADSHEET.
                     I am having the sub totals in my output.
    *You would have noticed the' * ' for sub total and ' ** ' for grand totals values.*These sub total & total values are not downloaded but these asterisks are carried to excel file.
    3.On the top of the records downloaded,"DYNAMIC LIST DISPLAY" is found.I want to avoid this text on the top.
    I am using the application tool bar icon only.Still i am getting the same.
    Thanks,
    Ravee...

  • List format output to excel sheet

    Hi,
        I have a report output in list format. I need to download that into excel sheet. Is it possible to download a list format output to excel sheet or shall I need to convert that into grid format?
    Thanks Barnita.

    HI,
    Use Menu path
    List->Save/Send->File path

  • Download ALV report to excel sheet

    halo fellow SAPiens,
    i want to download my alv report into excel sheet...........for tht i used UGI_DOWNLOAD........here if i use the file type as 'ASC' all the leading zeros of numeric values are removed and date format is "yyyy/mm/dd".......
    i need the leading zeros and date format in "dd/mmyyy"
    when i use file type 'DBF' i get the leading zeros but my date is replaced by '#####.............wht shld i do...........

    To get the leading zeros to come, append an apostrophe to the start of each field that has the leading zeros as shown
    loop at itab.
    concatenate '''' itab-field1 into itab-field1.
    modify itab.
    endloop.
    note that
    1. This sometimes doesnt show correctly in excel and you may have to double click on the cell to prevent the apostrophe from displaying in the sheet
    2. You field needs to have an extra character to add the apostrophe

  • Facing a Problem while downloading the data from ALV Grid to Excel Sheet

    Hi Friends,
    Iam facing a problem while downloading the data from ALV Grid to excel sheet. This is working fine in Development server , when comes to Quality and Production servers I have this trouble.
       I have nearly 11 fields in ALV Grid and out of which one is PO number of length 10 , all the ten numbers are visible in the excel sheet if we download it from development server but when we download it from Quality or Production it is showing only 9 numbers.
    Can any one help me out in this case.

    hi...
    if this problems happens dont display the same internal as u finally got.
    just create new internal table without calling any standard data elements and domains... but the new internal table s similar like ur final internal table and move all the values to new int table.
    for eg.
    ur final internal int table for disp,
         data : begin of itab occur 0,
                        matnr like mara-matnr,
                   end of itab.
    create new like this,
               data : begin of itab occur 0,
                        matnr(12) type N,
                   end of itab.

  • Dump in prodcution server while downloading ALV report to excel sheet

    HI ALL,
    ALV report is working fine in bother DEV and PROD servers....but in production while downloading report to excel sheet it is going to dump.
    "dump is below:
    Short text
    Field symbol has not yet been assigned.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "SAPLKKBL" had to be terminated because it has
        come across a statement that unfortunately cannot be executed. "
    But in development this problem is not there, iam able to download ALV report to EXCEL sheet.
    Any help experts......
    Thanks in advance
    Ram

    Hi,
    I had the same problem,
    Run a consistency check for your ALV and you will find out. See if you havent passed any unnecessary parameter to FM.
    /people/rainer.hbenthal/blog/2009/09/25/sos--my-alv-report-is-not-working
    Dump while printing ALV (field symbol not assigned)
    Sumit

  • Getting ERROR when downloading alv output to Excel

    Hello All,
    I get a error message when I try to use the standard funtionality to download the alv output to excel.
    The current statement only supports character-type data objects.
    What happened?
    The current ABAP/4 program "SAPLKKBL " had to be terminated because
    one of the statements could not be executed.
    This is probably due to an error in the ABAP/4 program.
    Error analysis
    In statement
       "STRLEN( obj )..."
    the argument "obj" can only take a character-type data object.
    Source code extract
    038620   *   ansonsten entspricht sich min. Ausgabelänge und Ausprägungslänge
    038630       else.
    038640         if gs_fc-tech_form ne 99.
         >           gs_out-hlplen = strlen(  ).
    038660         endif.
    038670       endif.
    In this case, the operand "obj" has the non-character type "I".
    Please can anyone put some light on this. It is veru difficult to go through the whole std functionality to download.
    Thanks for all support guys!
    Sri.

    Hi srikanth,
    This error comes because the values present in any one of the displayed coloums containing special character like * present before or after the number....  i.e  instead of 4 ...**4.
    While displaying in the screen it is of no problem. since both *4 are converted into char format (internally) and gets displayed.
    But while you download the same throu the EXCEL functionality SAP will intenally convert the same into NUMERIC format. Since 4 is number.
    So in that case *4 will cause dump.
    *So find out the place in which the value appearing like this *4 and try to correct it.
    *Surely it is of Field LENGTH problem. Try to increase the length of the field 4.
    It Should WORK.!!!..  else post ur query here.
    REWARD POINTS IF USEFUL
    ~Lakshmiraj~

  • Std Oracle Report output to Excel Sheet

    I'm supposed to make changes to Standard Oracle Report such that the changes of Oracle Standard Report should be Excel output. One of the ways of doing this is to develop the whole report again in Discoverer as it has the feature of outputing into Excel Sheet. I would appreciate if someone can suggest me other ways of achieving it.
    Thanks
    Bobby

    Hi,
    even i am trying to do the same with my reports. Though it is possible to convert the reports to excel using the DESFORMAT attribute on the reports service, I am not able to preserver all the format in the excel sheet.
    I do not want to use rep2excel but want to implement the same idea on my reports service. Is it possible
    thanks

Maybe you are looking for

  • Alarm status drawing iow: recolour JInternalFrame components

    Greetings, Please have a look at this picture. It's a low res snapshot of a few quite complicated components. Most of the functionality isn't visible nor relevant in the example. What you're looking at is a real time process of some sort. Things can

  • Ejb-jar.xml gets corrupted..at the time of deployment

    Hi, I'm Implemnting an application for Ejb's in WebDynpro. I'm conncting my database table in java dictionary to Webdynpro Interface using EJB. I have used the follwing link... Link: Consuming EJBs in web dynpro Using java dictionary But i'm facing 2

  • Masthead configuration

    Hello, I want to make changes to the masthead in order to customize it's behavior. I know how to do this the only thing is that I'm concerned about patches and upgrades. Because the par file contains the implemntation classes (like com.sapportals.por

  • Having Problems Importing Video From Camcorder ( Log and Transfer?)

    Hi everyone Today i received my Canon HF11 It records AVCHD format. I'm pressing log and transfer, and it comes up, however when i press 'add to queue' it will be added, then an icon comes and spins for a few seconds, then it'll stop and turn into a

  • Lightroom on the iPad

    Is there any way to get Lightroom on thhe iPad witohut having to sign up for it via Creative Cloud? I do not need, or use Photoshop (I sold my copy after realising it had not been used in almost a year!), and I do not need to pay for storage for sync