What is diffrence between ON Change of & At New Field??Select Single * from & select Upto 1 rows

Showing Answers 1 - 22 of 22 Answers

sudhar

  • May 1st, 2006
 

At new - on change of diffrence:Incase if you waana calculate sub totals for same values in a field you can use the at new statement.ie: for example in a table sflight there are 2 fields carrid ( airline id) and seatsmax( seat available). Incase if you waana calculate the total number of seats available for each carrrid you can sort the table first and using the atnew and sum you can claculate the total seats for each carrid. Atnew will be triggered whenever there is a change in the carrid and the total seats will be returned for each carrid.In the same scenario if you use onchange of it will not return the total seats for each carrid , instead it will return the total seat count for the entire table( ie: for all the carrids in the table.Another diffrence is at new can be used only between loop and end loop whereas on change of can also be used in select- endselect , do -enddo.Another diffrence is while using at new inase if you code any write statements between at new and end at the value for the numeric fields will be returned as 0 and that of no numeric fields will be returned as *(asteriks). But in on change of the orginal values will be returned.Select single * and select upto 1 row diffrence.The select single * from stmt selects only one row form the database table and puts it in to the work area(internal table).The select upto n(where n stands for a integer number) rows stmt selects all the rows from the database table but writes only the specified number of rows specified by the n into the internal table. If its given as upto 1 rows only 1 row is written in to the internal table.

kalyanraja

  • Jul 20th, 2008
 

coming to the SD, MM and FICO the volume of data should be small. So for this we can go for SELECT statement. Coming to HR data volume of data should be larage. how it is when u modify a record, in HR it will create a one more record but coming to SD or other modules it overwirte the existing record. so we use LDB in HR.

  Was this answer useful?  Yes

kalyanraja

  • Jul 20th, 2008
 

other than given answers i am inserting one more select.

SELECT * FROM DB INTO TABLE ITAB FOR ALL ENTRIES IN IT_TABLE WHERE CONDITION.

  Was this answer useful?  Yes

tabrez

  • Aug 11th, 2012
 

on change is obsolete now we used at new it prevent adjacent duplicate when the valve change it will trigger

  Was this answer useful?  Yes

Ankit

  • Oct 11th, 2012
 

Select single * we use when we are not using all primary keys in where clause
select up to 1 Rows we use when we are using all primary keys in where clause

  Was this answer useful?  Yes

md abeed

  • May 20th, 2014
 

SELECT SINGLE we must use the all the combination of all primary key fields in where condition to fetch the exact record.

Code
  1. SELECT SINGLE VBELN POSNR MATNR

  2.                         FROM VBAK

  3.                         INTO V1

  4.                         WHERE VBELN IN S_VBELN.


SELECT ... UP TO 1 ROWS in this we need not to pass the all the primary key combination in where condition to fetch for the validation.

SELECT SINGLE only hits the data base only once.
SELECT ... UP TO 1 ROWS hit the database twice. why because it acts like loop AND it ends with ENDSELECT.


Code
  1. SELECT VBELN POSNR MATNR

  2.             FROM VBAK

  3.             INTO  V1

  4.             UP TO 1 ROWS

  5.             WHERE MATNR IN S_MATNR

  6. ENDSELECT.

  7.  




  Was this answer useful?  Yes

rameswara

  • Aug 20th, 2014
 

On change of and at new field are the internal table events.
the significant difference between them are on change of can be used in any loop but at new field can be used only in internal table loop.

While working with at new field what are the columns are there at the right side of the comparison column will be displayed as **(if data type is char) or displayed as 000 (if data type is numeric) but this is not in the case of on change of. but it is oldest one.

  Was this answer useful?  Yes

Dinesh

  • Feb 3rd, 2015
 

ON CHANGE OF & AT NEW FIELD OF:
Both triggers when a new record is found in table. But we can use AT NEW FIELD only in loops and ON CHANGE OF can be used any where.
SELECT SINGLE * & SELECT UPTO 1:
Both extracts single record from table but for SELECT SINGLE it is recommended to use all the key fields and for SELECT UPTO 1 it is not recommended to use all key fields.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions