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

Similar Messages

  • Sub totals display

    hai friends
    iam useing alv grid display to dispaly the report
    in that report i have LIFNR,BUKRS,BUDAT,DMBTR ,      SHKZG,WAERS  from BSIK table
    the problem is
    SHIKZG field we have values like S and H.
    so particular LIFNR may have both S and H values
    hear the requirement is
    in particular LIFNR     S valus should be subtracted from H values . and display the total after subtacting in sub totals.
    how can i do this
    pls any body help me
    thanks
    srikanth vipparla

    Your requirement is not clear how ever you can try this
    Right click on the characterustic and select display tab in that select Supress result rows -> Never
    It will give you the subtotals.
    If that does not work out follow the link and see if that is what you want. If none is helpful please elaborate your requirement with some numbers.
    http://help.sap.com/saphelp_nw04s/helpdata/en/03/17f13a2f160f28e10000000a114084/frameset.htm
    Hope this helps.
    ~Abhijit

  • Blocked ALV sub total Display

    hi,
    I'm working with Blocked ALV. In my program, passed the  Fieldcatlog-do_sum = 'X' . But then also i'm not getting totals. For that what i want to do in Blocked ALV.
    Regards,
    Bab

    Hi,
    For ALV Totals you can try doing,
    DATA : it_field TYPE slis_t_fieldcat_alv,
                 wa_field TYPE slis_fieldcat_alv.
    DATA:  itab_sort TYPE slis_t_sortinfo_alv,
                 wa_sort TYPE slis_sortinfo_alv.
      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'.              "For totalling
      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'.              "For totalling
      APPEND wa_sort TO itab_sort.
      CLEAR wa_sort.
    Then you can pass these two internal tables in Reuse ALV grid Function Module.
    Hope it helps
    Regards
    Mansi

  • Query Designer - Structure - Sub-totals display

    Hi
    I am currently creating a structure with different levels and I woul like to have the subtotal I calculate in the various formulas in the structure below the data and not above like it is now.
    For example now :
    lvl1Total Net Sales
    ***lvl2Gross Sales
    ***lvl2Discounts
    What I would like :
    ***lvl2Gross Sales
    ***lvl2Discounts
    lvl1Total Net Sales
    I tried in the query properties/ Row & Colums to change  'result position' but it does not work.
    Anyone has a clue ?
    Thank you very mucn
    Edited by: Nico0 on Mar 4, 2009 4:39 PM

    Your requirement is not clear how ever you can try this
    Right click on the characterustic and select display tab in that select Supress result rows -> Never
    It will give you the subtotals.
    If that does not work out follow the link and see if that is what you want. If none is helpful please elaborate your requirement with some numbers.
    http://help.sap.com/saphelp_nw04s/helpdata/en/03/17f13a2f160f28e10000000a114084/frameset.htm
    Hope this helps.
    ~Abhijit

  • Sub Total Button in Report Painter Output

    Hi,
    I am working on the Balance Sheet Report in the Report Painter and i am trying to display the sub totaling display in the output.
    In this i had defined the row which is based on the range of Account Number and it has the series i.e. 100000,30000,200000 etc..
    Is it possible to display the output sub total on the basis of the Account Number Series which is mentioned above. As in a ALV Report we have the sub total button  in report output.
    If it is,then please provide me guidelines for it ......
    Edited by: ricx .s on Jul 29, 2009 6:47 AM

    Hi,
    Try this code,
    it working,
    Data :  X_SORT      TYPE SLIS_SORTINFO_ALV,
    IT_SORT     TYPE SLIS_T_SORTINFO_ALV,
    X_SORT-SPOS = 1.                                " Field number of ALV on which u want to sort
      X_SORT-FIELDNAME = 'SEGMENT' .     " field name
      X_SORT-TABNAME = 'IT_ALV1'(001).  "table name same as ur alv table name
      X_SORT-UP = 'X'.                                   " put up as 'X'
      X_SORT-SUBTOT = 'X'.                      " Sub total allowed
      APPEND X_SORT TO IT_SORT.          "append
      CLEAR X_SORT.                                "clear x_SORT
    "in ALV_GRID_DISPLAY pass the it sort in it_SORT
    IT_SORT                 =   IT_SORT
    Thanks
    Arun Kayal

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

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

  • On cross tab, sub totals are not displaying...

    i build the cross tab report.
    region  period    status_cnt
    ========================
    south   apr-07     10
         may-07     10     
         jun-07     15
            sub-total 35
    north   apr-07     18
         may-07     75     
         jun-07     15
            sub-total 108
    grandtotoal 143and when i applying subtotal and grand totals its returning nulls.
    i tried sum,cell sum but didn't worked out.
    and i am not suppose to use cellsum distinct (status_cnt is repeating.)
    how i have to display subtotals and grand totals in my cross-tab report.
    i am using OracleBI Discoverer Plus 10g (10.1.2.1)

    Hi,
    try to cerate a new calc :
    nvl(status_cnt,0)
    and create the totals on it,
    I think you got nulls in that column so it wont aggregate properly.

  • Help needed with the display of sub-totalling

    Hi,
    I am looking for some help in determining how to count only Y's in a column and then display them in the sub-total row.
    Client      Participant      Prod 1     Prod 2     Prod 3     
    XXXXXX     White, James     Y     N     N     
    XXXXXX Jones James      N     N     N     
    XXXXXX Brown, James      Y     Y     N     
    XXXXXX White, James      Y     Y     Y     
    XXXXXX Rmanth, James      Y     Y     Y     
    XXXXXX Pink, James A     N     N     N     
    XXXXXX Black, James A     N     Y     N     
    Product Counts          4     4     2
    Edited by: user10693087 on Jan 2, 2011 5:44 PM
    Edited by: user10693087 on Jan 2, 2011 5:46 PM
    Edited by: user10693087 on Jan 2, 2011 5:47 PM

    Anyone has any suggestions for my question. Any help is much appreciated. Thanks.

  • How to dynamically calculate sub-total of rows and display when member changes in Hyperion Financial Report

    Requirement - I am writing a very  large reports from Hyperion Performance Cost management.
    Account is in Row. We are taking all level0 members in Row. In columns we are taking Entity,Cost Centers
    Current Structure of the Report
    41100  Entity1 Cost center1 20
    41100  Entity1 Cost center2 30
    41100  Entity1 Cost cenetr3 40
    41200  Entity 10 Cost center1 200
    41200  Entity 10 Cost center2 210
    41200  Entity 10 Cost center3 200
                 Grand Total  1000 ( For Example)
    User wants to dynamically add a sub total into the report when account (41200,41100) changes i.e. This is because , its a very large report of 100's of pages,
    Future State
    41100  Entity1 Cost center1 20
    41100  Entity1 Cost center2 30
    41100  Entity1 Cost cenetr3 40
    sub total 1 --------------------------90 ( This line should be automatically inserted here)
    41200  Entity 10 Cost center1 200
    41200  Entity 10 Cost center2 210
    41200  Entity 10 Cost center3 200
    sub total (n) -------------------------610  ( This line should be automatically inserted here)
                 Grand Total  1000 ( For Example)

    Hello,
    maybe re-consider this approach and say no to the users who request this. Try to think about other solutions.
    Sometimes a "no" helps them more than doing what they ask.
    You might export the whole in Excel. Then they can make their subtotals at every line.
    Regards,
    Philip.

  • Creation of Sub-Totals within Groups

    Hi - hope this is me just being a plank but I've hit a brick wall whilst trying to recreate a set of management accounts. So far the report has just two Groups - call them A & B for ease. Group B summarizes the detail and Group A neatly collects the results from Group B.
    Group A  comprises 6 parts all doing their bit and all the standard Crystal Sub-Totals (Summaries) work just fine. The problem I encounter is when I need to insert another Sub-Total into Group A which summarizes multiple parts of Group A e.g. Part 1 is Sales, Part 2 is Cost of sales, Part 3 is Labour, Part 4 is Expenses, Part 5 is Other and Part 6 is Depreciation. I need to insert a Sub-Total between Parts 3 and 4 which basically gives a total of Sales minus Cost of Sales minus Labour and to then continue with Parts 4 to 6. This is obviously a huge simplification of the issue but an answer to this would let me proceed with everything else.
    I've tried creating an line so I can add a formula for this by giving it a name of its own in Group A but it fails to appear on the report. I've also tried the 'Insert Section Below' option and whilst I can suppress it where necessary the formula just picks up values from the last entry on the Detail Section.
    Any ideas where I am making some elementary mistakes and is there an easy solution? Many thanks

    Hi,
      Try to create a manual running total formula for summing the fields with a condition.
    Create a @reset formula and place it report header:
    formula:
    whileprintingrecords;
    numbervar i:=0;
    Create a @eval formula and place it in group header A:
    formula:
    whileprintingrecords;
    numbervar i;
    if {groupname.field} = 'Labour' or {groupname.field} = 'Expenses'  then
    i:= i + {summary.field};
    Create a @display formula and place it in report footer;
    formula:
    whileprintingrecords;
    numbervar i;
    Hope this helps!
    Regards,
    Vinay

  • Short dump when I do total or sub total in the ALV report

    Hi,
    When I do total or sub-total on the currency field in the ALV report, it'll give a short dump like
    " The current application program detected a situation which really
    should not occur. Therefore, a termination with a short dump was
    triggered on purpose by the key word MESSAGE (type X)".
       Short text of error message:
       Technical information about the message:
       Message classe...... "0K"
       Number.............. 000
       Variable 1.......... " "
       Variable 2.......... " "
       Variable 3.......... " "
       Variable 4.......... " "
       Variable 3.......... " "
       Variable 4.......... " "
    Trigger Location of Runtime Error
        Program                                 SAPLSLVC
        Include                                 LSLVCF36
        Row                                     2,726
        Module type                             (FORM)
        Module Name                             FILL_DATA_TABLE
    sometime when I do the page down on the ALV report, the same short dump is coming.
    Can anyone help me out.
    Thanks
    Selva

    Hi,
    I'm getting this short dump in the standard program.
    I'm getting ALV report display perfectly. the problem is, when I do total or subtotal on the currency fields.
    2704
    2705 ************************************
    2706 * Column per Fieldcat Entry
    2707 ************************************
    2708         ls_lvc_data-value = space.
    2709         clear ls_lvc_data-style.
    2710         loop at it_fcat_local assigning <ls_fcat>
    2711                 where tech ne 'X' and no_out ne 'X'.
    2712           if l_invisible eq 'X'.
    2713             clear l_invisible.
    2714             if <ls_fcat>-do_sum is initial.
    2715               continue.
    2716             else.
    2717               clear ls_lvc_data-col_pos.
    2718             endif.
    2719           endif.
    2720
    2721           add 1 to ls_lvc_data-col_pos.
    2722
    2723           assign component <ls_fcat>-fieldname
    2724                            of structure <ls_data> to <l_field_value>.
    2725           if sy-subrc ne 0.
    >>>>>             message x000(0k).
    2727           endif.
    2728
    in this standard program, I'm getting the dump. the line is mentioned above in the code.

  • Alv sub total problem

    hi,
    in alv i want sub total text for purchase order.
    can you check my code . i am not getting.
    TYPE-POOLS: slis.
    TABLES: ekko,ekpo,eket.
    TYPES: BEGIN OF ty_ekko,
            lifnr TYPE elifn,
            ebeln TYPE ebeln,
            ebeln1 TYPE ebeln,
            bsart TYPE esart,
            ekorg TYPE ekorg,
            ekgrp TYPE bkgrp,
            ernam TYPE ernam,
           END OF ty_ekko,
           BEGIN OF ty_ekpo,
            ebeln TYPE ebeln,
            matnr TYPE matnr,
            ebelp TYPE ebelp,
            ebelp1 TYPE ebelp,
            menge TYPE bstmg,
            meins TYPE bstme,
            netpr TYPE bprei,
            werks TYPE ewerk,
           END OF ty_ekpo,
           BEGIN OF ty_eket,
            ebeln TYPE ebeln,
            ebelp TYPE ebelp,
            etenr TYPE eeten,
            eindt TYPE eindt,
           END OF ty_eket,
           BEGIN OF ty_final,
            slno TYPE sy-dbcnt,
            lifnr TYPE elifn,
            ebeln TYPE ebeln,
            ebeln1 TYPE ebeln,
            bsart TYPE esart,
            ekorg TYPE ekorg,
            ekgrp TYPE bkgrp,
            ernam TYPE ernam,
            matnr TYPE matnr,
            ebelp TYPE ebelp,
            ebelp1 TYPE ebelp,
            menge TYPE bstmg,
            meins TYPE bstme,
            netpr TYPE bprei,
            werks TYPE ewerk,
            eindt TYPE eindt,
           END OF ty_final.
    DATA: it_ekko TYPE STANDARD TABLE OF ty_ekko,
          it_ekpo TYPE STANDARD  TABLE OF ty_ekpo,
          it_eket TYPE STANDARD  TABLE OF ty_eket,
          it_final TYPE STANDARD TABLE OF ty_final,
          it_fieldcat TYPE slis_t_fieldcat_alv,
          it_alv_top_of_page TYPE slis_t_listheader,
          it_sort TYPE  slis_t_sortinfo_alv,
          it_event TYPE slis_t_event,
          l_repid TYPE syrepid,
          slno TYPE i VALUE 1.
    DATA: wa_ekko TYPE ty_ekko,
          wa_ekpo TYPE ty_ekpo,
          wa_eket TYPE ty_eket,
          wa_final TYPE ty_final,
          wa_fieldcat TYPE slis_fieldcat_alv,
          wa_alv_top_of_page TYPE slis_listheader,
          wa_sort TYPE  slis_sortinfo_alv,
          wa_layout   TYPE slis_layout_alv.
         wa_event TYPE slis_alv_event.
    CONSTANTS:
       c_header   TYPE char1
                  VALUE 'H',                    "Header in ALV
       c_item     TYPE char1
                  VALUE 'S'.
    SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_aedat FOR ekko-aedat.
    SELECTION-SCREEN END OF BLOCK blk.
    START-OF-SELECTION.
    PERFORM validation.
      PERFORM retrive_data.
      PERFORM sub_build_header.
      PERFORM sub_field_catalog.
      PERFORM sub_populate_layout.
      PERFORM sub_populate_sort.
      PERFORM sub_get_event.
    *END-OF-SELECTION.
    Perform to display ALV report
      PERFORM sub_alv_report_display.
    *FORM validation .
    SELECT SINGLE * FROM ekko WHERE aedat IN s_aedat .
    IF sy-subrc <> 0.
       MESSAGE e001(zram).
    ENDIF.
    *ENDFORM.                    " validation
    FORM retrive_data .
      SELECT lifnr
             ebeln
             ebeln
             bsart
             ekorg
             ekgrp
             ernam FROM ekko INTO TABLE it_ekko
            INTO CORRESPONDING FIELDS OF TABLE it_ekko
             WHERE aedat IN s_aedat .
      IF it_ekko[] IS NOT INITIAL.
        SELECT ebeln
               ebelp
               ebelp
               matnr
               menge
               meins
               netpr
               werks FROM ekpo
               INTO corresponding fields of  TABLE it_ekpo
               FOR ALL ENTRIES IN it_ekko
               WHERE ebeln = it_ekko-ebeln .
          if sy-subrc = 0.
             SELECT ebeln
               ebelp
               etenr
               eindt
               FROM eket INTO  TABLE it_eket
               FOR ALL ENTRIES IN it_ekpo
               WHERE ebeln = it_ekpo-ebeln .
            endif.
      ENDIF.
    ENDIF.
      LOOP AT it_ekko INTO wa_ekko.
        READ TABLE it_ekpo INTO wa_ekpo
                              WITH KEY ebeln = wa_ekko-ebeln.
        READ TABLE it_eket INTO wa_eket
                                WITH KEY ebeln = wa_ekpo-ebeln.
        wa_final-slno  =  slno.
        wa_final-lifnr = wa_ekko-lifnr.
        wa_final-ebeln = wa_ekko-ebeln.
        wa_final-bsart = wa_ekko-bsart.
        wa_final-ekgrp = wa_ekko-ekgrp.
        wa_final-ekorg = wa_ekko-ekorg.
        wa_final-ernam = wa_ekko-ernam.
        wa_final-ebelp = wa_ekpo-ebelp.
        wa_final-matnr = wa_ekpo-matnr.
        wa_final-menge = wa_ekpo-menge.
        wa_final-meins = wa_ekpo-meins.
        wa_final-netpr = wa_ekpo-netpr.
        wa_final-werks = wa_ekpo-werks.
        wa_final-eindt = wa_eket-eindt.
        slno = slno + 1.
        APPEND wa_final TO it_final.
      ENDLOOP.
    ENDFORM.                    " retrive_data
    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 it_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 it_alv_top_of_page.
      CLEAR: l_r_line,
             l_date.
    ENDFORM.                    " sub_build_header
    FORM sub_field_catalog .
      REFRESH it_fieldcat.
      wa_fieldcat-row_pos        = '01'.  "  p_rowpos.     "Row
      wa_fieldcat-col_pos        = '01'.       "p_colpos.     "Column
      wa_fieldcat-fieldname      = 'SLNO'.       "p_fldnam.     "Field Name
      wa_fieldcat-tabname        = 'IT_FINAL'.      "p_tabnam.     "Internal Table Name
      wa_fieldcat-just           = ' '.       "p_justif.     "Screen Justified
      wa_fieldcat-seltext_l      = 'SLNo'.       "p_seltext.    "Field Text
      wa_fieldcat-do_sum         = ' '.
      wa_fieldcat-outputlen      = '4'    .
      wa_fieldcat-no_out         = ' '.       "p_out.        "No output
      wa_fieldcat-tech           = ' '.      "p_tech.       "Technical field
      wa_fieldcat-qfieldname     = ' '.       "p_qfield.     "Quantity unit
      wa_fieldcat-qtabname       = ' '.       "p_qtab .      "Quantity table
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-row_pos        = '01'.  "  p_rowpos.     "Row
      wa_fieldcat-col_pos        = '02'.       "p_colpos.     "Column
      wa_fieldcat-fieldname      = 'LIFNR'.       "p_fldnam.     "Field Name
      wa_fieldcat-tabname        = 'IT_FINAL'.      "p_tabnam.     "Internal Table Name
      wa_fieldcat-just           = ' '.       "p_justif.     "Screen Justified
      wa_fieldcat-seltext_l      = 'Supplier Name'.       "p_seltext.    "Field Text
      wa_fieldcat-do_sum         = ' '.
      wa_fieldcat-outputlen      = '12'    .
      wa_fieldcat-no_out         = ' '.       "p_out.        "No output
      wa_fieldcat-tech           = ' '.      "p_tech.       "Technical field
      wa_fieldcat-qfieldname     = ' '.       "p_qfield.     "Quantity unit
      wa_fieldcat-qtabname       = ' '.       "p_qtab .      "Quantity table
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-row_pos        = '01'.  "  p_rowpos.     "Row
      wa_fieldcat-col_pos        = '03'.       "p_colpos.     "Column
      wa_fieldcat-fieldname      = 'EBELN'.       "p_fldnam.     "Field Name
      wa_fieldcat-tabname        = 'IT_FINAL'.      "p_tabnam.     "Internal Table Name
      wa_fieldcat-just           = ' '.       "p_justif.     "Screen Justified
      wa_fieldcat-seltext_l      = 'PO No'.       "p_seltext.    "Field Text
      wa_fieldcat-do_sum         = ' '.
      wa_fieldcat-outputlen      = '15'    .
      wa_fieldcat-no_out         = ' '.       "p_out.        "No output
      wa_fieldcat-tech           = ' '.      "p_tech.       "Technical field
      wa_fieldcat-qfieldname     = ' '.       "p_qfield.     "Quantity unit
      wa_fieldcat-qtabname       = ' '.       "p_qtab .      "Quantity table
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-row_pos        = '01'.  "  p_rowpos.     "Row
      wa_fieldcat-col_pos        = '03'.       "p_colpos.     "Column
      wa_fieldcat-fieldname      = 'EBELN1'.       "p_fldnam.     "Field Name
      wa_fieldcat-tabname        = 'IT_FINAL'.      "p_tabnam.     "Internal Table Name
      wa_fieldcat-just           = ' '.       "p_justif.     "Screen Justified
      wa_fieldcat-seltext_l      = 'PO No'.       "p_seltext.    "Field Text
      wa_fieldcat-do_sum         = ' '.
      wa_fieldcat-no_out         = ' '.       "p_out.        "No output
      wa_fieldcat-tech           = 'X'.      "p_tech.       "Technical field
      wa_fieldcat-qfieldname     = ' '.       "p_qfield.     "Quantity unit
      wa_fieldcat-qtabname       = ' '.       "p_qtab .      "Quantity table
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
    ENDFORM.                    " sub_field_catalog
    FORM sub_populate_layout .
      CLEAR wa_layout.
      wa_layout-colwidth_optimize = 'X'." Optimization of Col width
    ENDFORM.                    " sub_populate_layout
    FORM sub_populate_sort .
    Sort on material
      wa_sort-spos      = '01' .
      wa_sort-fieldname = 'EBELN'.
      wa_sort-tabname   = 'IT_FINAL'.
      wa_sort-up        = 'X'.
      wa_sort-subtot    = 'X'.
      APPEND wa_sort TO it_sort.
      CLEAR wa_sort.
    Sort on plant
      wa_sort-spos      = '02'.
      wa_sort-fieldname = 'EBELP'.
      wa_sort-tabname   = 'IT_FINAL'.
      wa_sort-up        = 'X'.
      wa_sort-subtot    = 'X'.
      APPEND wa_sort TO it_sort.
      CLEAR wa_sort.
    ENDFORM.                    " sub_populate_sort
    FORM sub_get_event .
      CONSTANTS : c_formname_subtotal_text TYPE slis_formname VALUE
                                                      'SUBTOTAL_TEXT'.
      data : wa_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 4
        IMPORTING
          et_events       = it_event
        EXCEPTIONS
          list_type_wrong = 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.
    Subtotal
      READ TABLE it_event  INTO wa_event
                        WITH KEY name = slis_ev_subtotal_text.
      IF sy-subrc = 0.
        MOVE c_formname_subtotal_text TO wa_event-form.
        MODIFY it_event FROM wa_event  INDEX sy-tabix.
      ENDIF.
    ENDFORM.                    " sub_get_event
    FORM sub_alv_report_display .
      l_repid = sy-repid .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = l_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
         i_callback_top_of_page            = 'SUB_ALV_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                         = wa_layout
       it_fieldcat                       = it_fieldcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
       it_sort                           = it_sort
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      i_default                         = 'X'
      i_save                            = 'A'
      IS_VARIANT                        =
      IT_EVENTS                         = i_event
      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
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = it_final
    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.                    " sub_alv_report_display
    FORM sub_alv_top_of_page.                                   "#EC CALLED
    To write header for the ALV
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = it_alv_top_of_page.
    ENDFORM.                    "alv_top_of_page
    FORM subtotal_text CHANGING
                   p_total TYPE any
                   p_subtot_text TYPE slis_subtot_text.
    Material level sub total
      IF p_subtot_text-criteria = 'EBELN'.
        p_subtot_text-display_text_for_subtotal
        = 'The Nett price of PO No'(009).
      ENDIF.
    Plant level sub total
      IF p_subtot_text-criteria = 'EBELP'.
        p_subtot_text-display_text_for_subtotal = 'Total Purchase Order value placed'(010).
      ENDIF.
    ENDFORM.                    "subtotal_text

    hi ,
    try the given below code ...
    "*************INTERNAL TABLE FR SORTING***********************
    DATA: it_sort TYPE slis_t_sortinfo_alv.
    "******** WORK AREA FR FIELD CATALOG *************************
    DATA: wa_sort TYPE slis_sortinfo_alv.
       wa_sort-fieldname = 'EBELN'."field name
      wa_sort-tabname = 'IT_TAB'."internal table name
      wa_sort-up = 'X'.
      wa_sort-subtot ='X'.
      APPEND wa_sort TO it_sort.
      CLEAR wa_sort.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    it_sort                           = it_sort
    ENDFORM.                    "alv
    hope this helps
    Regards
    RItesh J

  • 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

Maybe you are looking for

  • COPA derivation for Technician field of Service Order

    Hi All, I have created a character field WW001 for populating COPA documents from "Technician" field of "Service Order". I have checked and found that AFRU table is having Service Order No. (AUFNR) as well Technician (PERNR). But my problem is while

  • [CRS2008] Scheduling a report to multiple file output in single schedule

    Hi, Is there any way in CRS2008 / Infoview to scheduling one report to multiple file output in one schedule? i thought maybe it can, but still not found the way. Says, I have one report say "Report by Branch.rpt", the parameter prompt is BranchCode.

  • Do I need to create custom FM

    Hi, I have created a new z-segment to the standard idoc type. I even done the outbound processing and IDOC is reached to the destination server box. Do I need to create a new inbound function module to get the extra fields of the z-segment or else do

  • Intercompany payments

    How to configure to make vendor  payments for one company code through another company code?

  • Downgrading from iOS 4 back to 3.12, possible??

    I have an 3GS, which I updated to iOS 4 yesterday. Can I restore or downgrade back to 3.12? The multitasking seems to eat my battery, and there are a few things I don't like about the universal inbox, function & look Or can I leave iOS 4 but turn off