ICON display in ALV output

Hi,
  I need to create a column that will have an icon ICON_DOCUMENT displayed in the column. Now, when i clik on this icon it should check for the existance of any links existing for a material , if so, then display those links . Basically this icon should dispaly the link to material drawings . How do i include the icon in the output column in ALV?
Thanks,
Sindhu.

hi,
Sample code is ::
report  zalvexer2  message-id zz                       .
*& TABLES DECLARATION                                                  *
tables: vbak.
*& TYPE POOLS DECLARATION                                              *
type-pools: slis.
*& INTERNAL TABLE DECLARATION                                          *
data: begin of itab occurs 0,
       icon type icon-id,
       vbeln like vbak-vbeln,
       audat like vbak-audat,
       vbtyp like vbak-vbtyp,
       auart like vbak-auart,
       augru like vbak-augru,
       netwr like vbak-netwr,
       waerk like vbak-waerk,
    end of itab.
*INTERNAL TABLE FOR FIELD CATALOG
data: wa_fieldcat type slis_fieldcat_alv,
    it_fieldcat type slis_t_fieldcat_alv.
IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV
           WITH HEADER LINE,
*INTERNAL TABLE FOR EVENTS
data:    it_event type slis_t_event,
      wa_event type slis_alv_event,
*INTERNAL TABLE FOR SORTING
      it_sort type slis_t_sortinfo_alv,
      wa_sort type slis_sortinfo_alv,
*INTERNAL TABLE FOR LAYOUT
      wa_layout type slis_layout_alv.
*& VARIABLE DECLARATION                                                *
data : v_repid type sy-repid,
       v_pagno(4) type n,
       v_date(8)  type c.
*& CONSTANTS                                                           *
constants: c_x type c value 'X'.
*& SELECTION SCREEN                                                    *
selection-screen: begin of block b1 with frame title text-001.
select-options: s_vbeln for vbak-vbeln,
                s_vbtyp for vbak-vbtyp default 'C'.
selection-screen: end of block b1.
selection-screen: begin of block b2 with frame title text-002.
selection-screen : begin of line.
selection-screen  comment 1(20) text-003.
parameters: p_list radiobutton group rad1 default 'X'.
selection-screen : end of line.
selection-screen : begin of line.
selection-screen comment 1(20) text-004.
parameters: p_grid radiobutton group rad1.
selection-screen : end of line.
selection-screen: end of block b2.
at selection-screen.
  perform validate_screen.
*& START OF SELECTION                                               *
start-of-selection.
  clear: itab, itab[].
V_REPID = SY-REPID.
  perform get_data.
  perform display_data.
*& END OF SELECTION                                                    *
end-of-selection.
*--DO ALV Process
  v_repid = sy-repid.
*--Sort the Output Fields
  perform sort_fields.
*--Build Field catalog for the Output fields
PERFORM BUILD_FIELDCAT.
*--Set the Layout for ALV
  perform set_layout.
*&      Form  GET_DATA
      text
TO GET THE DATA FROM TABLES INTO ITAB
form get_data .
  select vbeln
         audat
         vbtyp
         auart
         augru
         netwr
         waerk
         into corresponding fields of table itab
         from vbak
         where vbeln in s_vbeln and
         audat > '04.04.2005'
         and netwr > 0.
  <b>loop at itab.
    if itab-netwr < 10000.
      itab-icon = '@08@'.
    elseif itab-netwr > 10000 and itab-netwr < 100000.
      itab-icon = '@09@'.
    elseif itab-netwr > 100000.
      itab-icon = '@0A@'.
    endif.
    modify itab index sy-tabix.
  endloop.</b>
endform.                    " GET_DATA
*&      Form  sort_fields
form sort_fields .
  clear wa_sort.
  wa_sort-fieldname = 'VBTYP'.
  wa_sort-spos = '1'.
  wa_sort-up = 'X'.
  append wa_sort to it_sort.
  clear wa_sort.
  wa_sort-fieldname = 'NETWR'.
  wa_sort-spos = '2'.
  wa_sort-up = 'X'.
  wa_sort-subtot = 'X'.
  append wa_sort to it_sort.
endform.                    " sort_fields
*&      Form  set_layout
form set_layout .
  if p_list = c_x .
    wa_layout-window_titlebar = 'LIST DISPLAY'(016).
    wa_layout-zebra = 'X'.
*-- ALV LIST DISPLAY
    perform list_display tables itab.
*-- ALV GRID DISPLAY
  elseif p_grid = c_x.
    wa_layout-window_titlebar = 'GRID DISPLAY'(017).
    wa_layout-zebra = 'X'.
    perform grid_display tables itab.
  endif.
endform.                    " set_layout
*&      Form  list_display
form list_display  tables   p_itab .
  call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
      i_callback_program = v_repid
      is_layout          = wa_layout
      it_fieldcat        = it_fieldcat[]
      it_sort            = it_sort[]
      i_save             = 'U'
    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.
endform.                    " list_display
*&      Form  GRID_DISPLAY
form grid_display  tables   p_itab .
  call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
      i_callback_program = v_repid
      is_layout          = wa_layout
      it_fieldcat        = it_fieldcat[]
      it_sort            = it_sort[]
      it_events          = it_event
    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.
endform.                    " GRID_DISPLAY
*&      Form  VALIDATE_SCREEN
      text
-->  p1        text
<--  p2        text
form validate_screen .
  data: lv_vbeln like vbak-vbeln.
  if not s_vbeln is initial.
    select vbeln
    into lv_vbeln
    up to 1 rows
    from vbak
    where vbeln in s_vbeln.
    endselect.
    if sy-subrc <> 0.
      message e000 with 'INVALID SALES DOC'.
    endif.
  endif.
endform.                    " VALIDATE_SCREEN
*&      Form  display_data
      text
-->  p1        text
<--  p2        text
form display_data .
  define m_fieldcat.
    add 1 to wa_fieldcat-col_pos.
    wa_fieldcat-fieldname   = &1.
    wa_fieldcat-ref_tabname = 'VBAK'.
    wa_fieldcat-do_sum      = &2.
    wa_fieldcat-cfieldname  = &3.
    append wa_fieldcat to it_fieldcat.
  end-of-definition.
data:
    ls_fieldcat type slis_fieldcat_alv,
    lt_fieldcat type slis_t_fieldcat_alv.
  m_fieldcat 'ICON' ''  ''.
  m_fieldcat 'VBELN' ''  ''.
  m_fieldcat 'AUDAT' ''  ''.
  m_fieldcat 'VBTYP' ''  ''.
  m_fieldcat 'AUART' ''  ''.
  m_fieldcat 'AUGRU' ''  ''.
  m_fieldcat 'NETWR' 'C' 'WAERK'.
  m_fieldcat 'WAERK' ''  ''.
endform.                    " display_data[/code]
Message was edited by: Ashok Parupalli
Message was edited by: Ashok Parupalli

Similar Messages

  • Field of character length 255 not displaying in ALV output

    Dear all,
    i am trying to display a field of ztable with lenght 255 character, same is not displaying at ALV output.
    it is displaying only upto 128 characters in ALV output.
    table is Ztable-zfield with CHAR255 length.
    please help me.
    Regards,
    Sam.

    Hi Sam Johny,
    In ALV Grid the maximum characters can be displayed in one column is 128 Characters..
    But for your solution you can press Print Preview Button to view more text(or Press Ctrl + Shift + F10 )...
    Else try with ALV LIST
    and pass FIELDCAT-OUTPUTLEN = '255' for field in fieldcatalog
    Hope it will solve your problem..
    Thanks & Regards
    ilesh 24x7
    ilesh Nandaniya

  • Newly added field not getting displayed in ALV output

    Hi All,
       I'm adding one more field/column to be displayed in an old existing program that uses REUSE_ALV_FIELDCATALOG_MERGE to generate the ALV fieldcat.
    DATA: BEGIN OF it_salary OCCURS 0,
            pernr LIKE pa0000-pernr,
            ename LIKE pa0001-ename,
            rtext like lv_rtext, -
    added field
            waers LIKE pa0008-waers
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = driver
          i_internal_tabname     = 'IT_SALARY'
          i_client_never_display = 'X'
          i_inclname             = driver
        CHANGING
          ct_fieldcat            = lv_fieldcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program      = driver
          it_fieldcat             = lv_fieldcat[]
          i_default               = 'X'
          i_save                  = 'A'
          is_variant              = lv_tmplt
          is_layout               = lv_ls_layout
         i_callback_user_command = 'USER_COMMAND'
        TABLES
          t_outtab                = it_salary
        EXCEPTIONS
          program_error           = 1
          OTHERS                  = 2.
    The newly added field is not getting populated in the lv_fieldcat table. Tried running programs BALVBUFDEL,
    BCALV_BUFFER_DEL_SHARED then logging off and logging in but of no help.
    Please provide suggestion for this issue.
    Regards,
    Sridevi S

    Hi,
    Fieldcat is buffered - so use
    I_BYPASSING_BUFFER = 'X'
    Since a while CL_GUI_ALV_GRID is available which does NOT need any fieldcat (is determined internally using RTTI). It is worth playing around whith this class if you have some time. This class is recommended for ALV Output by SAP (but no edit is possible - was never supported officially).
    A simple use would be:
    data: gt_output type standard table of (adjust!).
    *simple ALV output
    data go_alv type ref to cl_salv_table.
    data go_functions type ref to cl_salv_functions_list.
    data go_columns type ref to cl_salv_columns_table.
    data go_column type ref to cl_salv_column_table.
    *Exceprion handlig
    data: go_exception  type ref to cx_root,
          gv_errortext   type string.
    ** fill table gt_output ...
    ** ALV output
    if not gt_output is initial.
        try.
            call method cl_salv_table=>factory
              importing
                r_salv_table = go_alv
              changing
                t_table      = gt_output.
          catch cx_salv_msg into go_exception.
            gv_errortext = go_exception->get_text( ).
            message gv_errortext type 'A'.
        endtry.
    * enable all standard ALV functions
        go_functions =  go_alv->get_functions( ).
        go_functions->set_all( ).
    * hide MANDT
        go_columns = go_alv->get_columns( ).
        go_column ?=  go_columns->get_column( columnname = 'MANDT' ).
        go_column->set_technical( ).
        go_alv->display( ).
    Kind regards,
    Holger

  • Query on display the Alv output,...................its urgent pls help

    hi friends,
        Here is my query on a Alv Report output display
      I have two internal tables i_vbak and i_vbap
    i_vbak contains the fields and value as
    vbeln     kunnr    auart  audat                   bstnk   vkorg
    1000066         1000071  ze0r   20070918       Itest1     PA11
    1000067         1000072  ze0r   20070919       SLA-Test1  PA11
    i_vbap contains the field and value as
    VBELN             MATNR             ARKTX
    1000066    SAMPLE MATERIAL1   Sample Material for reports
    1000066    SAMPLE MATERIAL    Sample Material for reports
    1000066    TEST   MATERIAL       Test Material for reports
    1000067    SAMPLE MATERIAL    Sample Material for reports
    1000067    TEST MATERIAL         Test Material for reports
    1000067    SAMPLE MATERIAL1   Sample Material for reports
    I have a another internal table called inv_final which contain all these fields and respective values to display in the alv output.Here i am giving only two field how it whould come in alv output.
    Sold to Patry(kunnr)  Sales Doc No(vbap-vbeln)    Material Name(matnr)
    1000071                  1000066                  Sample Material1
    1000071                  1000066                  Sample Material
    1000071                  1000066                  Test Material
    1000072                  1000067                  Sample Material 
    1000072                  1000067                  Test Material
    1000072                  1000067                  Sample Material1
    If anybody have done similay kind of repore than help me with the code,or else if anybody having any idea to solve this out than help me.I have only prob with the logic bofore the final table display in the alv output.
    Helpful answer will be rewardad generously.
    Thanks a lot
    mrutyun^

    Hi
    Put all the fields in to an internal table and disply only your required fields.
    Kuntal

  • Icon display in alv report

    Hi all,
           I have a problem in alv report ,there are 5 fields to display and in 6th position i have to display an icon as red or green light according to data. How can i do that ? please help me .
    Thanks and regards
    Goutam

    Hi goutam,
    1. Simple
    2. we have to use the layout for this purpose.
    3. like this :
      alvly-lights_fieldname = 'LT'.
      alvly-lights_tabname = 'ITAB'.
    4. Just copy paste to get a taste of it.
      (important code has been highlighted)
    REPORT abc.
    TYPE-POOLS : slis.
    DATA : alvly TYPE slis_layout_alv.
    DATA : alvfc TYPE slis_t_fieldcat_alv.
    DATA : BEGIN OF itab OCCURS 0,
    <b>       lt TYPE i,</b>
           matnr LIKE mara-matnr,
           END OF itab.
    END-OF-SELECTION.
    <b>  itab-lt = 1.
      APPEND itab.
      itab-lt = 2.
      APPEND itab.
      itab-lt = 3.
      APPEND itab.
      itab-lt = 1.
      APPEND itab.
      itab-lt = 3.
      APPEND itab.
      itab-lt = 3.
      APPEND itab.
      itab-lt = 3.
      APPEND itab.</b>
    <b>  alvly-lights_fieldname = 'LT'.
      alvly-lights_tabname = 'ITAB'.</b>
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name     = sy-repid
          i_internal_tabname = 'ITAB'
          i_inclname         = sy-repid
        CHANGING
          ct_fieldcat        = alvfc.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = sy-repid
          it_fieldcat        = alvfc
          is_layout          = alvly
          i_save             = 'A'
        TABLES
          t_outtab           = itab.
    regards,
    amit m.

  • How to display the ALV output in a Group format

    Hello Experts,
    I have my current ALV report output like this:
    GROUP DESCRIPTION
    group1 adsfadsfadsfa
    group1 lkjadsfjlajdsfla
    group1 adsfadsfadsf
    group1 adsfadsfadfa
    group2 adsfadsfafaa
    group2 oiueworuowe
    group2 zxvzcxvzvcsd
    group2 oiuqoewruqw
    And I need to display the output of my ALV report in a group format like this:
    GROUP DESCRIPTION
    group1 adsfadsfadsfa
           lkjadsfjlajdsfla
           adsfadsfadsf
           adsfadsfadfa
    group2 adsfadsfafaa
           oiueworuowe
           zxvzcxvzvcsd
           oiuqoewruqw
    Can anybody please let me know if there is any sample program/thread/help etc.
    I grealty appreciate your help.
    Thanks.

    Hi Rainer,
    Thanks for the reply. I am using container for the ALV Display.
    So I wrote my code lie this:
    sort t_data by zgroup zdesc  ( t_data is my output internal table) .
    I have my ALV layout delcared like this:
    data: alv_layout type lvc_s_layo.
    So I have modified my code like this:
    alv_layout-NO_MERGING  = 'X'.
    But it did'nt work. Please let me know if I need make any other changes.
    Thanks again.

  • Avoid ALV output screen in submit statement

    hello,
    I have created one FM.in that FM i am calling one zreport using submit statement as i want to access that zreport's internal table.so i have done that using IMPORT and EXPORT statement and i am getting values in my FM.
    but my problem is when i execute that FM it stops and display the ALV output of zreport and then when i press back button it gives me FM's output.i dont want that ALV output.can anybody help me that how to omit this output screen?
    regards
    soniya s.

    Hi,
    Use option EXPORTING LIST TO MEMORY with statement SUBMIT.
    Regards,
    Nikhil
    Edited by: Nikhil Kayal on May 13, 2009 1:32 PM

  • Issue with ALV output in production

    Hi ,
    Iam using REUSE_ALV_GRID_DISPLAY function module to display the alv output.
    But the ALV is not displaying the data in production, where as it is working fine in Development and Quality.
    I have checked the version there is no change.
    Please advice how to fix this issue?

    I have checked all the Transport request for this particular report,
    Even i did the Version management .
    I didnt find any change in the versiopn management.
    We didnt miss any Transport related to this Report.
    Please see my coding for the same.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
       I_CALLBACK_PROGRAM                = V_REPID
       I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         IS_LAYOUT                         = V_ALV_LAYOUT
         IT_FIELDCAT                       = V_ALV_FIELDCAT
         I_DEFAULT                         = C_X
       I_SAVE                            = 'A'
       IT_EVENTS                         = V_ALV_EVENTS
        TABLES
          T_OUTTAB                          = IT_FINAL[]
       EXCEPTIONS
         PROGRAM_ERROR                     = 1
         OTHERS                            = 2 .
      IF SY-SUBRC <> 0.
    Edited by: vinay raj on Nov 23, 2010 11:34 AM

  • F4 help to ALV output Field

    Hi  All,
    I am displaying an ALV output using class. In the output list, i have added one push button 'ADD'. If user clicks on this button, new line should be available to enter the data. This is working fine.
    Now i want to give an F4 help for a column for which values is to be generated in the program. I have an internal table with values which is to be displayed when user clicks on that column.
    This is very urgent.
    Pls. suggest me.
    best regards,

    Hi,
    Linking F4 Help to Fields
    For the last section, we will deal with linking F4 help to fields. It is easy. As usual, define, implement and register the event “onf4” at proper places in your code. For F4 help, you must register the fields whose F4 request will trigger the “onf4” event. For this you must prepare a table of type “LVC_T_F4” and register this table using the method “register_f4_for_fields”. While preparing table you must include a line for each field which will trigger F4 event. For each field in the structure;
    Pass the fieldname to ‘FIELDNAME’
    Set ‘REGISTER’ to make the field registered,
    Set ‘GETBEFORE’ to provide field content transport before F4 in editable mode
    Set ‘CHNGEAFTER’ to make the data changed after F4 in editable mode.
    Preparing table for the fields to be registered to trigger F4 event
    DATA: lt_f4 TYPE lvc_t_f4 WITH HEADER LINE .
    lt_f4-fieldname = 'PRICE'.
    lt_f4-register = 'X' .
    lt_f4-getbefore = 'X' .
    APPEND lt_f4 .
    CALL METHOD gr_alvgrid->register_f4_for_fields
    EXPORTING
    it_f4 = lt_f4[] .
    A sample “onf4” method implementation
    METHOD handle_on_f1 .
    PERFORM f4_help USING e_fieldname es_row_no .
    er_event_data->m_event_handled = 'X' .
    Again, we set the attribute “er_event_data->m_event_handled” to prevent further processing of standard F4 help.
    Regards,
    Ranjit Thakur.
    <b>Please Mark The Helpful Answer.</b>
    ENDMETHOD .

  • How to append leading spaces in ALV Output

    Hello Experts,
    Is it possible to append leading spaces in ALV Output? We want to have a functionality that will show the output like a hierarchy in a column.
    Thanks a lot for your help.
    Example:
    WBSElement
    WBSELEL01VL2
        WBSELEL01VL3A
             WBSELEL01VL4X
                 WBSELEL01VL5W
                 WBSELEL01VL5Z
             WBSELEL01VL4Y
                 WBSELEL01V5P
                 WBSELEL01V5Q
        WBSELEL01VL3B
             WBSELEL01VL4L
                 WBSELEL01VL5H
                 WBSELEL01VL5T
             WBSELEL01VL4M
                 WBSELEL01V5C
                 WBSELEL01V5D
    Edited by: sam jose on Dec 1, 2009 4:01 PM

    Thanks, Nilesh.
    Sorry for the delayed response. I have modified the ITAB with that logic and I see the indentation now (in Debug Mode of T_PLAN). 
    However, when I display the ALV output though, it disappears.
    I am using the following method.
    data: plan_control   type scrfname value 'TOOL',
          plan_container type ref to cl_gui_custom_container,
          plan_grid      type ref to cl_gui_alv_grid,
          plan_fieldcat  type lvc_t_fcat,
          plan_layout    type lvc_s_layo.
      if plan_container is initial.
        perform plan_fieldcat_init using plan_fieldcat[].
        create object plan_container
          exporting
            container_name = plan_control.
        create object plan_grid
          exporting
            i_parent = plan_container.
        plan_layout-cwidth_opt  = 'X'.
        plan_layout-zebra       = 'X'.
        call method plan_grid->set_table_for_first_display
          exporting
            is_layout                     = plan_layout
          changing
            it_outtab                     = T_PLAN[]
            it_fieldcatalog               = plan_fieldcat
          exceptions
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            others                        = 4.
      endif.
    Can anybody please let me know if I am missing anything?
    Thanks again.
    Edited by: sam jose on Dec 8, 2009 8:44 PM

  • Need ALV output in vietnamese language

    Hi,
    i need to display an ALV output using vietnamese language, without accent.
    can u tell me how to do this?
    Thanks in advance,
    Niyaz Ahamed

    Hi,
    I assume you want to display your data along with the column names & header in vietnamese. For this you have to translate the data if you have developed it in other language. You need to use text elements for the column names & header so that translation is possible. Please check if your SAP s/m provides Vietnamese language capability.
    Regards,
    Sharat

  • Sub total icon is not displaying in alv report output

    Hi friends ,
    In alv report display on menu bar the icon : subtotals is not displaying at the output , I should not give subtotal in each field catalog .
    Plz give me solution, points will be rewarded.
    with regards,
    prasad.

    Hi,
    I think u r using PF-STATUS parameter in function module,
    if u use this parameter, you sholud give the icon name etc..
    otherwise by default it will appear.
    Check your code again.
    Give me exact requirement, if possible paste the code.
    Regards,
    Chandu

  • How to display Long text in alv output

    Hi,
    I have developed an ALV report.It is displaying the output.
    There is another requirment for alv output text field as below
    From the long text fields show only the first 20 characters and afterwards the long text icon. If the icon is clicked open the long text display screen.
    Please give your suggestion how to work on this requirement.
    Thanks in advance

    Hi,
    Create a hotspot for the long text column of ALV.
    When user clicks on the hotspot, handle the event to display long text screen.
    You may refer sample program of hotspot ALV :
    Goto SE38
    Type BCALV*
    Click F4
    search for HOTSPOT or EVENTS & you will get a sample program.
    Best regards,
    Prashant

  • How to put up the traffic lights icon in the ALV Grid. OO output

    Hi all,
    I have a requriement that after all the report execution parts are done, i need to display the posted or unposted document using the Traffic light icon in the report output, i am displaying the report in ALV OO form and i already geta  field with a conent X of the document is posted else that field is blank currently.
    Regards

    Sample code here for this.
    *& Report  Z_50657_ALV_EX2                                             *
    *& Program Name: Test Program for ALV                                  *
    *  Developer Name: ADCDEV (Rahul Kavuri )                              *
    *  Description: ALV Report to Display Vendor Details                   *
    *& Date:7th April 2006                                                 *
    REPORT  Z_50657_ALV_EX2
            NO STANDARD PAGE HEADING
            LINE-COUNT 65(3)
            LINE-SIZE 220
            MESSAGE-ID ZZ.
    *                             Type Pools                               *
    TYPE-POOLS: SLIS, ICON.
    *                              Tables                                  *
    TABLES: VBAK. "Sales Document Data
    *                         Internal Tables                              *
    * TABLE TO HOLD DATA OF SALES DOCUMENT
    DATA: BEGIN OF IT_VBAK OCCURS 0,
          VBELN LIKE VBAK-VBELN, "Sales Document
          VBTYP LIKE VBAK-VBTYP, "SD document category
          AUDAT LIKE VBAK-AUDAT, "Document date (date received/sent)
          AUGRU LIKE VBAK-AUGRU, "Order reason (reason for the business)
          AUART LIKE VBAK-AUART, "Sales Document Type
          NETWR LIKE VBAK-NETWR, "Net Sales Order in Doc. Currency
          WAERK LIKE VBAK-WAERK, "SD document currency
          ICON TYPE ICON-ID,     "traffic lights
          END OF IT_VBAK.
    *                             Work Areas                               *
    *WORK AREAS DEFINED FOR ALV'S
    DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,      "field catalog
          IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,     "field catalog ITAB
          WA_SORT TYPE SLIS_SORTINFO_ALV,           "SORT work area
          IT_SORT TYPE SLIS_T_SORTINFO_ALV,         "SORT ITAB
          LAYOUT TYPE SLIS_LAYOUT_ALV,              "LAYOUT
          WA_FCODE TYPE SLIS_EXTAB,                 "FUN CODE
          I_FCODE_EXTAB TYPE SLIS_T_EXTAB,
          WA_EVENTS TYPE SLIS_ALV_EVENT,
          IT_EVENTS TYPE SLIS_T_EVENT.
    *                       Selection-Screen                               *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
    SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
    PARAMETERS: P_VBTYP LIKE VBAK-VBTYP DEFAULT 'C'.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
    PARAMETERS: LIST RADIOBUTTON GROUP G1,
                GRID RADIOBUTTON GROUP G1.
    SELECTION-SCREEN END OF BLOCK B2.
    *                     At  Selection-Screen                             *
    *VALIDATION
    *                       Start of Selection                             *
    START-OF-SELECTION.
    *POPULATION OF DATA INTO INTERNAL TABLE ITAB
      PERFORM GET_DATA.
    *DEFINE USER DEFINED FIELDCATALOG
      PERFORM DEFINE_FIELDCATALOG.
    *SUBTOTALS AND TOTALS DISPLAY USING SORT
      PERFORM SORT_LIST.
    *CHANGE FCODE OF STATUS
      PERFORM CHANGE_FCODE.
    *CHECK RADIOBUTTON OPTION AND ACCORDINGLY FINAL DISPLAY
      PERFORM CHECK_OPTION.
    *&      Form  GET_DATA
    *       text
    FORM GET_DATA.
      SELECT VBELN
             VBTYP
             AUDAT
             AUGRU
             AUART
             NETWR
             WAERK FROM VBAK INTO TABLE IT_VBAK
             WHERE VBELN IN S_VBELN AND VBTYP = P_VBTYP
             AND ERDAT > '01.01.2004' AND NETWR > 0.
      LOOP AT IT_VBAK.
        IF IT_VBAK-NETWR < 10000.
          IT_VBAK-ICON = '@08@'.
        ELSEIF IT_VBAK-NETWR > 100000.
          IT_VBAK-ICON = '@0A@'.
        ELSE.
          IT_VBAK-ICON = '@09@'.
        ENDIF.
        MODIFY IT_VBAK INDEX SY-TABIX.
      ENDLOOP.
    ENDFORM.                    "GET_DATA
    *&      Form  CHECK_OPTION
    *       text
    FORM CHECK_OPTION.
      WA_EVENTS-NAME = 'TOP_OF_PAGE'.
      WA_EVENTS-FORM = 'TOP'.
      APPEND WA_EVENTS TO IT_EVENTS.
      CLEAR WA_EVENTS.
      WA_EVENTS-NAME = 'END_OF_LIST'.
      WA_EVENTS-FORM = 'END_LIST'.
      APPEND WA_EVENTS TO IT_EVENTS.
      CLEAR WA_EVENTS.
      IF LIST = 'X'.
        PERFORM LIST_DISP.
      ENDIF.
      IF GRID = 'X'.
        PERFORM GRID_DISP.
      ENDIF.
    ENDFORM.                    "CHECK_OPTION
    *&      Form  DEFINE_FIELDCATALOG
    *       text
    FORM DEFINE_FIELDCATALOG.
      WA_FIELDCAT-COL_POS = 1.
      WA_FIELDCAT-FIELDNAME = 'ICON'.
      WA_FIELDCAT-SELTEXT_L = 'ICON'.
      WA_FIELDCAT-ICON = 'X'.
      WA_FIELDCAT-OUTPUTLEN = 8.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS = 2.
      WA_FIELDCAT-FIELDNAME = 'VBELN'.
      WA_FIELDCAT-SELTEXT_L = 'SALES DOC NO.'.
      WA_FIELDCAT-OUTPUTLEN = 10.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS = 3.
      WA_FIELDCAT-FIELDNAME = 'AUDAT'.
      WA_FIELDCAT-SELTEXT_L = 'CREATED ON'.
      WA_FIELDCAT-OUTPUTLEN = 10.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS = 4.
      WA_FIELDCAT-FIELDNAME = 'VBTYP'.
      WA_FIELDCAT-SELTEXT_L = 'CATEGORY'.
      WA_FIELDCAT-OUTPUTLEN = 1.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS = 6.
      WA_FIELDCAT-FIELDNAME = 'AUGRU'.
      WA_FIELDCAT-SELTEXT_L = 'REASON'.
      WA_FIELDCAT-OUTPUTLEN = 3.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS = 5.
      WA_FIELDCAT-FIELDNAME = 'AUART'.
      WA_FIELDCAT-SELTEXT_L = 'DOC TYPE'.
      WA_FIELDCAT-OUTPUTLEN = 4.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS = 7.
      WA_FIELDCAT-FIELDNAME = 'NETWR'.
      WA_FIELDCAT-SELTEXT_L = 'NET VALUE'.
      WA_FIELDCAT-OUTPUTLEN = 17.
      WA_FIELDCAT-DECIMALS_OUT = 2.
    *  WA_FIELDCAT-DO_SUM = 'X'.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS = 8.
      WA_FIELDCAT-FIELDNAME = 'WAERK'.
      WA_FIELDCAT-SELTEXT_L = 'UNIT'.
      WA_FIELDCAT-OUTPUTLEN = 50.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "DEFINE_FIELDCATALOG
    *&      Form  DEFINE_LAYOUT
    *       text
    FORM DEFINE_LAYOUT.
      LAYOUT-ZEBRA = 'X'.
      LAYOUT-SUBTOTALS_TEXT = 'SUBTOTAL SUM'.
      LAYOUT-WINDOW_TITLEBAR = 'EXERCISE 2'.
      LAYOUT-TOTALS_TEXT  = 'TOTAL'.
    ENDFORM.                    "DEFINE_LAYOUT
    *&      Form  SORT_LIST
    *       text
    FORM SORT_LIST.
      WA_SORT-FIELDNAME = 'VBELN'.
      WA_SORT-TABNAME = 'IT_VBAK'.
      WA_SORT-SPOS = 1.
      WA_SORT-UP = 'X'.
      WA_SORT-SUBTOT = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
      WA_SORT-FIELDNAME = 'NETWR'.
      WA_SORT-TABNAME = 'IT_VBAK'.
      WA_SORT-UP = 'X'.
      WA_SORT-SPOS = 2.
      WA_SORT-SUBTOT = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
    ENDFORM.                    "SORT_LIST
    *&      Form  LIST_DISP
    *       text
    FORM LIST_DISP.
      PERFORM DEFINE_LAYOUT.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM             = SY-REPID
         IT_FIELDCAT                    = IT_FIELDCAT
         IS_LAYOUT                      = LAYOUT
         IT_SORT                        = IT_SORT
         I_CALLBACK_PF_STATUS_SET       = 'STATUS'
         IT_EXCLUDING                   = I_FCODE_EXTAB
         I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'
         IT_EVENTS                      = IT_EVENTS[]
    *   IMPORTING
    *     E_EXIT_CAUSED_BY_CALLER        =
    *     ES_EXIT_CAUSED_BY_USER         =
        TABLES
         T_OUTTAB                       = IT_VBAK
    *   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.                    "LIST_DISP
    *&      Form  GRID_DISP
    *       text
    FORM GRID_DISP.
      PERFORM DEFINE_LAYOUT.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = SY-REPID
          IS_LAYOUT                = LAYOUT
          IT_FIELDCAT              = IT_FIELDCAT
          IT_SORT                  = IT_SORT
          I_CALLBACK_PF_STATUS_SET = 'STATUS'
          IT_EXCLUDING             = I_FCODE_EXTAB
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
          IT_EVENTS                = IT_EVENTS[]
        TABLES
          T_OUTTAB                 = IT_VBAK.
    * 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.                    "GRID_DISP
    *&      Form  STATUS
    *       text
    *      -->P_EXTAB    text
    FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STATUS' EXCLUDING P_EXTAB.
    ENDFORM.                    "STATUS
    *&      Form  USER_COMMAND
    *       text
    *      -->R_UCOMM      text
    *      -->RS_SELFIELD  text
    FORM USER_COMMAND USING R_UCOMM     LIKE SY-UCOMM
                                   RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN 'BACK' OR 'CANC' OR 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN '&IC1'.
          SET PARAMETER ID 'AUN' FIELD RS_SELFIELD-VALUE.
          CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    *&      Form  CHANGE_FCODE
    *       text
    FORM CHANGE_FCODE.
      WA_FCODE = 'PRNT'.
      APPEND WA_FCODE TO I_FCODE_EXTAB.
      WA_FCODE = '&OAD'.
      APPEND WA_FCODE TO I_FCODE_EXTAB.
      WA_FCODE = '&AVE'.
      APPEND WA_FCODE TO I_FCODE_EXTAB.
      WA_FCODE = '&EB9'.
      APPEND WA_FCODE TO I_FCODE_EXTAB.
      WA_FCODE = '&SUM'.
      APPEND WA_FCODE TO I_FCODE_EXTAB.
      WA_FCODE = '&UMC'.
      APPEND WA_FCODE TO I_FCODE_EXTAB.
      WA_FCODE = '&XPA'.
      APPEND WA_FCODE TO I_FCODE_EXTAB.
      WA_FCODE = '&OMP'.
      APPEND WA_FCODE TO I_FCODE_EXTAB.
    ENDFORM.                    "CHANGE_FCODE
    *&      Form  TOP
    *       text
    FORM TOP.
      IF LIST = 'X'.
        WRITE:/ SY-ULINE.
        WRITE:/ 'DATE:', SY-DATUM,55 'INTELLIGROUP ASIA PVT LTD'.
        WRITE:/ 'TIME:', SY-UZEIT.
        WRITE:/ 'USER NAME:', SY-UNAME,60 SY-TITLE.
        WRITE:/ 'PAGE', SY-PAGNO.
        WRITE:/ SY-ULINE.
      ENDIF.
      IF GRID = 'X'.
        DATA: LS_LINE TYPE SLIS_LISTHEADER,
              E04_LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
    *   Listenüberschrift: Typ H
        CLEAR LS_LINE.
        LS_LINE-TYP  = 'H'.
    *   LS_LINE-KEY:  not used for this type
        LS_LINE-INFO = 'Summary'.
        APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
    *   Kopfinfo: Typ S
        CLEAR LS_LINE.
        LS_LINE-TYP  = 'S'.
        LS_LINE-KEY  = 'Intelligroup'.
        LS_LINE-INFO = ''.
        APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
        LS_LINE-KEY  = 'ASIA'.
        LS_LINE-INFO = 'PVT LTD'.
        APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
    *   Aktionsinfo: Typ A
        CLEAR LS_LINE.
        LS_LINE-TYP  = 'A'.
    *   LS_LINE-KEY:  not used for this type
        LS_LINE-INFO = 'truman'.
        APPEND LS_LINE TO  E04_LT_TOP_OF_PAGE.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
            IT_LIST_COMMENTARY = E04_LT_TOP_OF_PAGE
            I_LOGO             = 'ENJOY_SAP_LOGO'.
      ENDIF.
    ENDFORM.                    "TOP
    *&      Form  END_LIST
    *       text
    FORM END_LIST.
      IF LIST = 'X'.
        SKIP 2.
        WRITE:/60 'END OF PAGE'.
      ENDIF.
      IF GRID = 'X'.
          DATA: LS_LINE TYPE SLIS_LISTHEADER,
              E04_LT_END_OF_LIST TYPE SLIS_T_LISTHEADER.
    *   Listenüberschrift: Typ H
        CLEAR LS_LINE.
        LS_LINE-TYP  = 'H'.
    *   LS_LINE-KEY:  not used for this type
        LS_LINE-INFO = 'Summary'.
        APPEND LS_LINE TO E04_LT_END_OF_LIST.
    *   Kopfinfo: Typ S
        CLEAR LS_LINE.
        LS_LINE-TYP  = 'S'.
        LS_LINE-KEY  = 'Intelligroup'.
        LS_LINE-INFO = ''.
        APPEND LS_LINE TO E04_LT_END_OF_LIST.
        LS_LINE-KEY  = 'ASIA'.
        LS_LINE-INFO = 'PVT LTD'.
        APPEND LS_LINE TO E04_LT_END_OF_LIST.
    *   Aktionsinfo: Typ A
        CLEAR LS_LINE.
        LS_LINE-TYP  = 'A'.
    *   LS_LINE-KEY:  not used for this type
        LS_LINE-INFO = TEXT-105.
        APPEND LS_LINE TO  E04_LT_END_OF_LIST.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
            IT_LIST_COMMENTARY = E04_LT_END_OF_LIST.
      ENDIF.
    ENDFORM.                    "END_LIST

  • Total is not getting displayed in the ALV output.

    Hi,
    Total is not getting displayed in the ALV output.
    I m using :REUSE_ALV_BLOCK_LIST_APPEND & REUSE_ALV_BLOCK_LIST_DISPLAY
    Are  there any issues with it as the same settings are working fine with REUSE_ALV_LIST_DISPLAY
    source code:
    DATA: layout TYPE slis_layout_alv,
          IT_eventS  TYPE slis_t_event,
          fcat   TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          rec_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    TYPES: BEGIN OF ty_tab,
          belnr TYPE dberchz-belnr,
          belzart TYPE dberchz-belzart,
          net TYPE dberchz-nettobtr,
          END OF ty_tab.
    DATA: lt_tab TYPE STANDARD TABLE OF ty_tab.
    SELECT belnr belzart nettobtr
      FROM dberchz
      INTO TABLE lt_tab[]
    WHERE belnr eq '000000000001'.
      if sy-subrc ne 0.
      ENDIF.
    *  defining layout
    layout-colwidth_optimize = 'X'.
    layout-def_status = 'X'.
    *defning event
    *event
    *defining field catalog
    fcat-col_pos = 1.
    fcat-fieldname = 'BELNR'.
    fcat-tabname  = 'LT_TAB'.
    APPEND fcat.
    fcat-col_pos = 2.
    fcat-fieldname = 'BELZART'.
    fcat-tabname  = 'LT_TAB'.
    APPEND fcat.
    fcat-col_pos = 3.
    fcat-fieldname = 'NET'.
    fcat-tabname  = 'LT_TAB'.
    fcat-do_sum = 'X'.
    APPEND fcat.
    *calling alv
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
      EXPORTING
        i_callback_program             = 'YZ_PLR'
    *   I_CALLBACK_PF_STATUS_SET       = ' '
    *   I_CALLBACK_USER_COMMAND        = ' '
    *   IT_EXCLUDING                   =
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
      EXPORTING
        is_layout                        = layout
        it_fieldcat                      = fcat[]
        i_tabname                        = 'LT_TAB'
        it_events                        = IT_EVENTS[]
    *   IT_SORT                          =
    *   I_TEXT                           = ' '
      tables
        t_outtab                         = lt_tab[]
    * EXCEPTIONS
    *   PROGRAM_ERROR                    = 1
    *   MAXIMUM_OF_APPENDS_REACHED       = 2
    *   OTHERS                           = 3
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
    Thanks,
    Gaurav

    Hi
    No I don't think, this is my code (based on your code) and it works fine:
    TYPE-POOLS SLIS.
    DATA: BEGIN OF LT_TAB OCCURS 0,
           BELNR LIKE BSEG-BELNR,
           GJAHR LIKE BSEG-GJAHR,
           WRBTR LIKE BSEG-WRBTR,
           WAERS LIKE BKPF-WAERS,
          END OF LT_TAB.
    DATA: LAYOUT     TYPE SLIS_LAYOUT_ALV,
          IT_EVENTS  TYPE SLIS_T_EVENT,
          FCAT       TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
          REC_FCAT   TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
    START-OF-SELECTION.
      FCAT-COL_POS       = 1.
      FCAT-FIELDNAME     = 'BELNR'.
      FCAT-TABNAME       = 'LT_TAB'.
      FCAT-REF_FIELDNAME = 'BELNR'.
      FCAT-REF_TABNAME   = 'BSEG'.
      APPEND FCAT.
      FCAT-COL_POS       = 2.
      FCAT-FIELDNAME     = 'GJAHR'.
      FCAT-TABNAME       = 'LT_TAB'.
      FCAT-REF_FIELDNAME = 'GJAHR'.
      FCAT-REF_TABNAME   = 'BSEG'.
      APPEND FCAT.
      FCAT-COL_POS       = 3.
      FCAT-FIELDNAME     = 'WRBTR'.
      FCAT-TABNAME       = 'LT_TAB'.
      FCAT-CFIELDNAME    = 'WAERS'.
      FCAT-REF_FIELDNAME = 'WRBTR'.
      FCAT-REF_TABNAME   = 'BSEG'.
      FCAT-DO_SUM        = 'X'.
      APPEND FCAT.
      FCAT-COL_POS       = 4.
      FCAT-FIELDNAME     = 'WAERS'.
      FCAT-TABNAME       = 'LT_TAB'.
      FCAT-REF_FIELDNAME = 'WAERS'.
      FCAT-REF_TABNAME   = 'BKPF'.
      FCAT-DO_SUM        = SPACE.
      APPEND FCAT.
      SELECT * FROM BSEG INTO CORRESPONDING FIELDS OF TABLE LT_TAB
        WHERE BUKRS = 'MAAB'
          AND BELNR = '0000000001'.
      LT_TAB-WAERS = 'EUR'.
      MODIFY LT_TAB FROM LT_TAB TRANSPORTING WAERS WHERE WAERS = SPACE.
    *CALLING ALV
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
        EXPORTING
          I_CALLBACK_PROGRAM = 'ZPROVAMAX5'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          IS_LAYOUT   = LAYOUT
          IT_FIELDCAT = FCAT[]
          I_TABNAME   = 'LT_TAB'
          IT_EVENTS   = IT_EVENTS[]
        TABLES
          T_OUTTAB    = LT_TAB[].
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
    I've also inserted a currency field
    Max

Maybe you are looking for