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.

Similar Messages

  • How to display sub total text in ALV grid display reporting

    Hi,
    I want to display a text 'SUB TOTAL'  in Sub total  row  of an ALV report.
    Presently I am getting the name of the field used in sorting to get sub totals. But I required to display own text. Could you please give me solution.
    Thanks
    Giridhar Karnam

    For doing this u need to simply modify the layout properties, please award points if found helpful
    DATA: L_LAYOUT TYPE SLIS_LAYOUT_ALV.
    L_LAYOUT-SUBTOTALS_TEXT = 'GEN SUBTOT'.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            I_CALLBACK_PROGRAM = SY-REPID
            IS_LAYOUT          = L_LAYOUT
            IT_FIELDCAT        = IT_FIELDCAT
          TABLES
            T_OUTTAB           = IT_FINAL
          EXCEPTIONS
            PROGRAM_ERROR      = 1
            OTHERS             = 2.

  • 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 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 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

  • Problem in displaying sub-totals using a structure displayed as hierarchy

    In a report, i'd like to display in rows a characteristic and a structure. All of that displayed as a 2 levels hierarchy.
    Results on structure rows doesnt aggregate themselves on characteristic rows. I have no result on my first level of hierarchy?

    Hi,
       Write as :
       loop at <internal_table> ....
          V_TBL2 = V_TBL2 + SBL1.
          V_PTBL2 = V_PTBL2 + PSBL1.
          if....
          ELSEIF ( PSCH EQ 'N' OR PSCH EQ 'O' OR PSCH EQ 'P' ).
           AT END OF SG.
              TBL2  = V_TBL2 .
              PTBL2 = V_PTBL2 .
              clear : V_TBL2 , V_PTBL2.
           ENDAT.
       ENDIF.
      ENDLOOP.
    Regards,
    Srini.

  • 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

  • ALV Sub total texts. displayed in list not in grid.

    Hi,
    I am displaying data using alv and sub-totals on a particular column.
    i am getting the sub-totals but i am not getting the sub-total texts when i am displaying data in a grid.
    'REUSE_ALV_GRID_DISPLAY'.
    i am getting subtotals and subtotal texts when i am diSplAying in list.
    'REUSE_ALV_LIST_DISPLAY'.
    but i want to get subtotal texts using alv grid, is it possible, if so please send me the code.
    Any help in this regard is highly appreciated.
    Thanks in advance for your help.

    Hi,
    Actually i have wriitten the same code, in the alv. I am using Function modules. for the same code the sub-total and total text is appearing in the list output. but not in the grid output.
    code.
      wa_layout-zebra          = 'X'.
      wa_layout-subtotals_text = 'Total'.
      wa_layout-totals_text    = 'Sum of Marks'.
    alv statement.
         is_layout = wa_layout
    Declaration.
    DATA : wa_layout type slis_layout_alv.
    for the same declarations (Above) list is showing the texts but not the grid.
    Any help in this regard is highly appreciated.

  • 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

  • Sub total wise Grand total in ALV report

    Dear All,
    I am displaying a list of material through material group wise so for each material i want to display sub-total for stock and grand total of stock(material group wise).Here it is adding up all the stock displayed for different AUOM(alternative unit of measure ) which is for same material so i want to pick only the sub-total and sum up in my Grand total.
    How to pick only the Sub-total Results and Add in ALV List for Grand total.
    Thanks & Regards,
    Arun.
    Edited by: Arun Kumaran on Sep 24, 2008 7:46 AM

    Hi arun,
    check these links
    total and subtotal in alv
    ALV SUBTOTAL
    Regards,
    Anirban

  • How to get sub totals in alv list

    Hi all,
    i have a data in internal table which need to display by alv lis display, but i need to display
    sub totals, like sub total by customer, subtotal by state, and complete total amount. In alv we have standard function
    buttons , by i need by default it is displayed when i exe my report, hope to achieve that.
    Please help me to know.
    thanks,
    rajesh

    hi Rajesh,
      Check these threads out
    http://www.sap-basis-abap.com/sapalv.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/ee/b99d37e188a049e10000009b38f8cf/content.htm
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    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'.
    <b>GS_SORT-SUBTOT    = 'X'.</b>
    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.
    Regards,
    Santosh

  • Totals and Sub-Totals in ALV GRID

    Could anyone advice, how to display sub-totals and totals in ALV Grid(using FM).
    Ex:           value1    value2
                      100        50
                      200        50
        subtotal   300      100
        total                    400
    Thanks in advance...

    Refer below demo code and see perform Sort_list..
    it wil serve ur purpose.
    REPORT  ZGILL_ALV    message-id rp                           .
    type-pools slis.
    tables: zgill_main,zgill_details.
    data z_fieldcat type slis_t_fieldcat_alv.
    data begin of itab occurs 0.
    DATA ICON TYPE ICON-ID.
         include structure zgill_main.
    data salary like zgill_details-salary.
    data end of itab.
    *data itab1 like table of itab with header line.
    data : WA_SORT TYPE SLIS_SORTINFO_ALV,
           IT_SORT TYPE SLIS_T_SORTINFO_ALV,
           WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
           IT_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV,
           WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    PARAMETERS: p_list  radiobutton group A1,
                P_GRID  RADIOBUTTON GROUP A1.
    SELECT-OPTIONS: S_PERNR FOR ZGILL_MAIN-PERNR.
    start-of-selection.
    perform fill_itab.
    perform sort_list.
    **************Start of scenario without container******************************************
    *********Method 1***********
    perform fill_fieldcat.  " Manuallly Preparing Fiedl Catalog
    *********Method 2***********
    *perform fill_fieldcat1 changing z_fieldcat.   "Preparing field catalog with merge function
    perform display_alv.
    *****************end of scenario without container*****************************************
    *&      Form  fill_itab
          text
    -->  p1        text
    <--  p2        text
    form fill_itab .
    *select * from zgill_main up to 20 rows INTO CORRESPONDING FIELDS OF TABLE itab.
    *ITAB1[] = ITAB[].
    select apernr aname aorg adob b~salary INTO CORRESPONDING FIELDS OF TABLE itab
           from zgill_main as a join zgill_details as b on apernr = bpernr
           WHERE A~PERNR IN S_PERNR.
    LOOP AT ITAB.
    IF ITAB-PERNR < 1111.
    ITAB-ICON = '@08@'.
    ELSEIF ITAB-PERNR > 1111 AND ITAB-PERNR < 11111111.
    ITAB-ICON = '@09@'.
    ELSEIF ITAB-PERNR GE 11111111.
    ITAB-ICON = '@0A@'.
    ENDIF.
    MODIFY ITAB INDEX SY-TABIX.
    ENDLOOP.
    endform.                    " fill_itab
    *&      Form  display_alv
          text
    -->  p1        text
    <--  p2        text
    form display_alv .
    data repid like sy-repid.
    REPID = SY-REPID.
    WA_LAYOUT-ZEBRA = 'X'.
    WA_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'.
    WA_LAYOUT-SUBTOTALS_TEXT = 'SUBTOTAL'.
    WA_LAYOUT-TOTALS_TEXT = 'TOTAL'.
    IF P_GRID = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = repid
       IT_FIELDCAT                       = IT_FIELDTAB
       IT_SORT                           = IT_SORT
       IS_LAYOUT                         = WA_LAYOUT
    TABLES
        t_outtab                          = itab[]
    EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2.
    IF sy-subrc <> 0.
       message e016 with 'Error in Display'.
    ENDIF.
    ELSEIF P_LIST = 'X'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = repid
       IT_FIELDCAT                       = IT_FIELDTAB
       IT_SORT                           = IT_SORT
       IS_LAYOUT                         = WA_LAYOUT
    TABLES
        t_outtab                          = itab[]
    EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2.
    IF sy-subrc <> 0.
       message e016 with 'Error in Display'.
    ENDIF.
    ENDIF.
    endform.                    " display_alv
    *&      Form  fill_fieldcat1
          text
    -->  p1        text
    <--  p2        text
    form fill_fieldcat1  changing d_fcat type slis_t_fieldcat_alv.
    data repid like sy-repid.
    data d_fcat1 type slis_t_fieldcat_alv with header line.
    REPID = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = repid
       I_INTERNAL_TABNAME           = 'ITAB'
       I_STRUCTURE_NAME             = 'ZGILL_MAIN'
      I_CLIENT_NEVER_DISPLAY       = 'X'
      I_INCLNAME                   =
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
    CHANGING
        ct_fieldcat                  = d_fcat[]
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3.
    IF sy-subrc <> 0.
       message e016 with 'Error in preparing fiedl catalog'.
    ENDIF.
    loop at d_fcat into d_fcat1.
    case d_fcat1-fieldname.
    when 'NAME'.
    d_fcat1-reptext_ddic = 'Emp Name'.
    MODIFY D_FCAT FROM D_FCAT1.
    WHEN 'PERNR'.
    d_fcat1-reptext_ddic = 'Emp Num'.
    MODIFY D_FCAT FROM D_FCAT1.
    WHEN 'ORG'.
    d_fcat1-reptext_ddic = 'Org Unit'.
    MODIFY D_FCAT FROM D_FCAT1.
    endcase.
    clear d_fcat1.
    endloop.
    endform.                    " fill_fieldcat1
    *&      Form  sort_list
          text
    -->  p1        text
    <--  p2        text
    form sort_list .
    CLEAR WA_SORT.
    WA_SORT-FIELDNAME = 'DOB'.
    WA_SORT-SPOS = '1'.
    WA_SORT-UP = 'X'.
    WA_SORT-SUBTOT = 'X'.
    APPEND WA_SORT TO IT_SORT.
    CLEAR WA_SORT.
    WA_SORT-FIELDNAME = 'NAME'.
    WA_SORT-SPOS = '1'.
    WA_SORT-UP = 'X'.
    APPEND WA_SORT TO IT_SORT.
    CLEAR WA_SORT.
    endform.                    " sort_list
    *&      Form  fill_fieldcat
          text
    -->  p1        text
    <--  p2        text
    form fill_fieldcat .
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'ITAB'.
    WA_FIELDCAT-FIELDNAME = 'ICON'.
    WA_FIELDCAT-SELTEXT_L = 'TRAFFIC'.
    WA_FIELDCAT-ICON = 'X'.
    WA_FIELDCAT-ddictxt = 'l'.
    WA_FIELDCAT-COL_POS = 1.
    WA_FIELDCAT-OUTPUTLEN = 10.
    APPEND WA_FIELDCAT TO IT_FIELDTAB.
    CLEAR WA_FIELDCAT .
    WA_FIELDCAT-TABNAME = 'ITAB'.
    WA_FIELDCAT-FIELDNAME = 'PERNR'.
    WA_FIELDCAT-SELTEXT_L = 'EMP NUMBER'.
    WA_FIELDCAT-ddictxt = 'l'.
    WA_FIELDCAT-COL_POS = 2.
    WA_FIELDCAT-OUTPUTLEN = 10.
    APPEND WA_FIELDCAT TO IT_FIELDTAB.
    CLEAR WA_FIELDCAT .
    when 'maktx'.
    WA_FIELDCAT-TABNAME = 'ITAB'.
    WA_FIELDCAT-FIELDNAME = 'NAME'.
    WA_FIELDCAT-SELTEXT_L = 'EMP NAME'.
    WA_FIELDCAT-ddictxt = 'l'.
    WA_FIELDCAT-COL_POS = 3.
    WA_FIELDCAT-OUTPUTLEN = 15.
    APPEND WA_FIELDCAT TO IT_FIELDTAB.
    CLEAR WA_FIELDCAT .
    WA_FIELDCAT-TABNAME = 'ITAB'.
    WA_FIELDCAT-FIELDNAME = 'ORG'.
    WA_FIELDCAT-SELTEXT_L = 'ORG UNIT'.
    WA_FIELDCAT-COL_POS = 4.
    WA_FIELDCAT-OUTPUTLEN = 10.
    APPEND WA_FIELDCAT TO IT_FIELDTAB.
    CLEAR WA_FIELDCAT .
    WA_FIELDCAT-TABNAME = 'ITAB'.
    WA_FIELDCAT-FIELDNAME = 'DOB'.
    WA_FIELDCAT-SELTEXT_L = 'BIRTH DATE'.
    WA_FIELDCAT-COL_POS = 5.
    WA_FIELDCAT-OUTPUTLEN = 12.
    APPEND WA_FIELDCAT TO IT_FIELDTAB.
    CLEAR WA_FIELDCAT .
    WA_FIELDCAT-TABNAME = 'ITAB'.
    WA_FIELDCAT-FIELDNAME = 'SALARY'.
    WA_FIELDCAT-SELTEXT_L = 'SALARY'.
    WA_FIELDCAT-COL_POS = 6.
    WA_FIELDCAT-OUTPUTLEN = 25.
    WA_FIELDCAT-do_sum = 'X'.
    APPEND WA_FIELDCAT TO IT_FIELDTAB.
    endform.                    " fill_fieldcat

  • Regarding sub totaling in alv

    hi,
    i am making report in alv in which i have to display the sub totals and den full total.
    is it possible to display sub total in ALV acccording to material type wise or itemid wise.
    plzz help me with some example.
    If find useful he or she will definately rewarded.........

    Hi, 
    The following example for sub totall for ALV  report..
    u have to pass do_sum = 'X'. for perticuler fileds.
    if it is use full answer reward me a points..
    *& Report  ZDEL_ALV1
    *Description:        This ALV interactive report is display Delivary
                       status
    REPORT  zdel_alv1 NO STANDARD PAGE HEADING LINE-SIZE 255 LINE-COUNT 60.
    *TABLE DECLARATION
    TABLES : likp,                     "Delivery Header Data
             lips,                     "Delivery item Data
             vbup.                     "sales document item status
    TYPE-POOLS : slis.
    *SRUCTURE DECLARATION
    *THIS TABLE FOR HEADER DETAILS
    TYPES : BEGIN OF t_likp ,
            vbeln LIKE likp-vbeln,     "Delivery number
            kosta like vbup-kosta,
            kunnr LIKE likp-kunnr,     "Customer number
            wadat LIKE likp-wadat,     "Planned goods movement date
            ernam LIKE likp-ernam,     "Name of person
            vkorg LIKE likp-vkorg,     "Sales organization
            lfart LIKE likp-lfart,      "DELIVERY TYPE
            ntgew LIKE likp-ntgew,      "NET WEIGHT
            END OF t_likp.
    *THIS TABLE FOR ITEM DETAILS
    TYPES : BEGIN OF t_lips ,
            vbeln LIKE lips-vbeln,     "Delivery number
            posnr LIKE lips-posnr,     "delivery item
            matnr LIKE lips-matnr,     "Material number
            lfimg LIKE lips-lfimg,     "Actual quantity delivered
            ntgew LIKE lips-ntgew,     "Net weight
            exbwr LIKE lips-exbwr,     "Externally entered posting amount
            arktx LIKE lips-arktx,     "Short text SO Item
            END OF t_lips.
    *THIS IS FOR FINAL OUTPUT
    TYPES : BEGIN OF t_vbup ,
            vbeln LIKE likp-vbeln,     "Delivery number
            kosta LIKE vbup-kosta,     "Picking status/Putaway status
            posnr LIKE vbup-posnr,     "delivery item
            matnr LIKE lips-matnr,     "Material number
            lfimg LIKE lips-lfimg,     "Actual quantity delivered
            ntgew LIKE lips-ntgew,     "Net weight
            exbwr LIKE lips-exbwr,     "Externally entered posting amount
            arktx LIKE lips-arktx,     "SHORT text SO Item
            description(20),           "for display text
            END OF t_vbup.
    *INTERNAL TABLES
    DATA : i_likp TYPE STANDARD TABLE OF t_likp.
    DATA : i_lips TYPE STANDARD TABLE OF t_lips.
    DATA : i_vbup TYPE STANDARD TABLE OF t_vbup.
    DATA : repid LIKE sy-repid.
    DATA : delivar1(10) TYPE c.
    *WORK AREA
    DATA : wa_likp TYPE t_likp.
    DATA : wa_lips TYPE t_lips.
    DATA : wa_vbup TYPE t_vbup.
    DATA:  i_vbup1 LIKE wa_vbup OCCURS 0 WITH  HEADER LINE.
    *SLIS TABLE DECLARATIONS
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv  WITH HEADER LINE,
          i_events TYPE slis_t_event,
          w_events TYPE slis_alv_event,
          i_fieldcat1 TYPE slis_t_fieldcat_alv  WITH HEADER LINE,
          i_layout TYPE slis_layout_alv.
    *SELECTING RANGE OF VALUES
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_vbeln  FOR likp-vbeln,
                     s_kunnr  FOR likp-kunnr,
                     s_wadat  FOR likp-wadat.
    SELECTION-SCREEN END OF BLOCK b1 .
    *CHOOSE ONE CHECK BOX FOR DISPLAYING THE DELIVARY STATUS
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS : cb_kostc AS CHECKBOX,"DEFAULT 'X',
                 cb_kosta AS CHECKBOX,
                 cb_kostb AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK b2.
    *INTIALIZATION CHECK
    INITIALIZATION.
      repid = sy-repid.
    *START-OF-SELECTION
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM get_field.
    PERFORM GET_EVENTS.
      PERFORM display.
    *END-OF-SELECTION
    END-OF-SELECTION.
    *&      Form  RUCOMM
          This form getting details from lips table for displaying
           the item details and all select statements for delivary status
         -->R_UCOMM    text
         -->RS_SELFIELDtext
    FORM user_command USING r_ucomm LIKE sy-ucomm  rs_selfield TYPE
                                                   slis_selfield.
      IF rs_selfield-fieldname = 'VBELN'.
        delivar1 = rs_selfield-value.
      ENDIF.
      IF cb_kostc = 'X'.
      SELECT   VBELN KOSTA   FROM   VBUP
      INTO TABLE I_VBUP
      WHERE  VBELN IN DELIVAR
      AND KOSTA = 'C'.
      SELECT VBELN MATNR LFIMG EXBWR INTO TABLE I_LIPS FROM LIPS
                                        WHERE VBELN EQ DELIVAR1.
        REFRESH i_vbup1[].
        CLEAR i_vbup1.
        SELECT avbeln akosta bposnr bmatnr blfimg bntgew b~exbwr
        b~arktx
        INTO TABLE i_vbup
        FROM vbup AS a INNER JOIN lips AS b
        ON avbeln = bvbeln
        WHERE a~vbeln EQ delivar1
           AND kosta = 'C'.
      ELSEIF cb_kosta = 'X'.
      SELECT   VBELN KOSTA   FROM   VBUP
      INTO TABLE I_VBUP
      WHERE  VBELN IN DELIVAR
      AND KOSTA = 'A'.
        SELECT avbeln akosta bposnr bmatnr blfimg bntgew b~exbwr
        b~arktx
        INTO TABLE i_vbup
        FROM vbup AS a INNER JOIN lips AS b
        ON avbeln = bvbeln
        WHERE a~vbeln EQ delivar1
           AND kosta = 'A'.
      ELSEIF cb_kostb = 'X'.
        SELECT   VBELN KOSTA   FROM   VBUP
      INTO TABLE I_VBUP
      WHERE  VBELN IN DELIVAR
      AND KOSTA = 'B'.
        SELECT avbeln akosta bposnr bmatnr blfimg bntgew b~exbwr
        b~arktx
        INTO TABLE i_vbup
        FROM vbup AS a INNER JOIN lips AS b
        ON avbeln = bvbeln
        WHERE a~vbeln EQ delivar1
           AND kosta = 'B'.
      ENDIF.
      CLEAR i_vbup1.
      LOOP AT i_vbup INTO wa_vbup.
        i_vbup1-vbeln = wa_vbup-vbeln.
        i_vbup1-kosta = wa_vbup-kosta.
        IF wa_vbup-kosta = 'C'.
          i_vbup1-description = 'COMPLETELY PROCESSED'.
        ELSEIF wa_vbup-kosta = 'B'.
          i_vbup1-description = 'PARTIALLY PROCESSED'.
        ELSEIF wa_vbup-kosta = 'A'.
          i_vbup1-description = 'NOT YET PROCESSED'.
        ENDIF.
        i_vbup1-posnr = wa_vbup-posnr.
        i_vbup1-matnr = wa_vbup-matnr.
        i_vbup1-lfimg = wa_vbup-lfimg.
        i_vbup1-ntgew = wa_vbup-ntgew.
        i_vbup1-exbwr = wa_vbup-exbwr.
        i_vbup1-arktx = wa_vbup-arktx.
        APPEND i_vbup1 .
      ENDLOOP.
      SORT i_vbup1 BY vbeln matnr lfimg.
      DELETE ADJACENT DUPLICATES FROM i_vbup1 COMPARING vbeln matnr lfimg.
    SELECT VBELN MATNR LFIMG EXBWR INTO TABLE I_LIPS FROM LIPS
                                         WHERE VBELN EQ DELIVAR1.
    *This function module for displaying the item details
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = repid
          it_fieldcat             = i_fieldcat1[]
          i_callback_top_of_page  = 'TOP_OF_PAGE'
          i_callback_user_command = 'USER_COMMAND1'
          it_events               = i_events
        TABLES
          t_outtab                = i_vbup1
        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.
      CLEAR i_vbup1.
    ENDFORM.                    "RUCOMM
    *&      Form  USER_COMMAND1
          text
         -->R_UCOMM1   text
         -->RS_SELFIELDtext
    FORM user_command1 USING r_ucomm1 LIKE sy-ucomm  rs_selfield1 TYPE
                                                     slis_selfield.
      DATA: deliv(10) TYPE c.
      IF rs_selfield1 = 'VBELN'.
        deliv = rs_selfield1-value.
      ENDIF.
      SET PARAMETER ID 'VL' FIELD delivar1.
      CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
    ENDFORM.                    "USER_COMMAND1
    *&      Form  GET_DATA
          This form for getting the data from likp table
    -->  p1        text
    <--  p2        text
    FORM get_data .
    SELECT VBELN KUNNR WADAT FROM LIKP INTO TABLE I_LIKP
                                     WHERE VBELN IN S_VBELN
                                     AND KUNNR IN S_KUNNR
                                     AND WADAT IN S_WADAT.
      REFRESH i_likp[].
      CLEAR i_likp.
      IF cb_kostc = 'X' AND cb_kosta = ' ' AND cb_kostb = ''.
        SELECT avbeln akosta bkunnr bwadat bernam bvkorg blfart bntgew
        INTO TABLE i_likp
        FROM vbup AS a INNER JOIN likp AS b
        ON avbeln = bvbeln
        WHERE
              b~kunnr IN s_kunnr
              AND b~vbeln IN s_vbeln
              AND b~wadat IN s_wadat
               AND a~kosta = 'C'.
      ELSEIF cb_kosta = 'X' AND cb_kostb = ' ' AND cb_kostc = ''.
        SELECT avbeln akosta bkunnr bwadat bernam bvkorg blfart bntgew
           INTO TABLE i_likp
           FROM vbup AS a INNER JOIN likp AS b
           ON avbeln = bvbeln
           WHERE
                 b~kunnr IN s_kunnr
                 AND b~vbeln IN s_vbeln
                 AND b~wadat IN s_wadat
                  AND a~kosta = 'A'.
      ELSEIF cb_kostb = 'X' AND cb_kosta = '' AND cb_kostc = ''.
        SELECT avbeln akosta bkunnr bwadat bernam bvkorg blfart bntgew
           INTO TABLE i_likp
           FROM vbup AS a INNER JOIN likp AS b
           ON avbeln = bvbeln
           WHERE
                 b~kunnr IN s_kunnr
                 AND b~vbeln IN s_vbeln
                 AND b~wadat IN s_wadat
                  AND kosta = 'B'.
      ELSEIF cb_kostc = 'X' AND cb_kosta = 'X' AND cb_kostb = 'X'.
        SELECT avbeln akosta bkunnr bwadat bernam bvkorg blfart bntgew
        INTO TABLE i_likp
        FROM vbup AS a INNER JOIN likp AS b
        ON avbeln = bvbeln
        WHERE
              b~kunnr IN s_kunnr
              AND b~vbeln IN s_vbeln
              AND b~wadat IN s_wadat
              AND kosta NE ' '.
      ENDIF.
      DELETE ADJACENT DUPLICATES FROM i_likp.
    ENDFORM.                    " GET_DATA
    *&      Form  GET_FIELD
          This form for defining the every fields from likp & lips tables
    FORM get_field .
    *This fields are retrieving from header table(likp)
      CLEAR i_fieldcat.
      i_fieldcat-fieldname = 'VBELN'.
      i_fieldcat-seltext_m = 'SALES ORDER NO'.
      APPEND i_fieldcat TO i_fieldcat.
      CLEAR i_fieldcat.
      i_fieldcat-fieldname = 'KUNNR'.
      i_fieldcat-seltext_m = 'CUSTOMER NO'.
      APPEND i_fieldcat TO i_fieldcat.
      CLEAR i_fieldcat.
      i_fieldcat-fieldname = 'WADAT'.
      i_fieldcat-seltext_m = 'DATE'.
      APPEND i_fieldcat TO i_fieldcat.
      CLEAR i_fieldcat.
      i_fieldcat-fieldname = 'ERNAM'.
      i_fieldcat-seltext_m = 'NAME OF PERSON'.
      APPEND i_fieldcat TO i_fieldcat.
      CLEAR i_fieldcat.
      i_fieldcat-fieldname = 'VKORG'.
      i_fieldcat-seltext_m = 'SALES ORGANIZATION'.
      APPEND i_fieldcat TO i_fieldcat.
      CLEAR i_fieldcat.
      i_fieldcat-fieldname = 'LFART'.
      i_fieldcat-seltext_m = 'DELIVERY TYPE'.
      APPEND i_fieldcat TO i_fieldcat.
      CLEAR i_fieldcat.
      i_fieldcat-fieldname = 'NTGEW'.
      i_fieldcat-seltext_m = 'NET WEIGHT'.
      i_fieldcat-do_sum = 'X'.
      APPEND i_fieldcat TO i_fieldcat.
      CLEAR i_fieldcat.
    *This fields are retrieving from item table(lips)
      CLEAR i_fieldcat1.
      i_fieldcat1-fieldname = 'VBELN'.
      i_fieldcat1-seltext_m = 'DELIVAR NO'.
      APPEND i_fieldcat1 TO i_fieldcat1.
      CLEAR i_fieldcat1.
      i_fieldcat1-fieldname = 'POSNR'.
      i_fieldcat1-seltext_m = 'DELIVERY ITEM'.
      APPEND i_fieldcat1 TO i_fieldcat1.
      CLEAR i_fieldcat1.
      i_fieldcat1-fieldname = 'MATNR'.
      i_fieldcat1-seltext_m = 'MATERIAL NO'.
      APPEND i_fieldcat1 TO i_fieldcat1.
      CLEAR i_fieldcat1.
      i_fieldcat1-fieldname = 'LFIMG'.
      i_fieldcat1-seltext_m = 'ACTUAL QUANTITY'.
      i_fieldcat1-do_sum    = 'X'.
      APPEND i_fieldcat1 TO i_fieldcat1.
      CLEAR i_fieldcat1.
      i_fieldcat1-fieldname = 'NTGEW'.
      i_fieldcat1-seltext_m = 'NET WEIGHT'.
      i_fieldcat1-do_sum = 'X'.
      APPEND i_fieldcat1 TO i_fieldcat1.
      CLEAR i_fieldcat1.
      i_fieldcat1-fieldname = 'EXBWR'.
      i_fieldcat1-seltext_m = 'AMOUNT'.
      APPEND i_fieldcat1 TO i_fieldcat1.
      CLEAR i_fieldcat1.
      i_fieldcat1-fieldname = 'ARKTX'.
      i_fieldcat1-seltext_m = 'SHORT TEXT FOR so ITEM'.
      APPEND i_fieldcat1 TO i_fieldcat1.
      CLEAR i_fieldcat1.
      i_fieldcat1-fieldname = 'DESCRIPTION'.
      i_fieldcat1-seltext_m = 'PICKING STATUS'.
      APPEND i_fieldcat1 TO i_fieldcat1.
      CLEAR i_fieldcat1.
    ENDFORM.                    " GET_FIELD
    *&      Form  GET_EVENTS
          This form defining the events
    *FORM GET_EVENTS .
    CLEAR W_EVENTS.
    W_EVENTS-NAME = 'USER_COMMAND'.
    W_EVENTS-FORM = 'RUCOMM'.
    APPEND W_EVENTS TO I_EVENTS.
    *ENDFORM.                    " GET_EVENTS
    *&      Form  DISPLAY
         This form is going to display header details from likp table
    FORM display .
    *This function module for displaying the header details
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = repid
          i_callback_top_of_page  = 'TOP-OF-PAGE'
          i_callback_user_command = 'USER_COMMAND'
          it_fieldcat             = i_fieldcat[]
          i_save                  = 'X'
          it_events               = i_events
        TABLES
          t_outtab                = i_likp
        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
    *&      Form  TOP-OF-PAGE
        This form is going to display top-of-page header text
    FORM top-of-page.
      DATA:  i_list_comments TYPE slis_t_listheader.
      DATA:  w_list_comments TYPE slis_listheader.
      CLEAR: i_list_comments[].
      w_list_comments-typ  = 'H'. "H=Header, S=Selection, A=Action
      w_list_comments-info = 'DELIVERY ORDER DETAILS'.
      APPEND w_list_comments TO i_list_comments.
      w_list_comments-typ  = 'A'. " H = Header, S = Selection, A = Action
      w_list_comments-info = 'Basic list'.
      APPEND w_list_comments TO i_list_comments.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          i_logo             = 'enjoy'
          it_list_commentary = i_list_comments.
    ENDFORM.                    "TOP-OF-PAGE
    *&      Form  TOP_OF_PAGE
           This form is going to display top-of-page item text
    FORM top_of_page.
      DATA:  i_list_comments TYPE slis_t_listheader.
      DATA:  w_list_comments TYPE slis_listheader.
      DATA : i_line LIKE w_list_comments-info.
      CONCATENATE 'DELIVERY ITEM DETAILS :' delivar1 INTO i_line .
    SEPARATED BY SPACE.
      CLEAR: i_list_comments[].
      w_list_comments-typ  = 'H'. "H=Header, S=Selection, A=Action
      w_list_comments-info = i_line.
      APPEND w_list_comments TO i_list_comments.
      w_list_comments-typ  = 'A'. " H = Header, S = Selection, A = Action
      w_list_comments-info = 'Secondary list'.
      APPEND w_list_comments TO i_list_comments.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          i_logo             = 'enjoy'
          it_list_commentary = i_list_comments.
    ENDFORM.                    "TOP_OF_PAGE

  • Sub Total display in Samrtforms

    Hi ,
    I need to display sub totals in my smartform.Infact I have used Calcualtions Tab Under TABLE with Operation "Total"  and Time "After Loop"  which is displaying wrong values when Internal Table values are spanned to multiple pages. Can any body help me.
    Regards,
    Srinivas

    >
    SRINI VASA wrote:
    > I can not create any text node after Main Window and according to my requirement, I need to display my sub total in footer of my table inside Main Window.
    "..............Main window
    ".......................Table with loop
    "...........................main area with flow logic calculate sum here in some temp variable
    "..................................footer, print here your temp with text node
    No need to create text node after main window

Maybe you are looking for

  • Can't find printer in epson printer utility

    just set up new epson sylus photo r220. works great but can't check ink levels because when i open epson printer utility no printers show up. if i try opening the printer fron the "print & fax" box in system preferences and click on "supply levels" i

  • Custom report for a form help

    Hi We have just completed a competition where we collected customer details. The email address field had to be non mandatory so we hid the mandatory field in the code creating a default email to get around it, and created our own text field for email

  • Sender SOAP Adapter

    Hi, Scenario is Sender SOAP and Receiver (Server Proxy) . Integrated the ESS applications on .net portal using soap adapter..example salary slip, ctcview.... If we give input as empno to soap adapter it will give you salary details back to .net porta

  • Kern protection error from Call of Duty 2 game

    Hey everyone,  I was told if anyone could help me it would be on here. Over the last few weeks I started getting the odd kern protection error while playing my Call of Duty 2 game.  I have had this game for years and this had never happened before. O

  • Low-quality iPhone images from Aperture 2.0

    Hi. I'm trying Aperture 2.0, and I configured iTunes to sync some photos from Aperture with my iPhone. The problem is, the photos on my iPhone from Aperture are noticeably lower in quality than those synced from iPhoto. The images are blurry and look