Application Development and Automation 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: 
Read only

How to summarize???

Former Member
0 Likes
319

Hi abapers ..

My Reoprt ....

select YYRVCTR VRSIO matnr ZZSTWRT VKORG STWAE from S720 into

corresponding fields of table itab1

Where YYRVCTR IN S_YYRVCT

AND VKORG IN S_VKORG

AND SPMON IN S_SPMON

AND VRSIO IN S_VRSIO.

select YYRVCTR VRSIO matnr ZZSTWRT VKORG STWAE from S780 into

corresponding fields of table itab2

Where YYRVCTR IN S_YYRVCT

AND VKORG IN S_VKORG

AND SPMON IN S_SPMON

AND VRSIO IN S_VRSIO.

sort itab1 by VRSIO YYRVCTR VKORG matnr.

sort itab2 by VRSIO YYRVCTR VKORG matnr.

LOOP AT itab1.

LOOP AT itab2 where matnr = itab1-matnr.

itab3-Diff = itab1-zzstwrt - itab2-zzstwrt.

if itab3-diff ne 0.

WRITE: /01 itab1-YYRVCTR, 09 itab1-VRSIO,17 itab1-VKORG,

23 itab1-zzstwrt,47 itab1-STWAE,53 itab2-matnr,

62 itab2-zzstwrt,87 itab2-STWAE,100 itab3-Diff.

endif.

ENDLOOP.

ENDLOOP.

output like this HERE i have to Summarize by material wise....

MY OUTPUT coming like Following ..

Here i have to do SUMMARIZE...itab1,itab2, matnr, ST currency Difference

can u give ur inputs..

Staistical Currncy

Itab1

15,180.23

15,180.23

15,180.23

15,180.23

0.00

0.00

0.00

0.00

0.00

Material No

EU_11598

EU_11598

EU_11598

EU_11598

EU_11598

EU_11598

EU_11598

EU_11598

EU_11598

EU_11598

Staistical Currncy

Itab2

759.01

7,590.13

759.01

759.01

759.01

759.01

759.01

759.01

759.01

759.01

759.01

759.01

7,590.13

ST currency Difference

14,421.22

14,421.22

7,590.10

14,421.22

14,421.22

14,421.22

14,421.22

14,421.22

14,421.22

14,421.22

14,421.22

759.01-

759.01-

7,590.13-

1 REPLY 1
Read only

Former Member
0 Likes
294

Hi,

Use the "COLLECT" Statement.

( it's used like the "Append" but will sum the numeric data )


Summarized sales figures by company: 



TYPES: BEGIN OF COMPANY, 
        NAME(20) TYPE C, 
        SALES    TYPE I, 
      END OF COMPANY. 

DATA: COMP    TYPE COMPANY, 
      COMPTAB TYPE HASHED TABLE OF COMPANY 
                                WITH UNIQUE KEY NAME. 

COMP-NAME = 'Duck'.  COMP-SALES = 10. COLLECT COMP INTO COMPTAB. 
COMP-NAME = 'Tiger'. COMP-SALES = 20. COLLECT COMP INTO COMPTAB. 
COMP-NAME = 'Duck'.  COMP-SALES = 30. COLLECT COMP INTO COMPTAB. 



Table COMPTAB now has the following contents: 

          NAME    | SALES 
          --------------- 
          Duck    |   40 
          Tiger   |   20 

Hope this helps,

Erwan

Message was edited by:

Erwan LE BRUN