ALV GRID: Sub Total of a field

Hi All,
Currently I am getting O/P in the following format:
CURRENCY    QUANTITY    VALUE
    GBP                 1               10
    GBP                 2               15
     INR                 1                12
I want the output to be:  
CURRENCY    QUANTITY    VALUE
    GBP                 1               10
    GBP                 2               15
    GBP                                     25
    INR                 1                12
    INR                                       12
I have already tried with:
wa_fieldcatalog-fieldname  = 'VALUE'.
wa_fieldcatalog-do_sum = 'X'.
and,
clear wa_sort.
wa_sort-spos      = 1.
wa_sort-fieldname = 'VALUE'.
wa_sort-expa = 'X'.
wa_sort-subtot = 'X'.
wa_sort-up = 'X'.
append wa_sort to t_sort
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = sy-repid
      is_layout       = t_layout
      it_fieldcat      = wa_fieldcatalog[]
      it_sort           = t_sort[]
      i_save           = 'A'
      it_events       = t_events[]
    TABLES
      t_outtab        = ts_final_output[]
    EXCEPTIONS
      program_error      = 1
      OTHERS             = 2.
It's still not working. Request u all to plz help
Edited by: Ajoy Chakraborty on Jan 23, 2009 11:43 AM

Hello Ajoy,
You can do like this..
  wa_field-fieldname = 'MENGE'.
  wa_field-tabname = 'IT_TAB'.
  wa_field-outputlen = 20.
  wa_field-seltext_l ='Quantity'.
  wa_field-input = ' '.
  wa_field-edit = ' '.
  wa_field-col_pos = '4'.
  wa_field-hotspot = 'X'.
  wa_field-do_sum = 'X'.   " In the field catalog suppose you want the subtotal of this field
  APPEND wa_field TO it_field.
CLEAR wa_field.
  wa_field-fieldname = 'WERKS'.
  wa_field-tabname = 'IT_TAB'.
  wa_field-outputlen = 20.
  wa_field-col_pos = '5'.
  wa_field-seltext_l ='Plant'.
wa_field-input = 'X'.
  wa_field-edit = 'X'.
APPEND wa_field TO it_field.
CLEAR wa_field.
*Manintainig internal table for sorting
wa_sort-spos = 1.
  wa_sort-fieldname = 'EBELP'.
  wa_sort-tabname = 'IT_tab'.
  wa_sort-up = 'X'.
  wa_sort-subtot = 'X'.   " this works like an T New for this field that is on every new value of this field ,  Subtotal will get calculated through above field catalog.
  APPEND wa_sort TO itab_sort.
  CLEAR wa_sort.
Hope it helps you
Regards
Mansi

Similar Messages

  • ALV Grid sub total issue

    Hi SAP Experts,
    Currently I have ALV Grid table as below as example :
    FIELD1
    FIELD2
    Account
    Amount
    1. Rev
    1.Rev
    Acct1
    100.00
    1. Rev
    1.Rev
    Acct2
    50.00
    Subtotal FIELD2 (1.Rev)
    150.00
    Subtotal FIELD1 (1.Rev)
    150.00
    2. Cost
    2.1 Cost1
    Acct3
    100.00
    2. Cost
    2.1 Cost1
    Acct4
    75.00
    Subtotal FIELD2  (2.1 Cost1)
    175.00
    2. Cost
    2.2 Cost2
    Acct5
    25.00
    Subtotal FIELD2 (2.2 Cost 2)
    25.00
    | Subtotal FIELD1 (2.Cost)                | 200.00             |          
    I have 2 questions.
    First, as you can see, I have 2 subtotal for 1.Rev eventhough 1.Rev actually only need one subtotal because there is no subgroup for 1.Rev. Is it possible to have only one subtotal for this 1.Rev but I still maintained 2 subtotal for 2.Cost because 2.Cost has subgroup?
    My 2nd issue is I need to insert another row exactly below Subtotal FIELD1 (2.Cost) row like this:
    Gross Margin
    (Some formula)
    This row does not come from any sub total. The problem is I can not just insert this column and put Gross Margin description in FIELD1 because I will have 3 row like below :
    Gross Margin
    (Formula)
    Subtotal FIELD2 (blank)
    (Formula) sub total
    Subtotal FIELD1 (Gross Margin)
    (Formula) sub total
    Is there any way I can insert Gross Margin Row without creating new subtotal for it so it will only have one line in the ALV Grid table? Please help. Thank you.
    Regards,
    Abraham

    Hi Vijay.
    I'm not posting this before I search everywhere and this is not the first time I post in this forum so I know what I should do before posting. If I miss something, maybe you can give me at least a hint whether it can be done or not.
    This report that I am using is ALV Grid using REUSE_ALV_GRID_DISPLAY function module and not OOP using dialog module. I never said I need sample code because I only want to know is there a way to do that using ALV Grid which until now I will say that SAP ALV grid has this limitation where you can not insert row without including it in the subtotal.
    So, I would be very thankful if someone can give me some clarity on this thing and Vijay, if you really don't know what is the answer, I really appreciate if you can hold your self from making that kind of reply. It does not need experienced ABAP Consultant to write such remarks. Thanks.
    Regards,
    Abraham

  • ALV grid sub-totals

    Hi All,
          I have written a code to show sub totals in ALV.
    But, is there any way by which I can show *Only the sub total
    lines* and not the individual line items that form the sub total ?
    e.g.:-
    KeyField1  KeyField2  Field1  Field2
    A                  1             10       12
    A                  1             15         8
    SUBTOTAL                 25       20
    B                  2             15       12
    SUBTOTAL                 15       12
    C                  1             10         8
    C                  2               8        12
    C                  3               7         2
    SUBTOTAL                  25       22
    Now I want only the SUBTOTAL rows to be visible in ALV not the individual rows as follows :-
    KeyField1  KeyField2  Field1  Field2
    SUBTOTAL                 25       20
    SUBTOTAL                 15       12
    SUBTOTAL                  25       22
    Regards,
    Ashish

    hi check this..in this only subtotals are shown if u click on the subtotal it will show the detailed list for that subtotal..
    *& Report  ZVG_ALV_SLIST2                                              *
    report  zvg_alv_slist2                          .
    ALV
    type-pools: slis.
    G L O B A L   I N T E R N  A L   T A B L E S
    data: gt_fieldcat type slis_t_fieldcat_alv,
          gs_layout   type slis_layout_alv,
          gt_events   type slis_t_event.
    data: it_sort type slis_t_sortinfo_alv ,
          wa_sort type slis_sortinfo_alv .
    data: gs_print type slis_print_alv.
    data: begin of it_sflight occurs 0,
            carrid     like sflight-carrid,
            connid     like sflight-connid,
            fldate     like sflight-fldate,
            price      like sflight-price,
            planetype  like sflight-planetype,
            seatsmax   like sflight-seatsmax,
            seatsocc   like sflight-seatsocc,
            paymentsum like sflight-paymentsum,
         end of it_sflight.
    *DATA: GI_SFLIGHT LIKE STANDARD TABLE OF ST_SFLIGHT.
    data: g_repid like sy-repid.
    data: gt_list_top_of_page type slis_t_listheader.
    data: v_total(5).
    start-of-selection.
      g_repid = sy-repid.
      perform init_fieldcat  using gt_fieldcat[].
      perform build_eventtab using gt_events[].
      perform build_comment  using gt_list_top_of_page[].
      perform get_data.
      perform set_layout using gs_layout.
    SORTING
      clear wa_sort.
      wa_sort-fieldname = 'CARRID'.
      wa_sort-up = 'X'.
      wa_sort-group = '*'.
      wa_sort-subtot = 'X'.
      append wa_sort to it_sort.
      clear wa_sort.
      wa_sort-fieldname = 'CONNID'.
      wa_sort-up = 'X'.
      wa_sort-group = 'UL'.
      wa_sort-subtot = 'X'.
      append wa_sort to it_sort.
    DISPLAY LIST
      call function 'REUSE_ALV_LIST_DISPLAY'
        exporting
          i_interface_check       = ' '
          i_callback_program      = g_repid
          i_callback_user_command = 'USER_COMMAND'
          is_layout               = gs_layout
          it_fieldcat             = gt_fieldcat[]
          it_sort                 = it_sort[]
          it_events               = gt_events
          is_print                = gs_print
        tables
          t_outtab                = it_sflight
        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.
    *&      Form  INIT_FIELDCAT
    form init_fieldcat using    p_gt_fieldcat type slis_t_fieldcat_alv.
      data: ls_fieldcat type slis_fieldcat_alv,
            l_index type sy-tabix.
      data :rep like sy-repid.
      rep = sy-repid.
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
        exporting
          i_program_name         = rep
          i_internal_tabname     = 'IT_SFLIGHT'
          i_inclname             = rep
        changing
          ct_fieldcat            = gt_fieldcat
        exceptions
          inconsistent_interface = 1
          program_error          = 2
          others                 = 3.
      if sy-subrc <> 0.
        message id sy-msgid type 'S' number sy-msgno
             with sy-msgv1 sy-msgv2 sy-msgv3 sy-subrc.
      endif.
      sort gt_fieldcat by col_pos.
      loop at gt_fieldcat into ls_fieldcat.
        l_index = sy-tabix.
        if ls_fieldcat-fieldname = 'PRICE'.
          ls_fieldcat-do_sum = 'X'.
          ls_fieldcat-sp_group = 'X'.
          modify gt_fieldcat from ls_fieldcat index l_index .
        endif.
      endloop.
    endform.                    " INIT_FIELDCAT
    *&      Form  BUILD_EVENTTAB
    form build_eventtab using  p_gt_events type slis_t_event.
      data: ls_event type slis_alv_event.
      clear ls_event.
      ls_event-name = slis_ev_top_of_page.
      ls_event-form = 'XTOP_OF_PAGE'.
      append ls_event to p_gt_events.
      clear ls_event.
      ls_event-name = slis_ev_top_of_list.
      ls_event-form = 'XTOP_OF_LIST'.
      append ls_event to p_gt_events.
      clear ls_event.
      clear ls_event.
      ls_event-name = slis_ev_end_of_page.
      ls_event-form = 'XEND_OF_PAGE'.
      append ls_event to p_gt_events.
      ls_event-name = slis_ev_end_of_list.
      ls_event-form = 'XEND_OF_LIST'.
      append ls_event to p_gt_events.
      clear ls_event.
    endform.                    " BUILD_EVENTTAB
    *&      Form  BUILD_COMMENT
    form build_comment using   p_gt_list_top_of_page type slis_t_listheader.
      data: ls_line type slis_listheader.
      ls_line-typ = 'H'." = Header, S = Selection, A = Action
      ls_line-key = 'KEY'.
      ls_line-info = 'INFO'.
      append ls_line to p_gt_list_top_of_page.
    endform.                    " BUILD_COMMENT
    *&      Form  SELECTION
    form get_data..
    data: l_rows type i value 3.
    Read data from table SFLIGHT
      select carrid
             connid
             fldate
             price
             planetype
             seatsmax
             seatsocc
             paymentsum
         from sflight
         into table it_sflight.
        up to l_rows rows.
      sort it_sflight.
    endform.                    " SELECTION
    *&      Form  SET_LAYOUT
    form set_layout using  p_gs_layout type slis_layout_alv.
    *  P_GS_LAYOUT-F2CODE            = P_F2CODE.
      p_gs_layout-zebra          = 'X'.
      p_gs_layout-colwidth_optimize = 'X'.
      p_gs_layout-no_input          = 'X'.
      p_gs_layout-no_colhead        = space.
      p_gs_layout-totals_text       = 'Total Price'.
      p_gs_layout-subtotals_text    = 'Sub Total'.
      p_gs_layout-totals_only       = 'X'.
      p_gs_layout-key_hotspot       = 'X'.
      p_gs_layout-detail_popup      = 'X'.
      p_gs_layout-no_subtotals      = space.
      p_gs_layout-expand_all        = 'X'.
      p_gs_layout-group_buttons     = 'X'."space.
    endform.                    " SET_LAYOUT
          FORM XTOP_OF_PAGE                                             *
    form xtop_of_page.
    data : lv_page(5),
            lv_text(20).
      MOVE SY-PAGNO TO LV_PAGE.
      write:/  'X_TOP_OF_PAGE'.
    endform.                    "xtop_of_page
          FORM XTOP_OF_LIST                                             *
    form xtop_of_list.
      write:/  'X_TOP_OF_LIST'.
    endform.                    "xtop_of_list
          FORM XEND_OF_PAGE                                             *
    form xend_of_page.
      write:/  'X_END_OF_PAGE'.
    endform.                    "xend_of_page
          FORM XEND_OF_LIST                                             *
    form xend_of_list.
      write:/  'X_END_OF_LIST'.
      data : lv_page(5),
             lv_text(20).
      data : l_lines type i,
             l_line  type i.
      clear v_total.
      write sy-pagno to v_total left-justified.
    export v_total to memory id 'V_TOTAL'.
      do sy-pagno times.
        lv_page = sy-index.
        concatenate 'Page' lv_page 'of' v_total
             into lv_text separated by space.
        if sy-index = 1.
          read line 2 of page sy-index.
        else.
          read line 1 of page sy-index.
       endif.
        sy-lisel+60(20) = lv_text.
          modify current line .
      enddo.
    endform.                    "xend_of_list
          USER_COMMAND                                             *
    form user_command  using r_ucomm like sy-ucomm
                              rs_selfield type slis_selfield.
      case r_ucomm.
        when 'EXIT'.
          leave to screen 0.
        when '&IC1'.
          data: text(256),text1(6),text2(5).
          move rs_selfield-tabindex to text1.
          move rs_selfield-sumindex to text2.
          concatenate  'Double clicked on (field:'
                        rs_selfield-fieldname
                        'Value:'
                        rs_selfield-value
                        text1
                        text2
                        into text
                        separated by space.
          call function 'POPUP_TO_DISPLAY_TEXT'
            exporting
              textline1 = text.
      endcase.
    endform.                    "user_command
    regards,
    venkat.

  • Alv Grid Sub Total

    Hi All
           I am have done an object in alv grid where it is working fine but what i want i am giving a sample please do let tell me how to do
    OUTPUT
    DATE       TIME-ENTRY  ACM-NO   CHARG    SHIFT   MACHINE-SPEED STANDARD-D    ACTUALL-DIPS   DOWNTIME-MINS  DOWN-TIME-IN%
    2009/08/23 00:45:41    ACMA01   910808   B             27.090      2,167           2,120              10            2.08
    2009/08/23 08:38:45    ACMA01   910808   C             27.090      2,167           1,459             157           32.71
                                    910808                             4,334           3,579             167
    2009/08/23 08:51:59    ACMA01   910809   C             27.090      2,167             141             449           93.54
    2009/08/23 17:24:39    ACMA01   910809   A             27.090      2,167           2,113              12            2.50
                                    910809                             4,334           2,254             461
    2009/08/23 00:48:56    ACMA02   920810   B             25.700      2,056           2,015              10            2.08
    2009/08/23 09:07:02    ACMA02   920810   C             25.700      2,056           2,043               3            0.63
    2009/08/23 17:27:04    ACMA02   920810   A             25.700      2,056             421             382           79.58
    2009/08/23 17:27:12    ACMA02   920810   A             25.700      2,056             421             382           79.58
                                    920810                             8,224           4,900             777
    2009/08/23 17:30:12    ACMA02   920811   A             25.700      2,056           1,335             168           35.00
                                    920811                             2,056           1,335             168
    In Down time in %  i want to do a bit of calculation
        X = 3579(ACCTUALL DIPS)/4334(STANDARD DIPS)    
        X = .0852 * 100 = 82.5 - 100
        X = -17.4%( This should display in DOWN-TIME-IN%)
    This will be Similar Calculation only number of lines will reduce to make it clear i gave in this way
    Waiting for Reply
    Thank's In Advance
    Sravya
    Edited by: Sravya Ch on Aug 24, 2009 7:41 AM

    Hi Rajihta
           I think you did not under stand what I want clearly
      DATE       TIME-ENTRY  ACM-NO   CHARG    SHIFT   MACHINE-SPEED STANDARD-D    ACTUALL-DIPS   DOWNTIME-MINS  DOWN-TIME-IN
      2009/08/23 00:45:41    ACMA01   910808   B             27.090      2,167           2,120              10            2.08
      2009/08/23 08:38:45    ACMA01   910808   C             27.090      2,167           1,459             157           32.71
    *                                 910808                             4,334           3,579             167            *17%*
    So how to do for  that 17% .i have just eneterd it now(every thing is from SAP other than that 17%)

  • Web Dynpro ALV grid sub totals

    Hi,
    I have managed to get totals working with web dynpro ALV using code like this :
      DATA: lr_field TYPE REF TO cl_salv_wd_field.
    For total calculations...
      lo_value->if_salv_wd_std_functions~set_aggregation_allowed( abap_true ).
      lr_field = lo_value->if_salv_wd_field_settings~get_field( 'N_OF_DLRS' ).
      lr_field->if_salv_wd_aggr~create_aggr_rule( aggregation_type = if_salv_wd_c_aggregation=>aggrtype_total ).
    Please can someone advise how i can do subtotals also.  Thanks
    Edited by: Samir Vora on Jul 15, 2009 12:40 PM

    Hi,
    For creating subtotals, you can have a look at following article:
    [Tutorial for Creation Subtotals using ALV|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-technology/wd%20abap/tutorial%20for%20creating%20totals%20and%20subtotals%20using%20alv.pdf].
    Hope this helps.
    Regards
    Manas Dua

  • ALV Display - sub totals

    hi gurus,
    In my report program i have a monthly report displaying the data for that month.
    1. Now in my ALV grid i want The SUB-TOTALS for the work center wise data for a field of the alv.  there are many workcenters data in my report.  So after the end of each work center , i want the subtotal of a calculated TAT field.
    2. At the end of the report, I want the average TAT(field calculated by my report program) for that month.
    So how can i make the coding for the above.
    Iam a fresher to this field, so give me in detail.
    regards,
    chaitanya

    Hi
    i am giving a sample example for subtotals of alv.
    REPORT z_alv_subtotal.
    *& Table declaration
    TABLES: EKKO.
    *& Type pool declaration
    TYPE-POOLS: SLIS. " Type pool for ALV
    *& Selection screen
    SELECT-OPTIONS: S_EBELN FOR EKKO-EBELN.
    *& Type declaration
    Type declaration for internal table to store EKPO data
    TYPES: BEGIN OF X_DATA,
    EBELN TYPE CHAR30, " Document no.
    EBELP TYPE EBELP, " Item no
    MATNR TYPE MATNR, " Material no
    MATNR1 TYPE MATNR, " Material no
    WERKS TYPE WERKS_D, " Plant
    WERKS1 TYPE WERKS_D, " Plant
    NTGEW TYPE ENTGE, " Net weight
    GEWE TYPE EGEWE, " Unit of weight
    END OF X_DATA.
    *& Internal table declaration
    DATA:
    Internal table to store EKPO data
    I_EKPO TYPE STANDARD TABLE OF X_DATA INITIAL SIZE 0,
    Internal table for storing field catalog information
    I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    Internal table for Top of Page info. in ALV Display
    I_ALV_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
    Internal table for ALV Display events
    I_EVENTS TYPE SLIS_T_EVENT,
    Internal table for storing ALV sort information
    I_SORT TYPE SLIS_T_SORTINFO_ALV,
    I_EVENT TYPE SLIS_T_EVENT.
    *& Work area declaration
    DATA:
    WA_EKKO TYPE X_DATA,
    WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
    WA_EVENTS TYPE SLIS_ALV_EVENT,
    WA_SORT TYPE SLIS_SORTINFO_ALV.
    *& Constant declaration
    CONSTANTS:
    C_HEADER TYPE CHAR1
    VALUE 'H', "Header in ALV
    C_ITEM TYPE CHAR1
    VALUE 'S'.
    *& Start-of-selection event
    START-OF-SELECTION.
    Select data from ekpo
    SELECT EBELN " Doc no
    EBELP " Item
    MATNR " Material
    MATNR " Material
    WERKS " Plant
    WERKS " Plant
    NTGEW " Quantity
    GEWEI " Unit
    FROM EKPO
    INTO TABLE I_EKPO
    WHERE EBELN IN S_EBELN
    AND NTGEW NE '0.00'.
    IF SY-SUBRC = 0.
    SORT I_EKPO BY EBELN EBELP MATNR .
    ENDIF.
    To build the Page header
    PERFORM SUB_BUILD_HEADER.
    To prepare field catalog
    PERFORM SUB_FIELD_CATALOG.
    Perform to populate the layout structure
    PERFORM SUB_POPULATE_LAYOUT.
    Perform to populate the sort table.
    PERFORM SUB_POPULATE_SORT.
    Perform to populate ALV event
    PERFORM SUB_GET_EVENT.
    END-OF-SELECTION.
    Perform to display ALV report
    PERFORM SUB_ALV_REPORT_DISPLAY.
    *& Form sub_build_header
    To build the header
    No Parameter
    FORM SUB_BUILD_HEADER .
    Local data declaration
    DATA: L_SYSTEM TYPE CHAR10 , "System id
    L_R_LINE TYPE SLIS_LISTHEADER, "Hold list header
    L_DATE TYPE CHAR10, "Date
    L_TIME TYPE CHAR10, "Time
    L_SUCCESS_RECORDS TYPE I, "No of success records
    L_TITLE(300) TYPE C. " Title
    Title Display
    L_R_LINE-TYP = C_HEADER. " header
    L_TITLE = 'Test report'(001).
    L_R_LINE-INFO = L_TITLE.
    APPEND L_R_LINE TO I_ALV_TOP_OF_PAGE.
    CLEAR L_R_LINE.
    Run date Display
    CLEAR L_DATE.
    L_R_LINE-TYP = C_ITEM. " Item
    WRITE: SY-DATUM TO L_DATE MM/DD/YYYY.
    L_R_LINE-KEY = 'Run Date :'(002).
    L_R_LINE-INFO = L_DATE.
    APPEND L_R_LINE TO I_ALV_TOP_OF_PAGE.
    CLEAR: L_R_LINE,
    L_DATE.ENDFORM. " sub_build_header
    *& Form sub_field_catalog
    Build Field Catalog
    No Parameter
    FORM SUB_FIELD_CATALOG .
    Build Field Catalog
    PERFORM SUB_FILL_ALV_FIELD_CATALOG USING:
    '01' '01' 'EBELN' 'I_EKPO' 'L' 'Doc No'(003) ' ' ' ' ' ' ' ',
    '01' '02' 'EBELP' 'I_EKPO' 'L' 'Item No'(004) 'X' 'X' ' ' ' ',
    '01' '03' 'MATNR' 'I_EKPO' 'L' 'Material No'(005) 'X' 'X' ' ' ' ',
    '01' '03' 'MATNR1' 'I_EKPO' 'L' 'Material No'(005) ' ' ' ' ' ' ' ',
    '01' '04' 'WERKS' 'I_EKPO' 'L' 'Plant'(006) 'X' 'X' ' ' ' ',
    '01' '04' 'WERKS1' 'I_EKPO' 'L' 'Plant'(006) ' ' ' ' ' ' ' ',
    '01' '05' 'NTGEW' 'I_EKPO' 'R' 'Net Weight'(007) ' ' ' ' 'GEWE' 'I_EKPO'
    ENDFORM. " sub_field_catalog
    *& Form sub_fill_alv_field_catalog
    *& For building Field Catalog
    *& p_rowpos Row position
    *& p_colpos Col position
    *& p_fldnam Fldname
    *& p_tabnam Tabname
    *& p_justif Justification
    *& p_seltext Seltext
    *& p_out no out
    *& p_tech Technical field
    *& p_qfield Quantity field
    *& p_qtab Quantity table
    FORM SUB_FILL_ALV_FIELD_CATALOG USING P_ROWPOS TYPE SYCUROW
    P_COLPOS TYPE SYCUCOL
    P_FLDNAM TYPE FIELDNAME
    P_TABNAM TYPE TABNAME
    P_JUSTIF TYPE CHAR1
    P_SELTEXT TYPE DD03P-SCRTEXT_L
    P_OUT TYPE CHAR1
    P_TECH TYPE CHAR1
    P_QFIELD TYPE SLIS_FIELDNAME
    P_QTAB TYPE SLIS_TABNAME.
    Local declaration for field catalog
    DATA: WA_LFL_FCAT TYPE SLIS_FIELDCAT_ALV.
    WA_LFL_FCAT-ROW_POS = P_ROWPOS. "Row
    WA_LFL_FCAT-COL_POS = P_COLPOS. "Column
    WA_LFL_FCAT-FIELDNAME = P_FLDNAM. "Field Name
    WA_LFL_FCAT-TABNAME = P_TABNAM. "Internal Table Name
    WA_LFL_FCAT-JUST = P_JUSTIF. "Screen Justified
    WA_LFL_FCAT-SELTEXT_L = P_SELTEXT. "Field Text
    WA_LFL_FCAT-NO_OUT = P_OUT. "No output
    WA_LFL_FCAT-TECH = P_TECH. "Technical field
    WA_LFL_FCAT-QFIELDNAME = P_QFIELD. "Quantity unit
    WA_LFL_FCAT-QTABNAME = P_QTAB . "Quantity table
    IF P_FLDNAM = 'NTGEW'.
    WA_LFL_FCAT-DO_SUM = 'X'.
    ENDIF.
    APPEND WA_LFL_FCAT TO I_FIELDCAT.
    CLEAR WA_LFL_FCAT.
    ENDFORM. " sub_fill_alv_field_catalog
    *& Form sub_populate_layout
    Populate ALV layout
    No Parameter
    FORM SUB_POPULATE_LAYOUT . CLEAR WA_LAYOUT.
    WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'." Optimization of Col width
    ENDFORM. " sub_populate_layout
    *& Form sub_populate_sort
    Populate ALV sort table
    No Parameter
    FORM SUB_POPULATE_SORT .
    Sort on material
    WA_SORT-SPOS = '01' .
    WA_SORT-FIELDNAME = 'MATNR'.
    WA_SORT-TABNAME = 'I_EKPO'.
    WA_SORT-UP = 'X'.
    WA_SORT-SUBTOT = 'X'.
    APPEND WA_SORT TO I_SORT .
    CLEAR WA_SORT.
    Sort on plant
    WA_SORT-SPOS = '02'.
    WA_SORT-FIELDNAME = 'WERKS'.
    WA_SORT-TABNAME = 'I_EKPO'.
    WA_SORT-UP = 'X'.
    WA_SORT-SUBTOT = 'X'.
    APPEND WA_SORT TO I_SORT .
    CLEAR WA_SORT.
    ENDFORM. " sub_populate_sort
    *& Form sub_get_event
    Get ALV grid event and pass the form name to subtotal_text
    event
    No Parameter
    FORM SUB_GET_EVENT .
    CONSTANTS : C_FORMNAME_SUBTOTAL_TEXT TYPE SLIS_FORMNAME VALUE
    'SUBTOTAL_TEXT'.
    DATA: L_S_EVENT TYPE SLIS_ALV_EVENT.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 4
    IMPORTING
    ET_EVENTS = I_EVENT
    EXCEPTIONS
    LIST_TYPE_WRONG = 0
    OTHERS = 0.
    Subtotal
    READ TABLE I_EVENT INTO L_S_EVENT
    WITH KEY NAME = SLIS_EV_SUBTOTAL_TEXT.
    IF SY-SUBRC = 0.
    MOVE C_FORMNAME_SUBTOTAL_TEXT TO L_S_EVENT-FORM.
    MODIFY I_EVENT FROM L_S_EVENT INDEX SY-TABIX.
    ENDIF.
    ENDFORM. " sub_get_event
    *& Form sub_alv_report_display
    For ALV Report Display
    No Parameter
    FORM SUB_ALV_REPORT_DISPLAY .
    DATA: L_REPID TYPE SYREPID .
    L_REPID = SY-REPID .
    This function module for displaying the ALV report
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = L_REPID
    I_CALLBACK_TOP_OF_PAGE = 'SUB_ALV_TOP_OF_PAGE'
    IS_LAYOUT = WA_LAYOUT
    IT_FIELDCAT = I_FIELDCAT
    IT_SORT = I_SORT
    IT_EVENTS = I_EVENT
    I_DEFAULT = 'X'
    I_SAVE = 'A'
    TABLES
    T_OUTTAB = I_EKPO
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2.
    IF SY-SUBRC <> 0.
    MESSAGE i000 WITH 'Error in ALV report display'(055).
    ENDIF.ENDFORM. " sub_alv_report_display
    FORM sub_alv_top_of_page
    Call ALV top of page
    No parameter
    FORM SUB_ALV_TOP_OF_PAGE. "#EC CALLED
    To write header for the ALV
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = I_ALV_TOP_OF_PAGE.
    ENDFORM. "alv_top_of_page
    *& Form subtotal_text
    Build subtotal text
    P_total Total
    p_subtot_text Subtotal text info
    FORM SUBTOTAL_TEXT CHANGING
    P_TOTAL TYPE ANY
    P_SUBTOT_TEXT TYPE SLIS_SUBTOT_TEXT.
    Material level sub total
    IF P_SUBTOT_TEXT-CRITERIA = 'MATNR'.
    P_SUBTOT_TEXT-DISPLAY_TEXT_FOR_SUBTOTAL
    = 'Material level total'(009).
    ENDIF.
    Plant level sub total
    IF P_SUBTOT_TEXT-CRITERIA = 'WERKS'.
    P_SUBTOT_TEXT-DISPLAY_TEXT_FOR_SUBTOTAL = 'Plant level total'(010).
    ENDIF.

  • ALV grid is not displaying few fields of final internal table of type DMBTR

    hello frnds,
    i am displaying 10 fields in ALV grid using field catalog.
    among them five fields are currency fields on which i doing some arithematic operations. but all these fields are not getting displayed in alv grid.
    here is my code....
    declaring final strucutre to generate report
    TYPES:BEGIN OF ty_final,
              gjahr   TYPE gjahr,       " Year
              wwert   TYPE wwert_d,     " Traslation date
              bukrs   TYPE bukrs,       " company code
              hkont   TYPE hkont,       " General ledger account
              txt20   TYPE txt20_skat,  " Account name
              belnr   TYPE belnr_d,     " Purchase order number
              shkzg   TYPE shkzg,       " Dt/Cr indicator
              dmbtr1   TYPE dmbtr,       " Ammount in local currency
              v_alc   TYPE dmbtr,       " Ammount in local currency
              wrbtr   TYPE wrbtr,       " Ammount in foreign currency
              ebeln   TYPE ebeln,       " Purchase order number
              ebelp   TYPE ebelp,       " Item number
              matnr   TYPE matnr,       " Material number
              menge   TYPE menge_d,     " Qunatity
              meins   TYPE meins,       " Unit of measure
              stprs   TYPE stprs,       " Std material master
              v_iv    TYPE dmbtr,       " Invoice value
              pswsl   TYPE pswsl,       " Currency
              v_erc   TYPE dmbtr,       " Exchange rate calculated
              v_op    TYPE dmbtr,       " Order price
              v_uos   TYPE dmbtr,       " Unit order to stock
              v_io    TYPE dmbtr,       " Invoice to order
              v_uv    TYPE dmbtr,       " Unit value
              v_t     TYPE dmbtr,       " Total
              v_d     TYPE dmbtr,       " Differecne
              netpr   TYPE bprei,       " Net price in purchasing document
              v_total TYPE dmbtr,       " Total
              v_os    TYPE dmbtr,       " Order to stock
              v_ito   TYPE dmbtr,       " Invoice to order
              saknr   TYPE saknr,       " G/L account number
           END OF ty_final.
    FORM move_data.
      IF NOT i_bseg[] IS INITIAL.
        LOOP AT i_bseg INTO wa_bseg.
          wa_final-gjahr  = wa_bseg-gjahr.
          wa_final-bukrs  = wa_bseg-bukrs.
          wa_final-hkont  = wa_bseg-hkont.
          wa_final-belnr  = wa_bseg-belnr.
          wa_final-shkzg  = wa_bseg-shkzg.
          wa_final-wrbtr  = wa_bseg-wrbtr.
          wa_final-ebeln  = wa_bseg-ebeln.
          wa_final-ebelp  = wa_bseg-ebelp.
          wa_final-matnr  = wa_bseg-matnr.
          wa_final-menge  = wa_bseg-menge.
          wa_final-meins  = wa_bseg-meins.
          wa_final-pswsl  = wa_bseg-pswsl.
          wa_final-dmbtr1  = wa_bseg-dmbtr.
          wa_final-saknr  = wa_bseg-saknr.
          wa_final-v_total = wa_bseg-dmbtr.
          READ TABLE i_bkpf INTO wa_bkpf WITH KEY bukrs = wa_bseg-bukrs.
          IF sy-subrc = 0.
            wa_final-wwert = wa_bkpf-wwert.
          ENDIF.
         CLEAR wa_bkpf.
          READ TABLE i_mbew INTO wa_mbew WITH KEY matnr = wa_bseg-matnr.
          IF sy-subrc = 0.
            wa_final-stprs = wa_mbew-stprs.
          ENDIF.
         CLEAR wa_mbew.
          READ TABLE i_ekpo INTO wa_ekpo WITH KEY ebeln = wa_bseg-ebeln.
          IF sy-subrc = 0.
            wa_final-netpr = wa_ekpo-netpr.
          ENDIF.
         CLEAR wa_ekpo.
          READ TABLE i_skat INTO wa_skat WITH KEY saknr = wa_bseg-saknr.
          IF sy-subrc = 0.
            wa_final-txt20 = wa_skat-txt20.
          ENDIF.
    calculating output values
          IF wa_bseg-shkzg = 'H'.
            wa_final-v_alc = -1 * wa_bseg-dmbtr.
          ELSEIF wa_bseg-shkzg = 'S'.
            wa_final-v_alc = 1 * wa_bseg-dmbtr.
          ENDIF.
         DATA : l_c_v_alc TYPE p DECIMALS 2,
         l_c_v_iv TYPE p DECIMALS 2.
         l_c_v_alc = wa_final-v_alc.
          IF wa_bseg-menge NE 0.
            wa_final-v_iv = wa_bseg-dmbtr / wa_bseg-menge.
          ENDIF.
          IF wa_bseg-dmbtr NE 0.
            wa_final-v_erc  = wa_bseg-wrbtr   / wa_final-dmbtr1.
          ENDIF.
          IF wa_final-v_erc NE 0.
            wa_final-v_op   = wa_ekpo-netpr   / wa_final-v_erc.
          ENDIF.
          wa_final-v_uos  = wa_mbew-stprs   - wa_final-v_op.
          wa_final-v_io   = wa_final-v_iv   + wa_final-v_uos.
          wa_final-v_uv   = wa_final-v_uos  + wa_final-v_io.
          wa_final-v_t    = wa_final-v_uv   + wa_bseg-menge.
          wa_final-v_d    = wa_final-v_t    - wa_final-v_alc.
          wa_final-v_os   = wa_final-v_uos  * wa_bseg-menge.
          wa_final-v_ito  = wa_final-v_io   * wa_bseg-menge.
          CLEAR wa_bseg.
          APPEND wa_final TO i_final.
          CLEAR wa_final.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "data_retrieval
    *&      Form  build_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcat.
      CLEAR wa_fieldcat.
    *  TYPES : v_alc TYPE dmbtr. "curr. " decimal 2.
    DATA: l_c_v_alc TYPE p DECIMALS 2,
    l_c_v_iv TYPE p DECIMALS 2 .
    l_c_v_alc = v_alc.
    l_c_v_iv = v_iv.
    Constant Declarations.
      CONSTANTS:
                l_c_gjahr(5)   TYPE c VALUE 'GJAHR',      " Year
                l_c_wwert(5)   TYPE c VALUE 'WWERT',      " Traslation date
                l_c_bukrs(5)   TYPE c VALUE 'BUKRS',      " company code
                l_c_hkont(5)   TYPE c VALUE 'HKONT',      " General ledger account
                l_c_txt20(10)  TYPE c VALUE 'TXT20',      " Account name
                l_c_belnr(5)   TYPE c VALUE 'BELNR',      " Doc number
                l_c_shkzg(5)   TYPE c VALUE 'SHKZG',      " Dt/Cr indicator
                l_c_dmbtr(5)   TYPE c VALUE 'DMBTR1',      " Ammount in local currency
               " l_c_v_alc      TYPE c VALUE 'V_ALC',      " Ammount in local currency
                l_c_wrbtr(5)   TYPE c VALUE 'WRBTR',      " Ammount in foreign currency
                l_c_ebeln(5)   TYPE c VALUE 'EBELN',      " Purchase order number
                l_c_ebelp(5)   TYPE c VALUE 'EBELP',      " Item number
                l_c_matnr(5)   TYPE c VALUE 'MATNR',      " Material number
                l_c_menge(7)   TYPE c VALUE 'MENGE',      " Qunatity
                l_c_meins(5)   TYPE c VALUE 'MEINS',      " Unit of measure
                l_c_stprs(5)   TYPE c VALUE 'STPRS',      " Std material master
               " l_c_v_iv(4)    TYPE c VALUE 'V_IV',           " Invoice value
                l_c_pswsl(5)   TYPE c VALUE 'PSWSL',      " Currency
                l_c_v_erc(5)   TYPE c VALUE 'V_ERC',      " Exchange rate calculated
                l_c_v_op(4)    TYPE c VALUE 'V_OP',       " Order price
                l_c_v_uos(5)   TYPE c VALUE 'V_UOS',      " Unit order to stock
                l_c_v_io(4)    TYPE c VALUE 'V_IO',       " Invoice to order
                l_c_v_uv(4)    TYPE c VALUE 'V_UV',       " Unit value
                l_c_v_t(3)     TYPE c VALUE 'V_T',        " Total
                l_c_v_d(3)     TYPE c VALUE 'V_D',        " Differecne
                l_c_netpr(5)   TYPE c VALUE 'NETPR',      " Net price in purchasing document
                l_c_v_total(7) TYPE c VALUE 'V_TOTAL',    " Total
                l_c_v_os(4)    TYPE c VALUE 'V_OS',      " Order to stock
                l_c_v_ito(5)   TYPE c VALUE 'V_ITO',      " Invoice to order
                l_c_saknr(5)   TYPE c VALUE 'SAKNR',      " G/L account number
                l_c_i_final(7) TYPE c VALUE 'I_FINAL'.    " Final internal table
    Fieldcat for fiscal year
      wa_fieldcat-col_pos   =  1.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_gjahr.
      wa_fieldcat-seltext_m = text-007.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Translation date
      wa_fieldcat-col_pos   =  2.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_wwert.
      wa_fieldcat-seltext_m = text-008.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Company code
      wa_fieldcat-col_pos   =  3.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_bukrs.
      wa_fieldcat-seltext_m = text-009.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for General ledger account
      wa_fieldcat-col_pos   =  4.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_hkont.
      wa_fieldcat-seltext_m = text-010.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Account name
      wa_fieldcat-col_pos   =  5.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_txt20.
      wa_fieldcat-seltext_m = text-011.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Doc number
      wa_fieldcat-col_pos   =  6.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_belnr.
      wa_fieldcat-seltext_m = text-012.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Dt/Cr indicator
      wa_fieldcat-col_pos   =  7.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_shkzg.
      wa_fieldcat-seltext_m = text-013.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Ammount in local currency
      wa_fieldcat-col_pos   =  8.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = 'DMBTR1'.
      wa_fieldcat-seltext_m = text-014.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Ammount in local currency
      wa_fieldcat-col_pos   =  9.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = 'V_ALC'.
      wa_fieldcat-seltext_m = text-015.
      wa_fieldcat-ref_fieldname = 'DMBTR'.
    wa_fieldcat-no_sign   = 'X'.
    wa_fieldcat-do_sum    =  c_x.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Ammount in foreign currency
      wa_fieldcat-col_pos   =  10.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_wrbtr.
      wa_fieldcat-seltext_m = text-016.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Purchse order number
      wa_fieldcat-col_pos   =  11.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_ebeln.
      wa_fieldcat-seltext_m = text-017.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Item No
      wa_fieldcat-col_pos   =  12.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_ebelp.
      wa_fieldcat-seltext_m = text-018.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Material number
      wa_fieldcat-col_pos   =  13.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_matnr.
      wa_fieldcat-seltext_m = text-019.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Qunatity
      wa_fieldcat-col_pos   =  14.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_menge.
      wa_fieldcat-seltext_m = text-020.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Unit of measure
      wa_fieldcat-col_pos   =  15.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_meins.
      wa_fieldcat-seltext_m = text-021.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Std material master
      wa_fieldcat-col_pos   =  16.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_stprs.
      wa_fieldcat-seltext_m = text-022.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Invoice value,
      wa_fieldcat-col_pos   =  17.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = 'V_IV'.
      wa_fieldcat-seltext_m = text-023.
      wa_fieldcat-ref_fieldname = 'DMBTR'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Currency
      wa_fieldcat-col_pos   =  18.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_pswsl.
      wa_fieldcat-seltext_m = text-024.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Exchange rate calculated
      wa_fieldcat-col_pos   =  19.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = 'V_ERC'.
      wa_fieldcat-seltext_m = text-025.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Order price
      wa_fieldcat-col_pos   =  20.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_op.
      wa_fieldcat-seltext_m = text-026.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Unit order to stock
      wa_fieldcat-col_pos   =  21.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_uos.
      wa_fieldcat-seltext_m = text-027.
      wa_fieldcat-do_sum    = c_x.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Invoice to order
      wa_fieldcat-col_pos   =  22.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_io.
      wa_fieldcat-seltext_m = text-028.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Unit value
      wa_fieldcat-col_pos   =  23.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_uv.
      wa_fieldcat-seltext_m = text-029.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Total
      wa_fieldcat-col_pos   =  24.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_t.
      wa_fieldcat-seltext_m = text-030.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Difference
      wa_fieldcat-col_pos   =  25.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_d.
      wa_fieldcat-seltext_m = text-031.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Net Price in Purchasing Document
      wa_fieldcat-col_pos   =  26.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_netpr.
      wa_fieldcat-seltext_m = text-032.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Total
      wa_fieldcat-col_pos   =  27.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_total.
      wa_fieldcat-seltext_m = text-033.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Order to stock
      wa_fieldcat-col_pos   =  28.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_os.
      wa_fieldcat-seltext_m = text-034.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Invoice to order
      wa_fieldcat-col_pos   =  29.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_ito.
      wa_fieldcat-seltext_m = text-035.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    fieldcat for invoice to order
      wa_fieldcat-col_pos   =  30.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_saknr.
      wa_fieldcat-seltext_m = text-035.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    ENDFORM.                    "build_fieldcat

    Hi romanch,
    defining the field catalog you must reference all currency fields to the respective currency key field (type CUKY).
    <alv_fieldcat>-cfieldname         = 'HWAER'.
    This is sample for alv output of a currency field. The alv structure has a field HWAER which carries the currency key, e.g. USD or so.
    Obviously you do not provide a cutrrency key for your values. If they are initial (zero), ALV will not display them as 0,00 but leave the field empty if the reference too currency key is not established.
    If you define a DDIC structure for the ALV output this refernce is enforced. You can pass the DDIC structure name to the ALV and don not have to create the field catalog manually.
    Regards,
    Clemens

  • Issue in ALV Grid Grand Totals

    Hi Friends,
       Hwo can i display  grand total text in ALV Grid? Eventhough i am using Totals_text parameter in layout i am unable to display.  any one vcan help me out in this refgard.
    if pos send the code
    Regards,
    Vijay

    <REMOVED BY MODERATOR>
    SAMPLE PROGRAM:
    REPORT ysalesorder_alv_subtotals.
    * Type Pools
    TYPE-POOLS:slis.
    * Tables
    TABLES: vbak, "Sales Document: Header Data
    vbap. "Sales Document: Item Data
    * Global Structures
    DATA:gt_fieldcat TYPE slis_t_fieldcat_alv,
    wa_fieldcat TYPE slis_fieldcat_alv,
    gt_sortcat TYPE slis_t_sortinfo_alv,
    wa_sortcat LIKE LINE OF gt_sortcat.
    * Internal Table
    DATA: BEGIN OF gt_salesorder OCCURS 0,
    vbeln LIKE vbak-vbeln, " Sales Document Number
    posnr LIKE vbap-posnr, " Sales Doc Item
    netwr LIKE vbap-netwr, " Net Value
    END OF gt_salesorder.
    * SELECT OPTIONS
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME
    TITLE text-001.
    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln. " Sales Document
    Number.
    SELECTION-SCREEN END OF BLOCK b1.
    * Initialization
    INITIALIZATION.
    PERFORM initialization.
    * Start Of Selection
    START-OF-SELECTION.
    PERFORM field_catalog. "For Structure Creation
    PERFORM fetch_data. "Get the Data From DB Table
    PERFORM sorting USING gt_sortcat.
    * End Of Selection
    END-OF-SELECTION.
    PERFORM display_data.
    *& Form initialization
    * text
    * --> p1 text
    * <-- p2 text
    FORM initialization .
    s_vbeln-sign = 'I'.
    s_vbeln-option = 'BT'.
    s_vbeln-low = '4969'.
    s_vbeln-high = '5000'.
    APPEND s_vbeln.
    ENDFORM. " initialization
    *& Form field_catalog
    * text
    * --> p1 text
    * <-- p2 text
    FORM field_catalog .
    REFRESH : gt_fieldcat.
    CLEAR : wa_fieldcat.
    wa_fieldcat-col_pos = '1'. "Column Position
    wa_fieldcat-tabname = 'IT_SALESORDER'. "Internal Table
    wa_fieldcat-fieldname = 'VBELN'. "Field Name
    wa_fieldcat-key = 'X'. "Blue Color
    wa_fieldcat-seltext_m = 'Sales Doc No'. "Display Text In Screen
    APPEND wa_fieldcat TO gt_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-col_pos = '2'. "Column Position
    wa_fieldcat-tabname = 'IT_SALESORDER'. "Internal Table Name
    wa_fieldcat-fieldname = 'POSNR'. "Field Name
    wa_fieldcat-seltext_m = 'Sales Doc Item'."Display Text In Screen
    APPEND wa_fieldcat TO gt_fieldcat.
    CLEAR wa_fieldcat.
    *SubTotal on the Field NETWR
    wa_fieldcat-col_pos = '3'. "Column Position
    wa_fieldcat-tabname = 'IT_SALESORDER'. "Internal Table
    wa_fieldcat-fieldname = 'NETWR'. "Field Name
    wa_fieldcat-do_sum = 'X'. "Sum
    wa_fieldcat-seltext_m = 'Net Value'. "Display Text In Screen
    APPEND wa_fieldcat TO gt_fieldcat.
    CLEAR wa_fieldcat.
    ENDFORM. " field_catalog
    *& Form sorting
    * text
    * -->P_IT_SORTCAT text
    FORM sorting USING p_it_sortcat TYPE slis_t_sortinfo_alv.
    CLEAR wa_sortcat.
    wa_sortcat-fieldname = 'VBELN'.
    wa_sortcat-up ='X'.
    wa_sortcat-subtot = 'X'.
    APPEND wa_sortcat TO p_it_sortcat.
    ENDFORM. " sorting
    *& Form display_data
    * text
    * --> p1 text
    * <-- p2 text
    FORM display_data .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    * I_INTERFACE_CHECK = ' '
    * I_BYPASSING_BUFFER = ' '
    * I_BUFFER_ACTIVE = ' '
    i_callback_program = sy-repid
    * I_CALLBACK_PF_STATUS_SET = ' '
    * I_CALLBACK_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 =
    * I_GRID_SETTINGS =
    * IS_LAYOUT =
    it_fieldcat = gt_fieldcat
    * IT_EXCLUDING =
    * IT_SPECIAL_GROUPS =
    it_sort = gt_sortcat
    * IT_FILTER =
    * IS_SEL_HIDE =
    * I_DEFAULT = 'X'
    * I_SAVE = ' '
    * IS_VARIANT =
    * IT_EVENTS =
    * IT_EVENT_EXIT =
    * IS_PRINT =
    * IS_REPREP_ID =
    * I_SCREEN_START_COLUMN = 0
    * I_SCREEN_START_LINE = 0
    * I_SCREEN_END_COLUMN = 0
    * I_SCREEN_END_LINE = 0
    * IT_ALV_GRAPHICS =
    * IT_HYPERLINK =
    * IT_ADD_FIELDCAT =
    * IT_EXCEPT_QINFO =
    * I_HTML_HEIGHT_TOP =
    * I_HTML_HEIGHT_END =
    * IMPORTING
    * E_EXIT_CAUSED_BY_CALLER =
    * ES_EXIT_CAUSED_BY_USER =
    TABLES
    t_outtab = gt_salesorder
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER
    SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. " display_data
    *& Form fetch_data
    * text
    * --> p1 text
    * <-- p2 text
    FORM fetch_data .
    REFRESH : gt_salesorder.
    CLEAR : gt_salesorder.
    SELECT a~vbeln
    posnr
    b~netwr
    FROM vbak AS a
    INNER JOIN vbap AS b ON a~vbeln = b~vbeln
    INTO TABLE gt_salesorder
    WHERE a~vbeln IN s_vbeln.
    ENDFORM. " fetch_data
    Edited by: Alvaro Tejada Galindo on Apr 11, 2008 12:24 PM

  • Urgent : Problem with Editable  ALV Grid  for Quantity and Currency Fields

    Hi All,
    I am using Editable ALV Grid display and have quantity and value as editable fields in the display.
    When user changes these values these values are not changing properly .
    For the quantity field the domain is MENG13 with 3 deciamal places and here  if we enter 500 it takes it as 0.500   .
    The same problem is for the currency field. Here the Domain is WERT7 with 3 decimal places.
    Here also it takes last 2 digits after decimal places by default.
    Please advice how to get proper values in this case from ALV editable fields.
    Thanks and Regards
    Harshad
    Edited by: Harshad Rahirkar on Dec 25, 2007 7:39 AM

    for all the currency field , it will display like that only.
    u have to manipulate uin program before displaying.
    if they are giving 500, in program multiply with 100 and move it to table.
    when u are getting from table, divinde and display.
    this is what I am doing.
    Reward if helpfull.

  • ALV grid Editable based on a Field value

    Hi,
    I need to make a ALV Grid Row editable based on a particular field of that row.
    For example
    if fields are   A   B   C  D
    and if there are three rows of data
    I must make the Field B editable in all the rows which have D value as X else it must be non Editable.
    I searched in SDN but could not find a suitable answer.
    Hope I am clear with my issue.
    Regards

    this sample code makes the NETPR field editable based on a desired condition.
    this is the solution to your problem.
    * TABLES:     ekko.
    * TYPE-POOLS: slis.
    * TYPES: BEGIN OF t_ekko,
    *  ebeln TYPE ekpo-ebeln,
    *  ebelp TYPE ekpo-ebelp,
    *  netpr TYPE ekpo-netpr,
    *  field_style  TYPE lvc_t_styl,
    * END OF t_ekko.
    *DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    *      wa_ekko TYPE t_ekko.
    *DATA: it_fieldcat TYPE lvc_t_fcat,    
    *      wa_fieldcat TYPE lvc_s_fcat,
    *      gd_tab_group TYPE slis_t_sp_group_alv,
    *      gd_layout    TYPE lvc_s_layo,  
    *      gd_repid     LIKE sy-repid.
    *START-OF-SELECTION.
    *SELECT ebeln ebelp netpr
    *   UP TO 10 ROWS
    *    FROM ekpo
    *    INTO  CORRESPONDING FIELDS OF TABLE it_ekko.
    *  DATA ls_stylerow TYPE lvc_s_styl .
    *  DATA lt_styletab TYPE lvc_t_styl .
    ** The following code sets it to be disabled(display only) if 'NETPR'
    ** is gt than 10.
    *  LOOP AT it_ekko INTO wa_ekko.
    *    IF wa_ekko-netpr GT 10.
    *      ls_stylerow-fieldname = 'NETPR' .
    *      ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
    *      APPEND ls_stylerow  TO wa_ekko-field_style.
    *      MODIFY it_ekko FROM wa_ekko.
    *    ENDIF.
    *  ENDLOOP.
    *  wa_fieldcat-fieldname   = 'EBELN'.
    *  wa_fieldcat-scrtext_m   = 'Purchase Order'.
    *  wa_fieldcat-col_pos     = 1.
    *  APPEND wa_fieldcat TO it_fieldcat.
    *  CLEAR  wa_fieldcat.
    *  wa_fieldcat-fieldname   = 'EBELP'.
    *  wa_fieldcat-scrtext_m   = 'PO Item'.
    *  wa_fieldcat-col_pos     = 2.
    *  APPEND wa_fieldcat TO it_fieldcat.
    *  CLEAR  wa_fieldcat.
    *  wa_fieldcat-fieldname   = 'NETPR'.
    *  wa_fieldcat-scrtext_m   = 'Net Price'.
    *  wa_fieldcat-edit        = 'X'. "sets whole column to be editable
    *  wa_fieldcat-col_pos     = 3.
    *  wa_fieldcat-datatype     = 'CURR'.
    *  APPEND wa_fieldcat TO it_fieldcat.
    *  CLEAR  wa_fieldcat.
    *  gd_layout-stylefname = 'FIELD_STYLE'.
    *  gd_layout-zebra             = 'X'.
    *  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    *       EXPORTING
    *            i_callback_program       = sy-repid
    *            is_layout_lvc            = gd_layout
    *            it_fieldcat_lvc          = it_fieldcat
    *            i_save                   = 'X'
    *       TABLES
    *            t_outtab                = it_ekko

  • ALV Grid - Subtotal & total to be shown at the top of the table

    Hi,
    I am using function module 'REUSE_ALV_GRID_DISPLAY' to display a table, and I count subtotals and total for some fields. The total is always shown at the bottom of the table, and subtotals are always shown after the rows that subtotals are calculated for. Is there a way to make it so that the total is always shown at the top of the table, and subtotals are shown before the rows that subtotals are calculated for?
    Thank you,
    Jake Alexander

    GW_LAYOUT-TOTALS_BEFORE_ITEMS = 'X'.
    Regards
    Sreekanth

  • In ALV  grid  report, totals of columns display at end of report

    Hi.....!
           In ALV report i want to display grand totals in end of list and also i want to output display ALV report in page by page

    Hi,
    this the code i am sending it may help you.
    DATA : wa_sort TYPE slis_sortinfo_alv.
    DATA : it_sort TYPE slis_t_sortinfo_alv. " for sorting
    PERFORM sub_total USING '<field based on wich you want sort(say key field>>'.
    FORM sub_total USING value(p_sortfld) .
      wa_sort-fieldname = p_sortfld.
      wa_sort-subtot = 'X'.
      wa_sort-up = 'X'.
      APPEND wa_sort TO it_sort
    and then is main function module for display grid or list.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program     = wa_pgm
            i_callback_top_of_page
            ='TOP_OF_PAGE'
            i_grid_title           = text-016
            it_fieldcat            = it_fieldcat
           <b> it_sort                = it_sort</b>
            i_default              = 'X'
            i_save                 = 'A'
          TABLES
            t_outtab               = it_final.

  • Alv grid f4 help populating fieldcatalog field from f4 chosen field

    Suggest help to do f4 help on alv oo-object .
    when i click f4 for field it should call screen 200 their i have button search which need to extract data from for particular table on chosen from f4 help . Double click on value it should populate that value in screen 100 . note calling screen 200 dynamically field catalog get populated with f4 chosen from screen 100.
    can u suggest me the how to do this double click on the screen need to populate that value in f4 screen.
    CLASS lcl_application_f4 IMPLEMENTATION.
    method on_f4.
    f4_params-c_fieldname = e_fieldname.
    f4_params-cs_row_no = es_row_no.
    f4_params-cr_event_data = er_event_data.
    f4_params-ct_bad_cells = et_bad_cells.
    f4_params-c_display = e_display

    Hai Manoj
    Try with the following Code
      DATA: BEGIN OF LI_FABGRP OCCURS 0,
            FABGRP LIKE ZAPO_FABGRP-FABGRP,
            BEGDA LIKE ZAPO_FABGRP-BEGDA,
         END OF LI_FABGRP.
      DATA : T_RETURN TYPE STANDARD TABLE OF DDSHRETVAL WITH HEADER LINE,
             L_RETFIELD TYPE DFIES-FIELDNAME.
    parameters : S_FABGR like ZAPO_FABGRP-FABGRP.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_FABGR.
      SELECT FABGRP BEGDA FROM ZAPO_FABGRP INTO table LI_FABGRP.
      SORT LI_FABGRP BY FABGRP ASCENDING  BEGDA DESCENDING.
    Henter de mulige fabriksgrupper med nyeste BEGDA *indenfor hver
      DELETE ADJACENT DUPLICATES FROM LI_FABGRP COMPARING FABGRP.
    L_RETFIELD = 'FABGRP'.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
        RETFIELD               = L_RETFIELD
        DYNPPROG               = SY-REPID
        DYNPNR                 = '1000'
        DYNPROFIELD            = 'S_FABGR'
        VALUE_ORG              = 'S'
        MULTIPLE_CHOICE        = ' '
      TABLES
        VALUE_TAB              = LI_FABGRP
        RETURN_TAB             = T_RETURN
    EXCEPTIONS
       PARAMETER_ERROR        = 1
       NO_VALUES_FOUND        = 2
       OTHERS                 = 3.
    Thanks & regards
    Sreenivasulu P

  • Only sub total in alv report

    hi,
    I have a report on ALV with sub totals for some fields, it is working fine but my requirement is whether i can get only the sub totals of that report.
    regards,
    Prabhu

    HI
    refer this code.
    REPORT ZALV.
    TYPE-POOLS: SLIS.
    DATA: G_REPID LIKE SY-REPID,
    GS_PRINT            TYPE SLIS_PRINT_ALV,
    GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
    GT_EVENTS           TYPE SLIS_T_EVENT,
    GT_SORT             TYPE SLIS_T_SORTINFO_ALV,
    GS_LAYOUT           TYPE SLIS_LAYOUT_ALV,
    GT_FIELDCAT         TYPE SLIS_T_FIELDCAT_ALV,
    FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
    COL_POS TYPE I.
    DATA: BEGIN OF ITAB,
      FIELD1(5) TYPE C,
      FIELD2(5) TYPE C,
      FIELD3(5) TYPE P DECIMALS 2,
    END OF ITAB.
    DATA: BEGIN OF ITAB1 OCCURS 0.
      INCLUDE STRUCTURE ITAB.
    DATA: END OF ITAB1.
    DATA: BEGIN OF ITAB_FIELDCAT OCCURS 0.
      INCLUDE STRUCTURE ITAB.
    DATA: END OF ITAB_FIELDCAT.
    Print Parameters
    PARAMETERS:
                P_PRINT  AS CHECKBOX DEFAULT ' ', "PRINT IMMEDIATE
                P_NOSINF AS CHECKBOX DEFAULT 'X', "NO SELECTION INFO
                P_NOCOVE AS CHECKBOX DEFAULT ' ', "NO COVER PAGE
                P_NONEWP AS CHECKBOX DEFAULT ' ', "NO NEW PAGE
                P_NOLINF AS CHECKBOX DEFAULT 'X', "NO PRINT LIST INFO
                P_RESERV TYPE I.                  "NO OF FOOTER LINE
    INITIALIZATION.
    G_REPID = SY-REPID.
    PERFORM PRINT_BUILD    USING GS_PRINT.      "Print PARAMETERS
    START-OF-SELECTION.
    TEST DATA
    MOVE 'TEST1' TO ITAB1-FIELD1.
    MOVE 'TEST1' TO ITAB1-FIELD2.
    MOVE '10.00' TO ITAB1-FIELD3.
    APPEND ITAB1.
    MOVE 'TEST2' TO ITAB1-FIELD1.
    MOVE 'TEST2' TO ITAB1-FIELD2.
    MOVE '20.00' TO ITAB1-FIELD3.
    APPEND ITAB1.
    DO 50 TIMES.
      APPEND ITAB1.
    ENDDO.
    END-OF-SELECTION.
    PERFORM BUILD.
    PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
    PERFORM COMMENT_BUILD  CHANGING GT_LIST_TOP_OF_PAGE.
    PERFORM CALL_ALV.
    FORM BUILD.
    DATA FIELD CATALOG
    Explain Field Description to ALV
    DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
    CLEAR FIELDCAT_IN.
    FIELDCAT_LN-FIELDNAME = 'FIELD1'.
    FIELDCAT_LN-TABNAME   = 'ITAB1'.
    *FIELDCAT_LN-NO_OUT    = 'X'.  "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
    FIELDCAT_LN-KEY       = ' '.   "SUBTOTAL KEY
    FIELDCAT_LN-NO_OUT    = ' '.
    FIELDCAT_LN-SELTEXT_L = 'HEAD1'.
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    CLEAR FIELDCAT_IN.
    FIELDCAT_LN-FIELDNAME = 'FIELD2'.
    FIELDCAT_LN-TABNAME   = 'ITAB1'.
    FIELDCAT_LN-NO_OUT    = 'X'.
    FIELDCAT_LN-SELTEXT_L = 'HEAD2'.
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    CLEAR FIELDCAT_IN.
    FIELDCAT_LN-FIELDNAME     = 'FIELD3'.
    FIELDCAT_LN-TABNAME       = 'ITAB1'.
    FIELDCAT_LN-REF_FIELDNAME = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
    FIELDCAT_LN-REF_TABNAME   = 'MSEG'.  "<- REF TABLE IN THE DICTIONNARY
    FIELDCAT_LN-NO_OUT        = ' '.
    FIELDCAT_LN-DO_SUM        = 'X'.   "SUM UPON DISPLAY
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    DATA SORTING AND SUBTOTAL
    DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
    CLEAR GS_SORT.
    GS_SORT-FIELDNAME = 'FIELD1'.
    GS_SORT-SPOS      = 1.
    GS_SORT-UP        = 'X'.
    GS_SORT-SUBTOT    = 'X'.
    APPEND GS_SORT TO GT_SORT.
    CLEAR GS_SORT.
    GS_SORT-FIELDNAME = 'FIELD2'.
    GS_SORT-SPOS      = 2.
    GS_SORT-UP        = 'X'.
    *GS_SORT-SUBTOT    = 'X'.
    APPEND GS_SORT TO GT_SORT.
    ENDFORM.
    FORM CALL_ALV.
    ABAP List Viewer
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = G_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    I_STRUCTURE_NAME = 'ITAB1'
    IS_LAYOUT =  GS_LAYOUT
    IT_FIELDCAT = GT_FIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
      IT_SORT = GT_SORT[]
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
      IT_EVENTS = GT_EVENTS[]
    IT_EVENT_EXIT =
      IS_PRINT = GS_PRINT
    IS_REPREP_ID =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    T_OUTTAB = ITAB1
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2.
    ENDFORM.
    HEADER FORM
    FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
    CONSTANTS:
    GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
    *GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                I_LIST_TYPE = 0
           IMPORTING
                ET_EVENTS   = LT_EVENTS.
      READ TABLE LT_EVENTS WITH KEY NAME =  SLIS_EV_TOP_OF_PAGE
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
        APPEND LS_EVENT TO LT_EVENTS.
      ENDIF.
    define END_OF_PAGE event
    READ TABLE LT_EVENTS WITH KEY NAME =  SLIS_EV_END_OF_PAGE
                             INTO LS_EVENT.
    IF SY-SUBRC = 0.
      MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
      APPEND LS_EVENT TO LT_EVENTS.
    ENDIF.
    ENDFORM.
    FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
      DATA: GS_LINE TYPE SLIS_LISTHEADER.
      CLEAR GS_LINE.
      GS_LINE-TYP  = 'H'.
      GS_LINE-INFO = 'HEADER 1'.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
      CLEAR GS_LINE.
      GS_LINE-TYP  = 'S'.
      GS_LINE-KEY  = 'STATUS 1'.
      GS_LINE-INFO = 'INFO 1'.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
      GS_LINE-KEY  = 'STATUS 2'.
      GS_LINE-INFO = 'INFO 2'.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
    CLEAR GS_LINE.
    GS_LINE-TYP  = 'A'.
    GS_LINE-INFO = 'ACTION'.
    APPEND GS_LINE TO  GT_TOP_OF_PAGE.
    ENDFORM.
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
      WRITE: SY-DATUM, 'Page No', SY-PAGNO LEFT-JUSTIFIED.
    ENDFORM.
    FORM END_OF_PAGE.
      WRITE at (sy-linsz) sy-pagno CENTERED.
    ENDFORM.
    PRINT SETTINGS
    FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
      LS_PRINT-PRINT              = P_PRINT.  "PRINT IMMEDIATE
      LS_PRINT-NO_PRINT_SELINFOS  = P_NOSINF. "NO SELECTION INFO
      LS_PRINT-NO_COVERPAGE       = P_NOCOVE. "NO COVER PAGE
      LS_PRINT-NO_NEW_PAGE        = P_NONEWP.
      LS_PRINT-NO_PRINT_LISTINFOS = P_NOLINF. "NO PRINT LIST INFO
      LS_PRINT-RESERVE_LINES      = P_RESERV.
    ENDFORM.
    *END OF ZALV PROGRAM
    Reward all helpfull answers.
    Regards.
    Jay

  • How to change sub total value in ALV Grid.

    Hi All,
    Can u please explain how to change SUBTOTAL Value in ALV Grid display based on another field value.
    EX; F1 subtotal is  initial then we have to modify the F2 sub total to 9999.9.
    Thanks
    Radha.

    Hi Radha,
    I doubt if that can be changed....because the event that i was referring to in my previous post works with ALV List display...But in any case you can try that.....
    There is an event in SLIS....(As i told you, i dont remember the name and currently i dont have access to SAP system, so i am not able to verify and let you know that event name).....
    Other thatn TOP and END of PAGE events, there is an event for sub-total text......i think it would start with "SUBTOTAL"...
    you need to use that event in your events table and pass it to ALV Grid display.
    Then create a sub-routine with that name (As you do for TOP-OF-PAGE event)....and in this event you can change the values in runtime (PROVIDED, this event gets triggered for ALV GRID).....
    If this does not work, i think calculating sub-totals while you build the internal table would be a better option....(If you have time constraint....else you can do some more research on the same)........
    Best Regards,
    Ram.

Maybe you are looking for

  • HELP PLEASE!! (game on ipod problems)

    i bought sodoku off itunes but now it wont go on my ipod... please help!!!

  • Does photography plan include creative cloud membership?

    I am asking because i have one year photography plan going on for about half year now and now i have been thinking of getting Muse as a single app with it. And in this video Muse users - Create and publish sites with Business Catalyst  it says that y

  • Ps not opening after double clicking

    ok i have been using photoshop cs6 since january and it worked fine but now when i double click on the the ps icon, NOTHING HAPPENS! please help me guys thanx in advance

  • Enabling mailman on ML server?

    I have a very old machine (it can't go beyond 10.4, that's how old), one of whose uses is to host a mailing list. The interface for the service was built into the Tiger admin application, but it's not accessible (if it exists) in Mountain Lion server

  • Can't see my purchases pass 30days

    I purchased CS5 from Adobe Online a while ago and a link was provided to download the suite. I now need to install CS5 on my new computer but can't find the link in MY ORDERS, it states that I have no orders pass 30days. Where can I find the link to