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

control statement in internal tables

Former Member
0 Likes
718

hi experts,

can any body will provide me the control statement of internal table.

thank you

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
566
AT NEW....
AT FIRST....
AT LAST....
AT END....

Regards,

Rich Heilman

Read only

Former Member
0 Likes
566

Hi,

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

Br,

Laxmi.

Read only

Former Member
0 Likes
566

hi,

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

nidhi

Read only

Former Member
0 Likes
566

Hi,

check this link

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

Control Break Statements

Control break statements are used to create statement blocks which process only specific table lines the LOOP – ENDLOOP block.

You open such a statement block with the control level statement AT and close it with the control level statement ENDAT. The syntax is as follows:

Table should be sorted when you use control-break statements

You can break the sequential access of internal tables by using these statements.

Syntax:

At first.

<Statement block>

Endat.

This is the first statement to get executed inside the loop (remember control break statements are applicable only inside the loop)

So in this block you can write or process those statements which you want to get executed when the loop starts.

At New carrid.

Write:/ carrid.

Endat.

In this case whenever the new carrid is reached, carrid will be written.

At End of carrid.

Uline.

Endat.

In this case whenever the end of carrid is reached, a line will be drawn.

At Last.

Write:/ ‘Last Record is reached’.

Endat.

Processing of statements within this block is done when entire processing of entire internal table is over. Usually used to display grand totals.

You can use either all or one of the above control break statements with in the loop for processing internal table.

At end of carrid.

Sum.

Endat.

In above case the statement SUM (applicable only within AT-ENDAT) will sum up all the numeric fields in internal table and result is stored in same internal table variable.

Regards,

Sruthi