Skip to Content
author's profile photo Former Member
Former Member

Adding row after subtotal in ALV

Hi Guys,

can we add one row after the subtotal in ALV.

Like the below...

field1 field2 field3 field4

Sub total. 120 121 125 130

Test 150

can you help me about the above...

Thanks,

Lingesh

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2005 at 07:40 AM

    Hi

    You can try to use the event GROUPLEVEL_CHANGE or SUBTOTAL_TEST, but I know they work for REUSE_ALV_LIST_DISPLAY.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2005 at 10:10 AM

    Can any one send some sample code for the same...

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi

      If you use GROUPLEVEL_CHANGE you have to creare a form like this:

      FORM GROUPLEVEL_CHANGE

      USING P_LINEINFO TYPE SLIS_LINEINFO

      LS_GROUPS TYPE KKBLO_GROUPLEVELS.

      ENDFORM. "GROUPLEVEL_CHANGE

      In the P_LINEINFO you have details of row and in the LS_GROUPS details of level of sorting.

      For example I used it to re-write subtotal:

      FORM GROUPLEVEL_CHANGE USING P_LINEINFO TYPE SLIS_LINEINFO

      LS_GROUPS TYPE KKBLO_GROUPLEVELS.

      PERFORM WRITE_SUB_TOTAL USING LS_GROUPS.

      ENDFORM. "GROUPLEVEL_CHANGE

      FORM WRITE_SUB_TOTAL USING P_GROUPS TYPE KKBLO_GROUPLEVELS.

      DATA: TOT_SALDO_A LIKE BSID-DMBTR,

      TOT_FATTURATO_A LIKE BSID-DMBTR,

      TOT_DSO_A LIKE BSID-DMBTR.

      DATA: WA_GROUP TYPE KKBLO_GROUPLEVELS.

      DATA: RUN_LEVEL TYPE I.

      DATA: BEGIN OF T_LEVEL OCCURS 1,

      LEVEL TYPE I,

      INDEX_FROM TYPE I,

      INDEX_TO TYPE I,

      END OF T_LEVEL.

      T_LEVEL-LEVEL = P_GROUPS-LEVEL.

      T_LEVEL-INDEX_FROM = P_GROUPS-INDEX_FROM.

      T_LEVEL-INDEX_TO = P_GROUPS-INDEX_TO.

      APPEND T_LEVEL.

      • Check livel:

      CALL FUNCTION 'ALV_GROUPLEVELS_GET'

      IMPORTING

      ET_GROUPS = GT_GROUP

      TABLES

      T_OUTTAB = <FS_OUTPUT>.

      RUN_LEVEL = P_GROUPS-LEVEL + 1.

      IF RUN_LEVEL <= LEVEL.

      DO.

      LOOP AT GT_GROUP INTO WA_GROUP

      WHERE INDEX_FROM => P_GROUPS-INDEX_FROM

      AND INDEX_TO <= P_GROUPS-INDEX_TO

      AND LEVEL = RUN_LEVEL.

      T_LEVEL-LEVEL = RUN_LEVEL.

      T_LEVEL-INDEX_FROM = WA_GROUP-INDEX_FROM.

      T_LEVEL-INDEX_TO = WA_GROUP-INDEX_TO.

      ENDLOOP.

      IF SY-SUBRC = 0.

      APPEND T_LEVEL.

      ENDIF.

      RUN_LEVEL = RUN_LEVEL + 1.

      IF RUN_LEVEL > LEVEL. EXIT. ENDIF.

      ENDDO.

      ENDIF.

      SORT T_LEVEL BY LEVEL DESCENDING.

      LOOP AT T_LEVEL.

      TOT_SALDO_A = TOT_FATTURATO_A = 0.

      LOOP AT <FS_OUTPUT> INTO <FS_WA_OUT>

      FROM T_LEVEL-INDEX_FROM

      TO T_LEVEL-INDEX_TO.

      ASSIGN COMPONENT 'ZSALDO'

      OF STRUCTURE <FS_WA_OUT> TO <FS_SALDO>.

      ASSIGN COMPONENT 'ZFATTURATO'

      OF STRUCTURE <FS_WA_OUT> TO <FS_FATTURATO>.

      TOT_SALDO_A = TOT_SALDO_A + <FS_SALDO>.

      TOT_FATTURATO_A = TOT_FATTURATO_A + <FS_FATTURATO>.

      ENDLOOP.

      TOT_SALDO = TOT_SALDO + TOT_SALDO_A .

      TOT_FATTURATO = TOT_FATTURATO + TOT_FATTURATO_A.

      PERFORM CALCULATE_DSO USING TOT_FATTURATO_A

      TOT_SALDO_A TOT_DSO_A.

      PERFORM WRITE_TOT_DSO

      USING TOT_SALDO_A

      TOT_FATTURATO_A TOT_DSO_A

      T_LEVEL-LEVEL T_LEVEL-INDEX_FROM.

      ENDLOOP.

      ENDFORM. " WRITE_SUB_TOTAL

      Max

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 05:28 PM

    Max,

    Can you please tell how did you find out the parameters for the subroutine GROUPLEVEL_CHANGE

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.