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

grand total.

hi guru,

in my alv report the output of one field is

net value(GMNGA)

22.000

1.000

1.000

5.000

10.000

10.000

1.000

1.000

1.000

1.000

1.000

1.000

1.000

1.000

150.000

6.675

100.000

0.000

7.000

0.000

25.000

40.000

10.000

15.000

1.000

1.000

1.000

4,000.000

9.500

10.000

1.000

1.000

1.000

5.000

3.000

50.000

50.000

0.250

25.000

1.000

1.000

2.000

20.000

0.000

4.000

3.000

250.000

150.000

250.000

17.000

33.000

11.000

30.000

10.000

7.000

10.000

5,368.425 (HERE i want the written test subtotal)

then i have one more value .

then final grand total.

how to do this???

please give me solution.

my coading is

IF P_DISPER = 'X' .

SELECT AUFNR GMNGA

INTO CORRESPONDING FIELDS OF TABLE IT_AFRU1 FROM AFRU

WHERE BUDAT IN S_BUDAT .

IF NOT IT_AFRU1[] IS INITIAL.

SELECT AUFNR KTEXT PLNBEZ INTO CORRESPONDING FIELDS OF

TABLE IT_CAUFV1 FROM CAUFV

FOR ALL ENTRIES IN IT_AFRU1

WHERE AUFNR = IT_AFRU1-AUFNR AND PLNAL EQ '02'.

IF SY-SUBRC <> 0.

MESSAGE E000(ZPP) WITH 'VALUE NOT EXISTING '.

ENDIF.

ENDIF.

LOOP AT IT_CAUFV1 INTO WA_CAUFV1.

WA_AFRU12-AUFNR = WA_CAUFV1-AUFNR.

WA_AFRU12-KTEXT = WA_CAUFV1-KTEXT.

WA_AFRU12-PLNBEZ = WA_CAUFV1-PLNBEZ.

APPEND WA_AFRU12 TO IT_AFRU12.

ENDLOOP.

LOOP AT IT_AFRU12 INTO WA_AFRU12.

LOOP AT IT_AFRU1 INTO WA_AFRU1 WHERE AUFNR = WA_AFRU12-AUFNR.

WA_AFRU12-GMNGA = WA_AFRU1-GMNGA.

MODIFY IT_AFRU12 FROM WA_AFRU12.

ENDLOOP.

ENDLOOP.

DELETE IT_AFRU12 WHERE PLNBEZ = 'OSPP'.

ENDIF.

IF P_DISPER = 'X' .

SELECT AUFNR GMNGA

INTO CORRESPONDING FIELDS OF TABLE IT_AFRU1 FROM AFRU

WHERE BUDAT IN S_BUDAT .

IF NOT IT_AFRU1[] IS INITIAL.

REFRESH IT_CAUFV1.

SELECT AUFNR KTEXT PLNBEZ INTO CORRESPONDING FIELDS OF

TABLE IT_CAUFV1 FROM CAUFV

FOR ALL ENTRIES IN IT_AFRU1

WHERE AUFNR = IT_AFRU1-AUFNR AND PLNAL EQ '01'.

IF SY-SUBRC <> 0.

MESSAGE E000(ZPP) WITH 'VALUE NOT EXISTING '.

ENDIF.

ENDIF.

LOOP AT IT_CAUFV1 INTO WA_CAUFV1 .

WA_AFRU12-AUFNR = WA_CAUFV1-AUFNR.

WA_AFRU12-KTEXT = WA_CAUFV1-KTEXT.

WA_AFRU12-PLNBEZ = WA_CAUFV1-PLNBEZ.

APPEND WA_AFRU12 TO IT_AFRU12.

ENDLOOP.

LOOP AT IT_AFRU12 INTO WA_AFRU12.

LOOP AT IT_AFRU1 INTO WA_AFRU1 WHERE AUFNR = WA_AFRU12-AUFNR.

WA_AFRU12-GMNGA = WA_AFRU1-GMNGA.

MODIFY IT_AFRU12 FROM WA_AFRU12.

AT END OF

ENDAT.

ENDLOOP.

ENDLOOP.

DELETE IT_AFRU1 WHERE PLNBEZ = 'OSPP'.

ENDIF.

help me?????

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Mar 22, 2008 at 12:31 PM

    hi ,

    do like this..

    for total ..

    it_fieldcat-do_sum = 'X'.

    for sub total you should maintain the sort table .

    REPORT ZALVTESTFORSUBTOTAL.

    tables:pa0008.

    type-pools:slis.

    types:begin of ty_pa0008,

    pernr like pa0008-pernr,

    begda like pa0008-begda,

    endda like pa0008-endda,

    ansal like pa0008-ansal,

    lga01 like pa0008-lga01,

    bet01 like pa0008-bet01,

    end of ty_pa0008.

    data:it_pa0008 type standard table of ty_pa0008 with header line.

    data:it_fieldcat type SLIS_T_FIELDCAT_ALV,

    wa_fieldcat type slis_fieldcat_alv,

    it_layout type slis_layout_alv,

    WA_events TYPE slis_alv_event,

    it_events TYPE slis_t_event.

    select-options:s_pernr for pa0008-pernr.

    start-of-selection.

    perform getD_data.

    perform disp_alv.

    &----


    *& Form getD_data

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form getD_data .

    select pernr

    begda

    endda

    ansal

    lga01

    bet01

    from pa0008

    into table it_pa0008

    where pernr in s_pernr.

    sort it_pa0008 by pernr begda descending.

    endform. " getD_data

    &----


    *& Form disp_alv

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form disp_alv .

    wa_fieldcat-fieldname = 'PERNR'.

    wa_FIELDCAT-REPTEXT_DDIC = 'Personnel no'.

    *WA_FIELDCAT-no_subtotals = 'X'.

    append wa_fieldcat to it_fieldcat.

    clear wa_fieldcat.

    wa_fieldcat-fieldname = 'BEGDA'.

    wa_FIELDCAT-REPTEXT_DDIC = 'Start date'.

    append wa_fieldcat to it_fieldcat.

    clear wa_fieldcat.

    wa_fieldcat-fieldname = 'ENDDA'.

    wa_FIELDCAT-REPTEXT_DDIC = 'End date'.

    append wa_fieldcat to it_fieldcat.

    clear wa_fieldcat.

    wa_fieldcat-fieldname = 'ANSAL'.

    wa_FIELDCAT-REPTEXT_DDIC = 'Annula salary'.

    wa_fieldcat-do_sum = 'X'.

    append wa_fieldcat to it_fieldcat.

    clear wa_fieldcat.

    wa_fieldcat-fieldname = 'LGA01'.

    wa_FIELDCAT-REPTEXT_DDIC = 'Wage Type'.

    append wa_fieldcat to it_fieldcat.

    clear wa_fieldcat.

    wa_fieldcat-fieldname = 'BET01'.

    wa_FIELDCAT-REPTEXT_DDIC = 'Amount for wagetype'.

    append wa_fieldcat to it_fieldcat.

    clear wa_fieldcat.

    DATA: sort TYPE slis_sortinfo_alv,

    it_sort TYPE slis_t_sortinfo_alv.

    sort-fieldname = 'PERNR'.

    sort-subtot = 'X'.

    SORT-UP = 'X'.

    APPEND sort TO it_sort.

    *sort-fieldname = 'BEGDA'.

    *SORT-NO_SUBTOTS = 'X'.

    *APPEND sort TO it_sort.

    IT_layout-totals_text = 'total text'.

    IT_layout-subtotals_text = 'Subtotal text'.

    *WA_EVENTS-NAME = 'SUBTOTAL TEXT'.

    *WA_EVENTS-FORM = 'SUBTOTAL TEXT'.

    *APPEND WA_EVENTS TO IT_EVENTS.

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = sy-repid

    IS_LAYOUT = it_LAYOUT

    IT_FIELDCAT = IT_FIELDCAT

    it_sort = it_sort

    • it_events = it_events

    TABLES

    t_outtab = it_pa0008 .

    endform. " disp_alv

    regards,

    venkat.

    Edited by: venkat appikonda on Mar 22, 2008 1:31 PM

    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.