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

What is a array fetch

Former Member
0 Likes
3,822

What is a array fetch

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,338

An array fetch means reading all fields of a db table into an internal table at once.

e.g.

DATA: it_table type table of sflight.

SELECT * FROM sflight INTO TABLE it_table.

5 REPLIES 5
Read only

Former Member
0 Likes
1,338

Hi!

In ABAP there is no such ARRAY, like in some other languages (Pascal, Delphi, etc)

An alternative array example:


DATA: p1(1000) TYPE c VALUE 'I PREFER PI'.
DATA: p2(1000) TYPE c.
 
DATA: s_len TYPE i.
CONDENSE p1 NO-GAPS.
s_len = NUMOFCHAR( p1 ).
 
DATA: position TYPE i VALUE '0'.
DATA: position2 TYPE i.
DATA: offset1  TYPE i.
DO s_len TIMES.
  position2 = s_len - position - 1.
  p2+position2(1) = p1+position(1).
  position = position + 1.
ENDDO.
 
WRITE: / p1.
WRITE: / p2.
 
if p1 = p2.
  write: / 'Palindrome!'.
endif.

Regards

Tamá

Read only

srinivas_akiri
Active Participant
0 Likes
1,338

Hi Mukesh,

Array fetch is noting but extracting all the field of a database table using * in the select clause.

for example select * from vbap

the above statement is called as array fetch, generally it should be avoid to improve the performance by selecting only required fields from the table as below

select vbeln posnr netpr

from vbap.

Read only

Former Member
0 Likes
1,339

An array fetch means reading all fields of a db table into an internal table at once.

e.g.

DATA: it_table type table of sflight.

SELECT * FROM sflight INTO TABLE it_table.

Read only

Former Member
0 Likes
1,338

thanks guys

Read only

Former Member
0 Likes
1,338

The main difficulties is connecting the programming language with the sql interface is the transfer of retrieved data fecords..

  • when the system process an sql statement it does not know how long the result would be.

  • The system has to transfer these records to the calling of a program in the form of a structure that is an array.

*The disadvantage of the array is that it is a static definition..u have to specify the size before runtime..As u do noy know the size it will overflow.

*To avoid this problem sap system translates the open sql statements into an embeded sql...

*To do this the system defines a cursor and the cursor is the logical connection to the selected datasets in the database and transfer between abap programs.

*This FETCH operation passes one or more records to the database interface..

This is called as array fetch..

Reward if it's useful..

Regards,

Manoj @ Eminent.