About ALV Grid

I am using ALV Grid with logo display.At the time of print preview logo was not displayed.
Regards
Hari

hi Hari,
U can have look in one of the links
Simple ALV report
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
Check the program in the following link:
http://sap-img.com/abap/display-secondary-list-using-alv-grid.htm
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_basic.htm
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
13. Top-of-page in ALV
selection-screen and top-of-page in ALV
14. ALV Group Heading
http://www.sap-img.com/fu037.htm
How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
15. ALV output to PDF conversion
It has an example code for PDF Conversion.
http://www.erpgenie.com/abap/code/abap51.htm
converting the output of alv in pdf
Cheers
Mohinder Singh Chauhan

Similar Messages

  • How to  learn about ALV Grid?

    Hi Experts,
    I dont about ALV grid and how to implement it.So can anyone let me know how to implement the simple basic ALV grid with example?
    Please explain me with set by step procedure.
    Thanks a lot in Advance,
    Regards,
    Raghu

    hi,
    Process to create ALV with OOPs:
    Step 1:
    Create a container. There are 2 type of containers: docking and custom.
    Go to SE38.Create a program. Use Pattern button to create object for docking container. Click ABAP Object Pattern radio button. Click Create object radio button. Give Instance as o_docking and class as cl_gui_docking_contianer.
    Step 2:
    Create a grid inside the container.
    Use Pattern button to create the same. Make the parent of grid as container.
    Click ABAP Object Pattern radio button. Click Create object radio button. Give Instance as o_grid and class as cl_gui_alv_grid. Create object o_grid.
    Step 3:
    Call the function lvc_fieldcatalog_merge to get the field catalog.
    Pass the structure name.
    Step 4:
    Call the method of grid set_table_for_first_display to display the output.
    Click ABAP Object Pattern radio button. Click Call Method radio button. Give Instance as o_grid and Class/Interface as cl_gui_alv_grid and Method as set_table_for_first_display.
    w_variant-report = sy-repid.
    Call method o_grid->set_table_for_first_display
    Step 5:
    Fill the internal table itab with values by using logic.
    select * from mara into table itab up to 100 rows.
    call screen 9000.
    Create a screen by double clicking 9000 in the above line. Fill the description for the screen. In the flow logic, uncomment the PBO and PAI module and create those in main program (for simplicity).
    Step 6:
    Create GUI status. Create GUI Title if required. That can be done by using display object List (CtrlShiftF5).Then in left side, right click the program and create GUI Status and Title.
    Step 7:
    Free the memory occupied once the BACK, EXIT or CANCEL button is clicked. Use Pattern button to call the method FREE of cl_gui_alv_grid and cl_gui_docking_container.
    Click ABAP Object Pattern radio button. Click Call Method radio button. Give Instance as o_grid and Class/Interface as cl_gui_alv_grid and Method as Free.
    Similarly Click Call Method radio button. Give Instance as o_docking and Class/Interface as cl_gui_docking_container and Method as Free.
    Also follow these links.
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Hope this helps, Do reward.

  • Question ABout ALV GRIDS

    Hi,
    I need to add a custom button to the alv grid menu and i couldnt able to see the screen when i execute this program. Will u please tell me how to add a new button to the existing application toolbar of the ALV grid. I had tried this code but couldnt succeeded.
    Here is my code.
    REPORT ZZZZ .
    *& Report  ZZZZ
    type-pools: slis.
    Data to be displayed
    data: gt_wrkpool type  table of zte_wrkpool.
    data: gs_wrkpool type zte_wrkpool.
    data: gs_layout type slis_layout_alv.
    DATA:G_REPID TYPE SY-REPID.
    Selection
    select * from zte_wrkpool into corresponding fields of table gt_wrkpool.
    Eingabebereit
    gs_layout-edit = 'X'.
    G_REPID = SY-REPID.
    Call ABAP List Viewer (ALV)
    call function 'REUSE_ALV_GRID_DISPLAY'
         exporting
              I_CALLBACK_PROGRAM       = g_repid
              I_CALLBACK_USER_COMMAND = 'ACTION'
              I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
              i_structure_name        = 'zte_wrkpool'
              is_layout               = gs_layout
             IT_SORT = SORT[]
             IT_EVENTS = events[]
         tables
              t_outtab                = gt_wrkpool.
    FORM pf_status_set USING gt_extab TYPE slis_t_extab.
    SET PF-STATUS <ZSTANDARD>.
    ENDFORM.
    Create another subroutine:
    *&      Form  user_command
      Takes the User command and acts accordingly
    FORM user_command  USING r_ucomm     LIKE sy-ucomm
                           rs_selfield TYPE slis_selfield.
    call function 'sAP_WI_FORWARD'
    endform.

    Hi vicky,
    1. The important things are :
    a) New PF-STATUS is required , say 'ABCD'.
    b) Handle user_commmand
    2. First of all, from Function group SALV,
    copy the STANDARD gui status to your program,
    from SE80, by right clicking.
    3. come to your program.
    start-of-selection.
    SET PF-STATUS 'ABCD'.
    4. Double click ABCD and activate the gui status.
    6. AT USER-COMMAND.
    IF sy-ucomm = 'MYFCODE'.
    ENDIF.
    regards,
    amit m.

  • About ALV Grid's cell merge..Helpppp

    Dear gurus:
    I just write some code in order to learn alv.
    but i find when i sort the data by 'carrid', the cells which have same data was merged. and i declare the cell_merge = space, the result is just the same, how can i solve it? i want the cells not merge.
    REPORT  zzalv17.
    TYPE-POOLS: slis.
    TABLES: spfli.
    DATA: it_sortinfo TYPE slis_t_sortinfo_alv,
          wa_sortinfo TYPE slis_sortinfo_alv,
          it_layout TYPE slis_layout_alv,
          it_spfli LIKE STANDARD TABLE OF spfli.
    SELECT *
    INTO CORRESPONDING FIELDS OF TABLE it_spfli
    FROM spfli.
    CLEAR wa_sortinfo.
    wa_sortinfo-spos = 1.
    wa_sortinfo-fieldname = 'CARRID'.
    wa_sortinfo-up = 'X'.
    APPEND wa_sortinfo TO it_sortinfo.
    it_layout-zebra = 'X'.
    it_layout-detail_popup = 'X'.
    it_layout-colwidth_optimize = 'X'.
    it_layout-cell_merge = space.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        it_sort          = it_sortinfo
        is_layout        = it_layout
        i_structure_name = 'SPFLI'
        i_save           = 'X'
      TABLES
        t_outtab         = it_spfli.

    Its a little miss leading, isn't it.  Anyway, I was seeing the same, so I looked into the underlying code, and it is expecting that you pass an "N" in order to suppress the merging, so set it to "N" and it will work.
    it_layout-cell_merge = 'N'.
    Regards,
    RIch Heilman

  • Export to spreadsheet from program result list (ALV Grid) via the web

    Hello alles!
    When executing a program (a report) using SAP WebGUI or the portal (Manager's Desktop/Launchpad etc.), exporting the result list to a spreadsheet doesn't seem to work. No error message, browser doesn't really hang, but nothing happens. Neither Excel, nor XML export, nor anything works.
    Export from the same program works just fine in SAP GUI.
    (SAP Note 314568 has some information about ALV Grid export limitations, but I can't make the XML export work either...)
    Could this be a configuration error in ITS? In that case, where..?
    Or is it something we just need to live with?
    Thank you in advance!
    Brgds, Caroline

    There is a known problem regarding exportation to Excel.
    Try the following path :
    Tools --> Macro --> Security
    Then go to the "Trusted Publishers" tab and tick the "Trust acess to Visual Basic Project" option.
    This should do the trick.

  • Page Up and Page Down in ALV Grid

    Hello Experts,
    I have a simple ALV Grid report program. . If the report displays a lot of records then the scroll ups and downs can be used. However the new requirement is to make the page up, next, prevoius, down function. I have already included a SET PF-STATUS where I copied the standard and added the page up,down,next and previous. Those buttons/icons are now active in the toolbar but its not functioning as expected, nothing happens when it is being clicked. I've read some forums and below are the propose solutions:
    - Reduce the SAP work area --> how to reduce it?
    - Most forums are about ALV Grid report in OO and Dialog programming whereas a code will be put in PAI and PBO to make the page up, down buttons to function. --> How will this be applied since the report is just a simple report program (not OO or dialog)
    What is best solution to apply in my case?
    Thanks in advance!
    Best Regards,
    Alezandro

    hi kurtt
    Perhaps the below code, for scrolling the buttons can help u if the PF status and functionlity is already in place-
    module scroll_tab input.
    data: v_lines1 type sy-loopc.
    clear: ok_code,
    save_ok.
    ok_code = sy-ucomm.
    save_ok = ok_code.
    case save_ok.
    when 'PU'. "Page Up
    tc1-top_line = tc1-top_line - lv_looplines.
    if tc1-top_line < 1.
    tc1-top_line = 1.
    endif.
    when 'PD'. "Page Down
    tc1-top_line = tc1-top_line + lv_looplines.
    if tc1-top_line > lv_lines.
    tc1-top_line = ( lv_lines - lv_looplines ) + 1.
    endif.
    when 'PTU'. "Page total up
    tc1-top_line = 1.
    when 'PTD'. "Page total down
    TC1-TOP_LINE = ( LV_LINES - LV_LOOPLINES ) + 1.
    describe table it_vbak lines v_lines1.
    tc1-top_line = v_lines1.
    endcase.
    endmodule. " SCROLL_TAB INPUT
    regards
    praveen

  • About filter in alv grid display

    Hi,
       I am practicing on REUSE_ALV_GRID_DISPLAY in that i want to know about how to use some fields like
       *ITFILTER*_
       IT_ALV_GRAPHICS
       IT_HYPERLINK
       IT_ADD_FIELDCAT
       IT_EXCEPT_QINFO

    Hi Rock.
    I would like to suggest you a couple of references which quite relate to your case,
    REUSE_ALV_GRID_DISPLAY -  Output of a simple list (single-line)
    [SDN - Reference for Using REUSE_ALV_GRID_DISPLAY - Basic Program|alv prog;
    [SDN - Reference for Use of IT_FILTER in REUSE_ALV_GRID_DISPLAY |Doubts in ALV?;
    [SDN - Reference for use of IT_FILTER with CODE in REUSE_ALV_GRID_DISPLAY|ALV Report;
    [SDN - Refernce for Using IT_ALV_GRAPHICS in REUSE_ALV_GRID_DISPLAY|OOPs :  SAVE and ALV Display Variant;
    [SDN - Reference for Editing a graph in ALV (IT_ALV_GRAPHICS) using REUSE_ALV_GRID_DISPLAY|Edit Graph display ALV list display;
    [SDN - Reference for use of IT_HYPERLINK in REUSE_ALV_GRID_DISPLAY|editable fields on ALV grid;
    [SDN - Reference including example of IT_ADD_FIELDCAT in REUSE_ALV_GRID_DISPLAY|building top of page in ALV list;
    [SDN - Reference for scenario for use of IT_EXCEPT_QINFO in REUSE_ALV_GRID_DISPLAY|Background ID in ALV Grid;
    [SDN - Reference for application example of IT_EXCEPT_QINFO in REUSE_ALV_GRID_DISPLAY|PF Status in ALV list.;
    Hope That's Usefull.
    Good Luck & Regards.
    Harsh Dave

  • Downloads from ALV GRID-Text conversion to dates in EXCEL

    When downloading table displays of data from ALV-GRID for excel spreadsheet, we end of with files that have a header and various line ifnromation.  IF we manually clear up the display, then we can have the individicual column headers used and force them to text but if we just call the file up as an EXCEL spreadsheet, some part numbers such 12-3465 appear in Excel as Dec-65.
    The following is an example of the record (but it is word wrapped within this display limit).  In actuality, the verbage enclosed with the <b> represent the start of the  lines that have actual display data running out about 90 characters.
    Suggestions on how to make the download immediately correct in Excel direct from SAP ALV-GRID without cleaning out the heading lines and manually forcing the affected columns to TEXT format?
    thanks
    <b>03/02/2007</b>                                                                    Dynamic List Display                                                                                1
    <b>Materials-Inforecord Details Report</b>
    <b>Purchasing Org: ILMO</b>
                        <b>Report Run Date:03/02/2007</b>                    <b>Report Time:14:31:16</b>
         <b>Plnt     Mat Grp     Vendor     Name 1     Material     Material</b> description     Vendor Cat     Mfr     MPN     PC     Item Chg.     OUn      Eq to     BUn     Net price     Per     OPUn     Inforecord     PGr     Mv Avg        per     ValCl
         <b>0042     04     106070     BURROWS COMPANY</b>     184110     Glv Exam Ltx Non Ster     02-5001     TILLOTSON     02-5001               CA     2,000     EA        93.40      1     CA     5300006999     999     93.40     2,000     6438

    there are different options to export to excel which all behave differently, if you go for the menu ->export it differs from the export button from the alv buttonbar.
    try the different export to excel options perhaps there is one that behaves the way you want
    kind regards
    arthur de smidt

  • Folder in alv grid display report

    Hi Experts,
    I have a requirement  to generate the folder in alv grid display, to display the multiple line items where ever we have.
    Actually I am displaying the material details and production order details.
    If the material is having the multiple production order details , in that case we need to place all the production order details in one folder, and if you open that folder arrow, we have to display the production order details.
    I am using REUSE_ALV_GRID_DISPLAY function module to develope this application. Here Hierseq list is recommended to use for this application, why because folder option is already available in grid display. that we can observe in CL6AN. 
    Is it possible to implement it through function modules or through OOABAP.
    Actually, I have to generate the report which we can see in CL6AN Transaction code,,
    Your valuable suggestions surely will attract the benifits.
    Thanks in advance.
    Ramesh.

    Hi ramesh,
    Hierseq list is not supported in the grid display. You could do this using an OO tree display but this could be rather complicated. What about displaying one field per material line with the number of production orders. At double-click on that field, open a second grid display (possibly as popup) to show the production order details.
    Regards,
    Clemens

  • Check box in ALV grid gets unselected for new selection

    Hi all,
    This is my code :
    TYPE-POOLS : slis.
    Variable
    DATA: g_repid LIKE sy-repid,
          g_title TYPE lvc_title,
          g_set_pf_stat TYPE slis_formname VALUE 'SET_PF_STATUS',
          g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
          g_layout TYPE slis_layout_alv,
          g_print_alv TYPE slis_print_alv,
          g_variant LIKE disvariant,
          c_char_a(1) VALUE 'A',
          c_char_x(1) VALUE 'X',
          itab_alv_sort TYPE slis_t_sortinfo_alv,
          itab_alv_fcat TYPE slis_t_fieldcat_alv,
          fm_name type rs38l_fnam," Function Module Name
    *      l_sfctrlparams LIKE ssfctrlop, " Form Print Parameter
    *      l_sfoutopt LIKE ssfcompop,
          pri_params LIKE pri_params,
          c_x type c .
    *       Internal tables          Begin with IT_                       *
    DATA : it_fcat TYPE SLIS_T_FIELDCAT_ALV,                           "---ALV
           it_disp type table of ZLOI.
    *       Work Area for Internal tables      Begin with WA_             *
    data : wa_fcat TYPE slis_fieldcat_alv ,              "---ALV
           wa_layout           TYPE lvc_s_layo,               "---ALV
           wa_it_disp like line of it_disp.
    *       Objects                                                       *
    DATA : cref TYPE REF TO cl_gui_custom_container,          "---ALV
           gref TYPE REF TO cl_gui_alv_grid.                  "---ALV
    *        Start-of-selection
    Start-of-selection.
      perform fetch_po_det.
      perform build_fcat.
      perform alv_display.
    *&      Form  FETCH_PO_DET
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FETCH_PO_DET .
      data : it_po type table of crmd_orderadm_h,
               wa_po like line of it_po,
               wa_header type BBP_PDS_PO_HEADER_D.
      select  guid
              object_id
              DESCRIPTION
              POSTING_DATE
              CREATED_BY
      from crmd_orderadm_h
      into corresponding fields of table it_po
      where object_type = 'BUS2201'.
      loop at it_po into wa_po.
        move wa_po-object_id to wa_it_disp-ZZPONO.
        move wa_po-DESCRIPTION to wa_it_disp-ZZPODESC.
        move wa_po-posting_date to wa_it_disp-ZZPODATE.
        move wa_po-created_by to wa_it_disp-ZZPOCREATOR.
        CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
          EXPORTING
            I_OBJECT_ID = wa_it_disp-zzpono
          IMPORTING
            E_HEADER    = wa_header.
        move wa_header-total_value to wa_it_disp-ZZPOVAL.
        move wa_header-currency to wa_it_disp-ZZPOCUR.
        append wa_it_disp to it_disp.
      endloop.
    *  write : wa_it_disp-zzpono.
    ENDFORM.                    " FETCH_PO_DET
    *&      Form  BUILD_FCAT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM BUILD_FCAT .
      g_repid = sy-repid.
      g_title = 'LOI details'.
      g_print_alv-no_print_listinfos = 'X'.
      g_variant-report = sy-repid.
      g_variant-variant = sy-title.
      CLEAR g_layout.
      g_layout-f2code = ' '.
      wa_layout-zebra       = 'X'.
      g_layout-flexible_key = 'X'.
      g_layout-colwidth_optimize = 'X'.
      g_layout-detail_initial_lines = 'X'.
      g_layout-box_fieldname = 'ZZCHECK'.
    *g_layout-box_tabname = 'ITAB_REPORT'.
    *Check box
      wa_fcat-fieldname = 'ZZCHECK'.
      wa_fcat-checkbox = 'X'.
      wa_fcat-outputlen = '1'.
      wa_fcat-col_pos = '1'.
      wa_fcat-edit = '1'.
      wa_fcat-seltext_m = 'No'.
      append wa_fcat to it_fcat.
    *Po no
      clear wa_fcat.
      wa_fcat-fieldname = 'ZZPONO' .
    wa_fcat-tabname = 'IT_DISP'.
    *  wa_fcat-seltext = 'Purchase Order'.
      wa_fcat-seltext_m  = 'Purchase Order'.
    *wa_fcat-seltext_s = 'Purchase Order.
    wa_fcat-icon = 'X'.
      wa_fcat-col_pos = '2'.
      wa_fcat-outputlen = 10.
      append wa_fcat to it_fcat.
    *Desc
      wa_fcat-fieldname = 'ZZPODESC' .
    wa_fcat-tabname = 'IT_DISP'.
    *wa_fcat-seltext_l = 'Description'.
      wa_fcat-seltext_m = 'Description'.
    *wa_fcat-seltext_s = 'Description'.
      wa_fcat-col_pos = '3'.
      wa_fcat-outputlen = 10.
      append wa_fcat to it_fcat.
    *Postign date
      wa_fcat-fieldname = 'ZZPODATE' .
    wa_fcat-tabname = 'IT_DISP'.
    wa_fcat-seltext_l = 'Posting Date'.
      wa_fcat-seltext_m = 'Posting Date'.
    *wa_fcat-seltext_s = 'Posting Date'.
      wa_fcat-col_pos = '4'.
      wa_fcat-outputlen = 8.
      append wa_fcat to it_fcat.
    *value
      wa_fcat-fieldname = 'ZZPOVAL' .
    wa_fcat-tabname = 'IT_DISP'.
    *wa_fcat-seltext_l = 'PO value'.
      wa_fcat-seltext_m = 'PO value'.
    *wa_fcat-seltext_s = 'PO value'.
      wa_fcat-col_pos = '5'.
      wa_fcat-outputlen = 15.
      append wa_fcat to it_fcat.
    *Currency
      wa_fcat-fieldname = 'ZZPOCUR' .
    wa_fcat-tabname = 'IT_DISP'.
    *wa_fcat-seltext_l = 'PO Currency'.
      wa_fcat-seltext_m = 'PO Currency'.
    *wa_fcat-seltext_s = 'PO Currency'.
      wa_fcat-col_pos = '6'.
      wa_fcat-outputlen = 5.
      append wa_fcat to it_fcat.
    *Creator
      wa_fcat-fieldname = 'ZZPOCREATOR' .
    wa_fcat-tabname = 'IT_DISP'.
    *wa_fcat-seltext_l = 'Buyer'.
      wa_fcat-seltext_m = 'Buyer'.
    *wa_fcat-seltext_s = 'Buyer'.
      wa_fcat-col_pos = '7'.
      wa_fcat-outputlen = 12.
      append wa_fcat to it_fcat.
    ENDFORM.                    " BUILD_FCAT
    *&      Form  ALV_DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM ALV_DISPLAY .
      sort it_disp by ZZPONO.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
         I_CALLBACK_PROGRAM                = g_repid
         I_CALLBACK_PF_STATUS_SET          = g_set_pf_stat
         I_CALLBACK_USER_COMMAND           = g_user_command
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
    *   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *   I_CALLBACK_HTML_END_OF_LIST       = ' '
    *   I_STRUCTURE_NAME                  =
    *   I_BACKGROUND_ID                   = ' '
          I_GRID_TITLE                      = g_title
    *   I_GRID_SETTINGS                   =
          IS_LAYOUT                         = g_layout
          IT_FIELDCAT                       = it_fcat[]
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
    *   IT_SORT                           =
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
          IS_VARIANT                        = g_variant
    *   IT_EVENTS                         =
    *   IT_EVENT_EXIT                     =
          IS_PRINT                          = g_print_alv
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 0
    *   I_SCREEN_START_LINE               = 0
    *   I_SCREEN_END_COLUMN               = 0
    *   I_SCREEN_END_LINE                 = 0
    *   I_HTML_HEIGHT_TOP                 = 0
    *   I_HTML_HEIGHT_END                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_HYPERLINK                      =
    *   IT_ADD_FIELDCAT                   =
    *   IT_EXCEPT_QINFO                   =
    *   IR_SALV_FULLSCREEN_ADAPTER        =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
        TABLES
          T_OUTTAB                          = it_disp[]
       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.                    " ALV_DISPLAY
    *&      Form  user_command
    *       text
    *      -->R_UCOMM      text
    *      -->RS_SELFIELD  text
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.                             "#EC CALLED
      CASE R_UCOMM.
        WHEN 'PRINT'.
          READ TABLE IT_disp INTO WA_IT_DISP WITH KEY ZZCHECK = 'X'.
          IF SY-SUBRC EQ 0.
            loop at it_DISP INTO WA_IT_DISP.
              CALL FUNCTION 'POPUP_TO_CONFIRM'
                EXPORTING
                  TEXT_QUESTION = 'Print the LOI details?'
                  TEXT_BUTTON_1 = 'Yes'
                  TEXT_BUTTON_2 = 'No'.
    *      IMPORTING
    *        ANSWER        = w_answer.
              IF SY-SUBRC  0.
              ENDIF.
    *          PERFORM CALL_SF.
            endloop.
          ENDIF.
        WHEN 'BACK'.
          LEAVE PROGRAM.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
        WHEN 'CANCEL'.
          LEAVE PROGRAM.
      ENDCASE.
      rs_selfield-refresh = 'X'.
    ENDFORM.                    "user_command
    *&      Form  set_pf_status
    *       text
    *      -->RT_EXTAB   text
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTANDARD' EXCLUDING rt_extab.
      SET TITLEBAR sy-tcode.
    ENDFORM.                    "set_pf_status
    Now in my ALV grid o/p i can  see the check box  but if i select one row and then try to slect another the first one gets deselected.
    Can anybody tell me what is missing?

    Hi,
    if you need just a check box for each line, try to get rid of this line from your layout.
    g_layout-box_fieldname = 'ZZCHECK'.
    SAP uses this field to store info about selected lines. Hence you click on the second check box, you select different line and the first line is erased. You can select more line by holding SHIFT + CTRL
    Cheers

  • Dump when summing up CURR field in ALV GRID display

    Hi All,
    I am getting dump when I try to sum the CURR field in my ALV Grid Display. The field is of CURR 23.  I am using classes and methods to display alv grid.
    I tried passing <fs_fieldcat>-do_sum = 'X'. When I did this, it is dumping without even displaying the alv grid.
    Here is the part it is throwing dump:
            ls_lvc_data-value = space.
            clear ls_lvc_data-style.
            loop at it_fcat_local assigning <ls_fcat>
                    where tech ne 'X' and no_out ne 'X'.
              if l_invisible eq 'X'.
                clear l_invisible.
                if <ls_fcat>-do_sum is initial.
                  continue.
                else.
                  clear ls_lvc_data-col_pos.
                endif.
              endif.
              add 1 to ls_lvc_data-col_pos.
              assign component <ls_fcat>-fieldname
                               of structure <ls_data> to <l_field_value>.
              _if sy-subrc ne 0.
                message x000(0k).
              endif._
    Regards,
    Guru

    Thomas,
    Here is the dump:
    Runtime Errors         MESSAGE_TYPE_X
    Date and Time          10/22/2010 23:30:53
    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:
    Long text of error message:
    Technical information about the message:
    Message class....... "0K"
    Number.............. 000
    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" " "
    "SAPLSLVC" or "LSLVCF36"
    "FILL_DATA_TABLE"
    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.
    Source Code Extract
    Line
    SourceCde
    2708
    is_subtottxt_info = ls_subtot_info
    2709
    ip_subtot_line    = lr_data
    2710
    changing
    2711
    c_subtottxt       = l_subtottxt.
    2712
    ls_lvc_data-value = l_subtottxt.
    2713
    2714
    append ls_lvc_data to ct_lvc_data.
    2715
    endif.
    2716
    2717
    2718
    Column per Fieldcat Entry
    2719
    2720
    ls_lvc_data-value = space.
    2721
    clear ls_lvc_data-style.
    2722
    loop at it_fcat_local assigning <ls_fcat>
    2723
    where tech ne 'X' and no_out ne 'X'.
    2724
    if l_invisible eq 'X'.
    2725
    clear l_invisible.
    2726
    if <ls_fcat>-do_sum is initial.
    2727
    continue.
    2728
    else.
    2729
    clear ls_lvc_data-col_pos.
    2730
    endif.
    2731
    endif.
    2732
    2733
    add 1 to ls_lvc_data-col_pos.
    2734
    2735
    assign component <ls_fcat>-fieldname
    2736
    of structure <ls_data> to <l_field_value>.
    2737
    if sy-subrc ne 0.
    >>>>>
    message x000(0k).
    2739
    endif.
    2740
    2741
    *... work on average
    2742
    if <ls_fcat>-do_sum eq 'C'.
    2743
              Initialize average result and entries
    2744
    <l_field_value> = 0.
    2745
    clear l_entries.
    2746
    2747
              retrive unit from fieldcatalog
    2748
    assign space to <l_unit>.
    2749
    if not <ls_fcat>-cfieldname is initial.
    2750
    assign component <ls_fcat>-cfieldname
    2751
    of structure <ls_data> to <l_unit>.
    2752
    endif.
    2753
    if not <ls_fcat>-qfieldname is initial.
    2754
    assign component <ls_fcat>-qfieldname
    2755
    of structure <ls_data> to <l_unit>.
    2756
    endif.
    2757

  • Average value for a Date Field in an OO Alv Grid.

    Hi Abapers.
    I've been searching for some info about averages in OO Alv grid lists but cannot find an answer to what I'm really need. The question is that, for getting an average, a 'C' value must be set in the field DO_SUM of the fieldcatalog structure for a field.
    Now, the problem is that I need the average of a date field (in 'normal' date format). I've tried it several times and read a lot of things but cannot find a real answer: Could it be done the average of a date field (e.g. for dates 01.05.2009, 02.05.2009 and 03.05.2009 the average is 02.05.2009).
    Best Regards.

    Hi,
    It will come along with the standard tool bar.For number fields, you can see it(Mean).

  • Problem in pf status in alv grid

    Hi ,
    In alv grid in fm reuse_alv_grid_display under parameter   I_CALLBACK_PF_STATUS_SET   = STATUS
    FORM STATUS_SET USING LS_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'XYZ' EXCLUDING EXTAB.
    ENDFORM.
    Now i have to set back & exit button in my std toolbar.
    I double clicked on XYZ & then control moves to menu painter & i defined all above mentioned button in application toolbar.
    I activated but the mentioned buttons are not displaying in output.
    Anybody will suggest me what i have to do in this case??

    hi
    good
    go through this links
    http://sap.ittoolbox.com/code/archives.asp?i=10&d=3603&a=s
    http://sap.ittoolbox.com/code/archives.asp?i=10&d=1917&a=s
    this ll give you complete idea about the pf status in alv.
    thanks
    mrutyun^

  • How to read a alv grid row data from standard program

    Hi All,
    I am working on transaction LBK1. Actually when you will open this transaction in the left hand side it will show you the data in tree. When you click on a notification node it will show the relevant data in right side. In which there is a operation tab . In this tab the data comes in alv grid. If user selects a row then I have to get that selected row value. There is also a toolbar above on the tree side. There are some buttons which execute our implementation class where I can put the code.  
    Can anyone please help me out? How I can read that selected row in our class/method?
    Thanks in advance.
    Best Regards
    Ritu

    Setting and getting selected rows (Columns) and read line contents
    You can read which rows of the grid that has been selected, and dynamic select rows of the grid using methods get_selected_rows and set_selected_rows. There are similiar methods for columns.
    Note that the grid table always has the rows in the same sequence as displayed in the grid, thus you can use the index of the selected row(s) to read the information in the rows fronm the table. In the examples below the grid table is named gi_sflight.
    Data declaratrion:
    DATA:
    Internal table for indexes of selected rows
    gi_index_rows TYPE lvc_t_row,
    Information about 1 row
    g_selected_row LIKE lvc_s_row.
    Example 1: Reading index of selected row(s) and using it to read the grid table
      CALL METHOD go_grid->get_selected_rows
        IMPORTING
          et_index_rows = gi_index_rows.
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      IF l_lines = 0.
        CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
             EXPORTING
                  textline1 = 'You must choose a valid line'.
        EXIT.
      ENDIF.
      LOOP AT gi_index_rows INTO g_selected_row.
         READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
        ENDIF.
      ENDLOOP.
    Example 2: Set selected row(s).
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      IF l_lines > 0.
        CALL METHOD go_grid->set_selected_rows
            exporting
              it_index_rows = gi_index_rows.
      ENDIF.

  • Multiple ALV Grids on the same window.

    Hi,
    Can someone tell me if it's possible to display multiple ALV grids on the same window.If so how is it done.Please note that I am talking about Grid Display and not List Display.
    Regards,
    Swathi Balakrishnan

    Hi,
    This can be done even i have done a report.
    Its very simple create three containers as below.
    Just repeat three times if u need to create three containers.
    See this sample code using custom container.
    START-OF-SELECTION.
    Begin of process logic
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS01'.
      SET TITLEBAR 'SALESTTL'.
    A L V    G R I D
      IF o_grid_container IS INITIAL.
        CREATE OBJECT o_grid_container
          EXPORTING
            container_name = '<b>CCONTAINER1</b>'.
        CREATE OBJECT o_grid
          EXPORTING
            i_appl_events = 'X'
            i_parent = o_grid_container.
    <b>FOR first A L V    G R I D</b>
        PERFORM set_grid_field_catalog
                    CHANGING i_grid_fcat.
        PERFORM modify_grid_fcat_predisplay
                    CHANGING i_grid_fcat.
        PERFORM set_grid_layout_set
                    CHANGING struct_grid_lset.
        PERFORM sort_outtable CHANGING i_sort_fcat.
    PERFORM populate_grid_data  TABLES i_grid_outs i_grid_outs_pro.
        SORT i_grid_outs BY year month.
        CALL METHOD o_grid->set_table_for_first_display
          EXPORTING
            i_bypassing_buffer    =  space
            is_variant            =  ws_f_grid_disvar
            i_save                =  ws_c_grid_save
            is_layout             =  struct_grid_lset
          CHANGING
            it_outtab             =  i_grid_outs[]
            it_fieldcatalog       =  i_grid_fcat[]
            it_sort               =  i_sort_fcat.      " Period
      ENDIF.
      IF o_grid1_container IS INITIAL.
        CREATE OBJECT o_grid1_container
          EXPORTING
            container_name = '<b>CCONTAINER2</b>'.
        CREATE OBJECT o_grid1
          EXPORTING
            i_appl_events = 'X'
            i_parent = o_grid1_container.
    *<b> FOR SECOND ALV GRID</b>
        PERFORM set_grid1_field_catalog
                    CHANGING i_grid1_fcat.
        PERFORM modify_grid1_fcat_predisplay
                    CHANGING i_grid1_fcat.
        PERFORM set_grid1_layout_set
                    CHANGING struct_grid1_lset.
        PERFORM sort_outtable1 CHANGING i_sort_fcat1.
    PERFORM populate_grid1_data  TABLES i_grid1_outs i_grid1_outs_pro.
        SORT i_grid1_outs BY year month.
        CALL METHOD o_grid1->set_table_for_first_display
          EXPORTING
            i_bypassing_buffer    =  space
            is_variant            =  ws_f_grid_disvar
            i_save                =  ws_c_grid_save
            is_layout             =  struct_grid1_lset
          CHANGING
            it_outtab             =  i_grid1_outs[]
            it_fieldcatalog       =  i_grid1_fcat[]
            it_sort               =  i_sort_fcat1.      " Period
      ENDIF.
      IF o_grid2_container IS INITIAL.
        CREATE OBJECT o_grid2_container
          EXPORTING
            container_name = '<b>CCONTAINER3</b>'.
        CREATE OBJECT o_grid2
          EXPORTING
            i_appl_events = 'X'
            i_parent = o_grid2_container.
    <b>FOR THIRD ALV GRID</b>
        PERFORM set_grid2_field_catalog
                    CHANGING i_grid2_fcat.
        PERFORM modify_grid2_fcat_predisplay
                    CHANGING i_grid2_fcat.
        PERFORM set_grid2_layout_set
                    CHANGING struct_grid2_lset.
    PERFORM populate_grid2_data  TABLES i_grid2_outs i_grid2_outs_pro.
        SORT i_grid2_outs BY year month.
        PERFORM sort_outtable2 CHANGING i_sort_fcat2.
        CALL METHOD o_grid2->set_table_for_first_display
          EXPORTING
            i_bypassing_buffer    =  space
            is_variant            =  ws_f_grid_disvar
            i_save                =  ws_c_grid_save
            is_layout             =  struct_grid2_lset
          CHANGING
            it_outtab             =  i_grid2_outs[]
            it_fieldcatalog       =  i_grid2_fcat[]
            it_sort               =  i_sort_fcat2.      " Period
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE user_command_0100 INPUT.
    As the events are registered as application events, control is first
    passed to the program's PAI. The call 'cl_gui_cfw=>dispatch' will
    forward control to ABAP object event handling and the appropriate
    event handler will be called (if present). This allows the user to
    selectively process events.
      DATA: i_return_code TYPE i .
      CALL METHOD cl_gui_cfw=>dispatch
          IMPORTING return_code = i_return_code.
      save_ok = ok_code.
      CASE save_ok.
        WHEN 'BACK' OR 'END' OR 'CANC'.
          PERFORM exit_program.
      ENDCASE.
      CLEAR save_ok.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  EXIT_PROGRAM
          text
    FORM exit_program.
      CALL METHOD o_grid_container->free.
      CALL METHOD o_grid1_container->free.
      CALL METHOD o_grid2_container->free.
      CALL METHOD cl_gui_cfw=>flush.
      IF sy-subrc NE 0.
        Error in FLush
      ENDIF.
      LEAVE TO SCREEN 0.
    ENDFORM.                  " EXIT_PROGRAM
    If u want get more idea revert back to me.
    Thanks & Regards,
    Judith.

Maybe you are looking for