Home > Default > ALV - subtoal

ALV - subtoal

October 11Hits:0
Advertisement
Hi experts,
In ALV report how to hide the total amount for a particular column.
Scenario is :
waerks   netvalue      in USD
EUR         1              1.3
            2              2.6
            3              3.9
INR         1              37
            1              37
            2               74
            5               77.9
In th last line i dont want toal for netvalue.  Because there is no meaning for totaling different currencis.
pls help me to do.
Thanks.
Message was edited by:
        Murugan Arumugam

Answers

Hi Murugan
If ur doubt is about subtotals then follow this
<b>LS_FIELDCAT-DO_SUM = 'X'.</b>
<u><b>U have to use this statement for detailed concept
follow this code it may help u</b></u>
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
Follow this link
for detailes concept
http://help.sap.com/saphelp_sm32/helpdata/en/ee/b99d37e188a049e10000009b38f8cf/content.htm
<b>And if ur doubt is about is about hide then follow this</b>
<b><u>IT_TOOLBAR_EXCLUDING</u></b>
This table contains function codes of the toolbar that you want to hide for the lifetime of the ALV Grid Control. The function codes are constant attributes and are prefixed with MC_FC_.
<b>KEY</b>
<u>If this field is set, the ALV Grid Control color-codes the column as a key field and fixes this column during horizontal scrolling. The order of the key columns in the ALV Grid Control can be modified interactively. In contrast to the SAP List Viewer, the ALV Grid Control allows you to directly hide key columns with NO_OUT then use the key word</u>
<b>NO_OUT</b>
<u>If you set this field, you hide the relevant column in the list. Nevertheless, the column is available in the field selection and can be interactively selected by the user as a display field. The ALV displays the contents of hidden fields on the detail screen for a row in the grid control.</u>
To hide the entire toolbar, you can set the field “NO_TOOLBAR” of the layout structure to ‘X’.
Reward if helpfull
Regards
Pavan

Read other 14 answers

Tags:

Related Articles

  • ALV - subtoalOctober 11

    Hi experts, In ALV report how to hide the total amount for a particular column. Scenario is : waerks   netvalue      in USD EUR         1              1.3             2              2.6             3              3.9 INR         1              37    

  • How to sub-total in alv?October 11

    Hi, I have an alv layout like following: ZZZ 300100089 1050 ZZZ 300100089 1050 subtoal             2100 90256243 300100000 193410 90256242 300100000 173250 90256241 300100000 173250 90256240 300100000 173250 90256239 300100000 173250 90256238 3001000

  • Problem with subtotal calculation in ALV reportsOctober 11

    Hi All,    I am doing one program for calculating subtoals in ALV . For this i want to display subtotal text at each envey subtotal 's row. For that i have created one form 'SUB_SUBTOT_TEXT' and it has given to IT_EVENTS-FORM. But SUB_SUBTOT_TEXT For

  • How to subtotal in alv? Please correct the code!!!!November 30

    hi, I have an alv layout like following: ZZZ 300100089 1050 ZZZ 300100089 1050 subtoal 2100 90256243 300100000 193410 90256242 300100000 173250 90256241 300100000 173250 90256240 300100000 173250 90256239 300100000 173250 90256238 300100000 173250 90

  • ALV SUBTOTAL (Change at summation Level)November 30

    Hi All, I need to add some code at the subtotal level of the ALV report output. My output shound look something like this.      FLD1     FLD2     FLD3     FLD4      A1     B1     1     AA      A1     B1     2     BB <i><b>Sum     A1     B1    

  • Open Field in ALV ReportOctober 11

    Hi all, i have to develop a ALV report. In that report i have to put a open quantity column , so that the user can enter values in that, and that value should get updated in the database. So please suggest me how to develop such report with open fiel

  • Unable to capture data in an editable dynamic ALV.October 11

    Hi , I have created a dynamic editable ALV whose displayed structure can be changed at runtime based on the selection in a drop down list value selector. Im trying to capture the values entered in the ALV into an internal table before the user change

  • Total is not getting displayed in the ALV output.October 11

    Hi, Total is not getting displayed in the ALV output. I m using :REUSE_ALV_BLOCK_LIST_APPEND & REUSE_ALV_BLOCK_LIST_DISPLAY Are  there any issues with it as the same settings are working fine with REUSE_ALV_LIST_DISPLAY source code: DATA: layout TYPE

  • '@' not getting displayed in the ALV reportOctober 11

    Hello, I am facing  a strange issue in the ALV report display. A string starting with '@' is not getting displayed and says "default icon " on the report. and this is varying from system to system for the same user. can anyone please help me in

  • Vendor open items wise ALV Grid Display (FBL1N) report to Excel SheetOctober 11

    Hi All, I need vendor wise open items and cleared items in ALV Grid format in excel sheet. I'm Trying that in T Code FBL1N, After the execution. I had select ALV Grid format like this From the menu bar->Settings-> Switch list. After that i get ALV 

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 14 q. 0.577 s.