Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

10/7/2016

ABAPControlBreakProcessingSUMstatement

SAPHub

Search

SAP for Beginners

HOME

ABAP TUTORIAL

ABAP Tutorial

ASK A QUESTION

SUBMIT A TIP

Control Break Processing in


ABAP Internal Tables Continued
In AT FIRST and AT LAST event blocks the numeric values in the work
area contains zeros. SUM statement calculates the totals of numeric
elds and places the totals in the corresponding elds of work area.
In AT NEW and AT END OF event blocks SUM statement nds all the
rows within the control level and calculates the totals of numeric
elds that are right to the control level and places the totals in the
corresponding elds of work area.
** *Data Declaration *

Newsletter

*
Enter your email address:
DATA:gwa_spfliTYPEspfli.
DATA:gt_spfliTYPETABLEOFspfli.
SELECT*UPTO5ROWSFROMspfliINTOTABLEgt_spfli.
LOOPATgt_spfliINTOgwa_spfli.
ATFIRST.
WRITE:/'FlightDetails'.
WRITE:/'AirlineCode'COLOR5,14'ConnectionNo.'
COLOR5,
29'DepartureCity'COLOR5,44'ArivalCity'
COLOR5,
58'Distance'COLOR5.
ULINE.
ENDAT.
ATNEWcarrid.
WRITE:/gwa_spflicarrid,':NewAirline'.
ULINE.
http://www.saphub.com/abaptutorial/controlbreakprocessinginabapinternaltablescontinued/

Subscribe
Delivered by FeedBurner

Categories
ABAP Dictionary
ABAP General
1/6

10/7/2016

ABAPControlBreakProcessingSUMstatement

ENDAT.
WRITE:/14gwa_spfliconnid,29gwa_spflicityfrom,
44gwa_spflicityto,58gwa_spflidistance.
ATENDOFcarrid.
ULINE.

ABAP Tutorial
ABAP Workbench
ALE IDoc
ALV

SUM.

Debugging
Enhancements

WRITE:/gwa_spflicarrid,58gwa_spflidistance.
ULINE.
ENDAT.
ATLAST.

FI
Files
LSMW
MM

SUM.

Modularization
Performance

WRITE:/'Total',58gwa_spflidistance.
WRITE:/'EndofLoop'.
ENDAT.
ENDLOOP.

Reports
SAP Interview Questions and
Answers
SD

Output

Selection Screen
Smartforms

Recent Posts
Track Changes Made in ABAP
Debugger
Find Saplogon.ini File Location
Track Changes Made to SAP
Table Using &SAP_EDIT
Activate &SAP_EDIT in SE16N
Display checkbox in ABAP F4
help using ALV

Tags
ON CHANGE OF behaves similar to AT NEW. The syntax is as follows.
http://www.saphub.com/abaptutorial/controlbreakprocessinginabapinternaltablescontinued/

2/6

10/7/2016

ABAPControlBreakProcessingSUMstatement

ONCHANGEOF<controllevel1>[or<controllevel2>.
.].
[ELSE.]
ENDON.

abap ABAP Dictionary

ALV

background-jobs BADI bdc

DDIC

debugging disable
display download

** *Data Declaration *
*

DATA:gwa_spfliTYPEspfli.
DATA:gt_spfliTYPETABLEOFspfli.
SELECT*UPTO5ROWSFROMspfliINTOTABLEgt_spfli.
LOOPATgt_spfliINTOgwa_spfli.
ATFIRST.
WRITE:/'FlightDetails'.
WRITE:/'AirlineCode'COLOR5,14'ConnectionNo.'
COLOR5,
29'DepartureCity'COLOR5,44'ArivalCity'
COLOR5,
58'Distance'COLOR5.
ULINE.
ENDAT.

enhancement f1 help

f4 help

le FM header how-to
icon internal tables
interview questions log
logo lsmw messages MM oops

pdf performance popup


programmatically

reports sap-

note scripting SD

selection screen

smartforms table
tcodes text TMG total
upload variant XML

ON CHANGE OF gwa_spi-carrid. WRITE:/ gwa_spi-carrid, : New


Airline. ULINE. ENDON.

WRITE:/14gwa_spfliconnid,29gwa_spflicityfrom,
44gwa_spflicityto,58gwa_spflidistance.
ENDLOOP.

Output

http://www.saphub.com/abaptutorial/controlbreakprocessinginabapinternaltablescontinued/

3/6

10/7/2016

ABAPControlBreakProcessingSUMstatement

Below table summarizes the dierences between AT NEW and ON


CHANGE OF statements.

AT NEW

ON CHANGE OF

It can be used only in AT

It can be used in any loop like

LOOP statement.

SELECT, DO etc..

Only one control eld can be

Multiple control elds

used.

separated by OR can be used.

AT NEW is triggered when a

ON CHANGE OF is not

eld left to control level

triggered when a eld left to

changes.

control level changes.

Values in the elds to the

Values in the elds to the

right of control level contains

right of control level contains

asterisks and zeros.

original values.

ELSE addition cannot be

ELSE addition can be used.

used.
http://www.saphub.com/abaptutorial/controlbreakprocessinginabapinternaltablescontinued/

4/6

10/7/2016

ABAPControlBreakProcessingSUMstatement

Changes to work area with AT

Changes to work area with

NEW will be lost.

ON CHANGE OF will not be


lost.

Tweet

Related posts:

1. Control Break Processing in ABAP Internal Tables


2. Changing Lines in ABAP Internal Tables
3. SAP ABAP Interview Questions & Answers Internal Tables
Part 1
4. Inserting Lines into ABAP Internal Tables
5. More on ABAP Internal Tables

Control Break Processing in ABAP Internal Tables

Messages in ABAP

One thought on Control Break Processing in


ABAP Internal Tables Continued
reddy
June 10, 2016 at 7:52 am
Permalink

good

Reply

Leave a Reply
Your email address will not be published. Required elds are marked *
Comment
http://www.saphub.com/abaptutorial/controlbreakprocessinginabapinternaltablescontinued/

5/6

You might also like