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

Select Query !!!

Former Member
0 Likes
907

Hi All,

Consider the following scenario.

A select query has to select very large amount of data from the table ( based on some condition ).

Now, because of that and also because of time taken in the network communication, the program is getting timed-out.

Is there any way in which we can select the data in <b>PACKETS</b> from the table WITHOUT CHANGING THE SELECT QUERY i.e. WITHOUT CHANGING THE WHERE CLAUSE ETC.

I repeat the requirement once more:

There should be no change in the select query except few minor changes which might be needed in the same as a part of the syntax.

Regards

Anshul

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
857

Hi anshul,

1. U already have the answer.

2. The syntax is also very simple.

3. Just copy paste to get a taste of it.

4.

REPORT abc.

DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.

DATA : ctr TYPE i.

*----


selection screen.

PARAMETERS : a TYPE c.

*----


START-OF-SELECTION.

<b>SELECT * FROM t001

INTO TABLE t001

PACKAGE SIZE 5 .</b>

ctr = ctr + 1.

WRITE 😕 '----


Loop Pass # ' , ctr.

LOOP AT t001.

WRITE 😕 t001-bukrs , t001-butxt.

ENDLOOP.

ENDSELECT.

regards,

amit m.<b></b>

6 REPLIES 6
Read only

Former Member
0 Likes
858

Hi anshul,

1. U already have the answer.

2. The syntax is also very simple.

3. Just copy paste to get a taste of it.

4.

REPORT abc.

DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.

DATA : ctr TYPE i.

*----


selection screen.

PARAMETERS : a TYPE c.

*----


START-OF-SELECTION.

<b>SELECT * FROM t001

INTO TABLE t001

PACKAGE SIZE 5 .</b>

ctr = ctr + 1.

WRITE 😕 '----


Loop Pass # ' , ctr.

LOOP AT t001.

WRITE 😕 t001-bukrs , t001-butxt.

ENDLOOP.

ENDSELECT.

regards,

amit m.<b></b>

Read only

0 Likes
857

syntex..

SELECT *

FROM mara

INTO TABLE itab

PACKAGE SIZE 10

.

APPEND LINES OF itab TO itab1.

ENDSELECT.

Read only

0 Likes
857

Thanx Amit !!!

It really works !

Regards

Anshul

Read only

Former Member
0 Likes
857

Hi Anshul,

Try to use the explicit index of the table in the select query and see the performance.

Refer this.

    SELECT COUNT(*)
    FROM crmd_orderadm_h
    WHERE process_type IN git_t_type
    AND object_type = gc_subobject
    AND object_id IN git_t_no
    %_HINTS ORACLE 'INDEX("CRMD_ORDERADM_H" "CRMD_ORDERADM_H~OID")'.

<b>Reward points if it helps.</b>

Read only

0 Likes
857

DATA: itab TYPE STANDARD TABLE OF SCARR WITH NON-UNIQUE

DEFAULT KEY INITIAL SIZE 10.

FIELD-SYMBOLS: <FS> TYPE scarr.

SELECT * INTO TABLE itab PACKAGE SIZE 20 FROM scarr.

LOOP AT itab ASSIGNING <FS>.

WRITE: / <FS>-carrid, <FS>-carrname.

ENDLOOP.

ENDSELECT.

Works like ... INTO wa, except that the selected data is not placed in the internal table itab line by line, but in packets of n lines. The old contents of itab are overwritten.

n <= 0 causes a runtime error.

Internally, n is placed in a type I field. Here, the usual conversion rules apply (see MOVE).

After leaving the processing loop, the contents of the internal table itab are undefined.

If the result of the selection is a table, the data is retrieved in a processing loop introduced by SELECT and concluded by ENDSELECT. The processing passes through the loop once for each line read.

reward points and close the thread

gunjan

Read only

Former Member
0 Likes
857

Hi,

Just add "PACKAGE SIZE - n" in your Select statement,ie:

SELECT * FROM MARA
INTO TABLE IT_MARA
PACKAGE SIZE 5.

For more information, just click <a href="http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3605358411d1829f0000e829fbfe/frameset.htm">here</a>.

Regards,