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

general

Former Member
0 Likes
874

What is the main point while using control break in internal table

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
855

hi,

to get o/p list as

matrlgrp matnrlo total

1 1000 9

2000 10

3000 11

2 1000 0

................

...............

3

.............

if helpful reward some points.

with regards,

suresh babu aluri.

6 REPLIES 6
Read only

anversha_s
Active Contributor
0 Likes
855

hi,

check this link

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9f1f35c111d1829f0000e829fbfe/content.htm

Control statements of an internal table are:

1. AT FIRST

2: AT NEW

3. AT END OF

4. AT LAST

AT <line>.

<statement block>

ENDAT.

FIRST

the first line of the internal table

LAST

the last line of the internal table

NEW <field>

the beginning of a group of lines with the same contents in <field> and in the superior fields

END OF <field>

the end of a group of lines with the same contents in <field> and in the superior fields

Rgds

Anversha

Read only

Former Member
0 Likes
855

hi,

while using control breaks we have to sort it.

for control breaks:

REPORT ZSW_CB_STMTS.

DATA:BEGIN OF ITAB OCCURS 0,

A1(10) TYPE C,

A3(10) TYPE C,

A2 TYPE I,

END OF ITAB.

DATA:TOT TYPE I,COUNT TYPE I,I TYPE I.

ITAB-A1 = 'char1'.

ITAB-A3 = 'abc'.

ITAB-A2 = '10'.

APPEND ITAB.

ITAB-A1 = 'char1'.

ITAB-A3 = 'def'.

ITAB-A2 = '20'.

APPEND ITAB.

ITAB-A1 = 'char1'.

ITAB-A3 = 'abc'.

ITAB-A2 = '30'.

APPEND ITAB.

ITAB-A1 = 'char2'.

ITAB-A3 = 'abc'.

ITAB-A2 = '10'.

APPEND ITAB.

ITAB-A1 = 'char2'.

ITAB-A3 = 'abc'.

ITAB-A2 = '20'.

APPEND ITAB.

SORT ITAB BY A1 A3.

LOOP AT ITAB.

AT NEW A1.

WRITE:/ ITAB-A1.

CLEAR I.

ENDAT.

AT NEW A3.

IF I > 0.

WRITE:/10 ITAB-A3.

ELSE.

WRITE:10 ITAB-A3.

ENDIF.

CLEAR COUNT.

ENDAT.

COUNT = COUNT + 1.

I = I + 1.

AT END OF A3.

WRITE:20 COUNT.

ENDAT.

ENDLOOP.

Read only

Former Member
0 Likes
856

hi,

to get o/p list as

matrlgrp matnrlo total

1 1000 9

2000 10

3000 11

2 1000 0

................

...............

3

.............

if helpful reward some points.

with regards,

suresh babu aluri.

Read only

Former Member
0 Likes
855

Hi

there are 5 control break statement in the internal table that we are using..

1. at first

2. at last

3. at end of

4. at new

5. on change of

Generally we are using two of them "at new" and "on change of"

the difference between them are:

(1)At new: execute when there is any change in the control level or left side

of the control level.

on change of: execute when there is change in the control level only.

(2) At new: if this will execute then it replace numeric fields with 0 and charater fields with (*).

on chage : there is no chage in any of coloums.

(3) At new: it can be used in the internal table "loop at it" only

on change: it can be used in any loops like do, loop at,etc..

Read only

Former Member
0 Likes
855

Hi,

Before using control braek statemnets , we shud SORT the internal table as per the fields we will be using in AT NEW..AT END OF ..

The main purpose of control break statements is to :

To display headings (AT FIRST)

To display SuBHEADING (AT NEW)

To display subtotals (AT END OF )

To get grand total and Footer(AT LAST)

Revrt back if any issues.

Reward with points if helpful.

Regards,

Naveen.

Read only

Former Member
0 Likes
855

Hi,

We use control statments

1. At first

2. At new

3. At last

Reward if it is useful

Regards,

Azhar