Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Do sum in ALV report

Former Member
0 Kudos

Hi ,

In the ALV Output Material and Quantity is coming side by side.

I need to do for the Same Material ,The sum of Quantity should come .

How to write this code in ALV .

Thanks in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

use

WA_SORT-TABNAME = 'IT_OUTPUT'.

WA_SORT-FIELDNAME = 'MATNR'.

WA_SORT-UP = 'X'.

WA_SORT-GROUP = 'X'.

WA_SORT-SUBTOT = 'X'.

APPEND WA_SORT TO IT_SORT.

CLEAR WA_SORT.

also while building field cat

use

WA_FIELDCAT-DO_SUM = 'X'. for the field you want to sum

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'

I_GRID_TITLE = 'Project SO Details (FAS)'(003)

IS_LAYOUT = GS_LAYOUT

IT_FIELDCAT = IT_FIELDCAT

IT_SORT = IT_SORT

  • IT_FILTER = IT_FILTER

I_DEFAULT = 'X'

I_SAVE = 'A'

TABLES

T_OUTTAB = IT_OUTPUT

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.

Try this

Edited by: Sachin Bidkar on Mar 24, 2010 2:56 PM

6 REPLIES 6

Former Member
0 Kudos

Hello,

Look into below link:

Regards,

Venkat.

Former Member
0 Kudos

use

WA_SORT-TABNAME = 'IT_OUTPUT'.

WA_SORT-FIELDNAME = 'MATNR'.

WA_SORT-UP = 'X'.

WA_SORT-GROUP = 'X'.

WA_SORT-SUBTOT = 'X'.

APPEND WA_SORT TO IT_SORT.

CLEAR WA_SORT.

also while building field cat

use

WA_FIELDCAT-DO_SUM = 'X'. for the field you want to sum

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'

I_GRID_TITLE = 'Project SO Details (FAS)'(003)

IS_LAYOUT = GS_LAYOUT

IT_FIELDCAT = IT_FIELDCAT

IT_SORT = IT_SORT

  • IT_FILTER = IT_FILTER

I_DEFAULT = 'X'

I_SAVE = 'A'

TABLES

T_OUTTAB = IT_OUTPUT

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.

Try this

Edited by: Sachin Bidkar on Mar 24, 2010 2:56 PM

0 Kudos

ALV Output  sales order ,Material and Quantity is coming side by side.

I need to do for the Same sales oreder  ,different no  Material ,The sum of Quantity should come


i am building my field catalog using

wa_fcat-fieldname = 'ERDAT'.

   wa_fcat-tabname = 'IT_FINAL'.

   wa_fcat-seltext_m = 'DATE'.

   append wa_fcat to it_fcat .

   clear wa_fcat .

Psaha

Former Member
0 Kudos

Did you get Kiro?

0 Kudos

When you are building your feild catalog as below for example

w_fcat1-tabname = 'ITBSET8'. "internal table name

w_fcat1-fieldname = 'EDUCE'. "name of the feild

w_fcat1-seltext_m = 'Edu. Cess (Rs.)'. "name of the feild as you need when th display

w_fcat1-outputlen = 15.

w_fcat1-datatype = 'CURR'.

w_fcat1-do_sum = 'X'.

PradiptoSaha
Explorer
0 Kudos

ALV Output  sales order ,Material and Quantity is coming side by side.

I need to do for the Same sales oreder  ,different no  Material ,The sum of Quantity should come


i am building my field catalog using

wa_fcat-fieldname = 'ERDAT'.

   wa_fcat-tabname = 'IT_FINAL'.

   wa_fcat-seltext_m = 'DATE'.

   append wa_fcat to it_fcat .

   clear wa_fcat .

Psaha