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

some basic doubts

Former Member
0 Likes
678

Hi buddies,

What is the difference between type and like?...Which one if preferable and why?

what is the difference between SELECT UP to 1 Rows and SELECT SINGLE statement?

regards

subash

5 REPLIES 5
Read only

Former Member
0 Likes
653

Hi,

What is the difference between type and like?...Which one if preferable and why?

Type refers to a data type.

like refers to data object.

what is the difference between SELECT UP to 1 Rows and SELECT SINGLE statement?

Select up to means u r giving some limit to select the rows.

Select single means u r selecting a single row with the index u have given.

Read only

Former Member
0 Likes
653

hi check this..

diff type like

diff select single up to 1 row

regards,

venkat

Read only

Former Member
0 Likes
653

difference between type & like

difference between select single and select up to 1 row

http://www.sap-img.com/abap/difference-between-select-single-and-select-upto-one-rows.htm

Read only

Former Member
0 Likes
653

In the specification of a data type type or a data object dobj, the data type of the variable var is already fully defined before the declaration. The syntax and meaning of the additions TYPE and LIKE has exactly the same meaning as the definition of data types with TYPES, except that for DATA after TYPE a standard table type with a generic table key can be specified. In this case, a bound table type with a standard key is created.

Read only

Former Member
0 Likes
653

In the specification of a data type type or a data object dobj, the data type of the variable var is already fully defined before the declaration. The syntax and meaning of the additions TYPE and LIKE has exactly the same meaning as the definition of data types with TYPES, except that for DATA after TYPE a standard table type with a generic table key can be specified. In this case, a bound table type with a standard key is created.

Prior to Release 6.10, no VALUE addition was possible if the data type deep, specified using TYPE or LIKE, was a string, a reference type, a table type, or a structured type with deep components. As of Release 6.10, the VALUE addition can also be used for deep data types; however, with the limitation that a start value val can only be specified for the ABAP type string, and otherwise only IS INITIAL.

SELECT SINGLE or SELECT ... UP TO 1 ROWS

A lot of people use the SELECT SINGLE statement to check for the existence of a value in a database. Other people prefer to use the 'UP TO 1 ROWS' variant of the SELECT statement.

So what's the difference between using 'SELECT SINGLE' statement as against a 'SELECT .... UP TO 1 ROWS' statement ?

If you're considering the statements

SELECT SINGLE field INTO w_field FROM table.

and

SELECT field INTO w_field FROM table UP TO 1 ROWS. ENDSELECT.

then looking at the result, not much apart from the extra ENDSELECT statement. Look at the run time and memory usage and they may be worlds apart.

Why is this ?? The answer is simple.

The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique.

The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set.

Edited by: sree reddy on May 13, 2008 1:30 PM