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

give ans

Former Member
0 Likes
1,029

1) write the syntax for AT NEW?

2)write the syntax for AT END?

3)write the syntax for AT FIRST?

4) write the syntax for AT LAST?

5)write the syntax for ON CHANGE?

6) write the syntax for 'for all entries'?

1) write the syntax for AT NEW?

2)write the syntax for AT END?

3)write the syntax for AT FIRST?

4) write the syntax for AT LAST?

5)write the syntax for ON CHANGE?

6) write the syntax for 'for all entries'?

8 REPLIES 8
Read only

Former Member
0 Likes
1,003

Hi,

1)at new <field name>.

do whatever.

endat.

2)at end of <fiild name>.

do whatever.

endat.

3)at first.

do whatever.

endat.

4) at last.

do whatever.

endat.

5) on change of <field1> or <field2> ....<field n>.

do whatever.

endon.

main thing you have to remember is the first 4 statements are used within LOOP and ENDLOOP statements...but the last one you can use within any processing loop like do endo....etc.

<REMOVED BY MODERATOR>

Jagadish

Edited by: Alvaro Tejada Galindo on Apr 22, 2008 5:50 PM

Read only

0 Likes
1,003

it is really very bad to copy other answers....if you dont know answer just give a link to that answers page.

Read only

Former Member
0 Likes
1,003

1)at new <field name>.

do whatever.

endat.

2)at end of <fiild name>.

do whatever.

endat.

3)at first.

do whatever.

endat.

4) at last.

do whatever.

endat.

5) on change of <field1> or <field2> ....<field n>.

do whatever.

endon.

main thing you have to remember is the first 4 statements are used within LOOP and ENDLOOP statements...but the last one you can use within any processing loop like do endo....etc.

<REMOVED BY MODERATOR>

Dara.

Edited by: Alvaro Tejada Galindo on Apr 22, 2008 5:51 PM

Read only

Former Member
0 Likes
1,003

Hi,

Syntax:

AT NEW <f>.

AT END OF <f>.

AT FIRST.

AT LAST.

ON CHANGE OF f.

FOR ALL ENTRIES IN <itab>

Check this http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb381a358411d1829f0000e829fbfe/content.htm

http://www.abapcode.sapbrainsonline.com/2008/03/on-abap-keyword.html

http://www.thespot4sap.com/articles/SAPABAPPerformanceTuning_ForAllEntries.asp

for sample code for the same.

<REMOVED BY MODERATOR>

Regards,

Ramya

Edited by: Alvaro Tejada Galindo on Apr 22, 2008 5:51 PM

Read only

Former Member
0 Likes
1,003

hi gopi even though sending answers for your questions you didn't close your threads....please close your threads after getting answers.

Read only

Former Member
0 Likes
1,003

AT NEW matnr

end at.

same for all...

  • using on change is not recommended

on change of mantr

end on

Regards,

priya

Read only

Former Member
0 Likes
1,003

Syntax for the at first and at last Statements

The following is the syntax for the at first and at last statements.

loop at it.

---

at first.

---

endat.

---

at last.

---

endat.

---

endloop.

where:

it is an internal table and --- represents any number of lines of code (even zero).

Syntax for the at new and at end ff Statements

The following is the syntax for the at new and at end of statements.

sort by c.

loop at it.

---

at new c.

---

endat.

---

at end of c.

---

endat.

---

endloop.

where:

it is an internal table.

c is a component of it and --- represents any number of lines of code (even zero).

Syntax for the on change of Statement

The following is the syntax for the on change of statement.

on change of v1 or v2 . . .

---

[else.

---]

endon.

where:

v1 and v2 are variable or field string names.

. . . indicates that any number of or conditions might follow and --- represents any number of lines of code.

Syntax for FOR ALL ENTRIES

SELECT ... FOR ALL ENTRIES IN <itab> WHERE <cond> ...

<cond> may be formulated as described above. If you specify a field of the internal table <itab> as an operand in a condition, you address all lines of the internal table. The comparison is then performed for each line of the internal table. For each line, the system selects the lines from the database table that satisfy the condition. The result set of the SELECT statement is the union of the individual selections for each line of the internal table. Duplicate lines are automatically eliminated from the result set. If <itab> is empty, the addition FOR ALL ENTRIES is disregarded, and all entries are read.

The internal table <itab> must have a structured line type, and each field that occurs in the condition <cond> must be compatible with the column of the database with which it is compared. Do not use the operators LIKE, BETWEEN, and IN in comparisons using internal table fields. You may not use the ORDER BY clause in the same SELECT statement.

You can use the option FOR ALL ENTRIES to replace nested select loops by operations on internal tables. This can significantly improve the performance for large sets of selected data.

I hope it helps.

Thanks,

Vibha

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Apr 22, 2008 5:52 PM

Read only

Former Member
0 Likes
1,003

hi for

1) write the syntax for AT NEW?

sort itab.

loop at itab.

at new field.

sum .

endat.

endloop.

2)write the syntax for AT END?

sort itab.

at end of field.

sum...

endat.

endloop.

3)write the syntax for AT FIRST?

sort itab.

loop at itab.

at first .

endat.

endloop.

4) write the syntax for AT LAST?

sort itab.

loop at itab.

at last .

endat.

endloop.

5)write the syntax for ON CHANGE?

sort itab.

loop at itab.

on change of field.

endloop.

6) write the syntax for 'for all entries'?

select matnr

meins

from mara

into table itab

where matnr in s_matnr .

if not itab[] is initial.

select matnr

werks

pstat

from marc

into table itab1

for all entries in itab

where matnr = itab-matnr .

endif.

regards,

venkat