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 quiery

Former Member
0 Likes
686

hi..experts ...how can we avoid select statement in loop and endloop...answer will be rewarded

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
660

Hi,

use for all entries in select statement.

select <field1> <field2> FROM <table> INTO TABLE <itab1>

FOR ALL ENTRIES IN <itab1>

WHERE <field1> EQ <value>.

check this link for sample program.

http://web.mit.edu/ist/org/admincomputing/dev/no_all_entries_in.htm

Regards,

Sruthi

6 REPLIES 6
Read only

Former Member
0 Likes
661

Hi,

use for all entries in select statement.

select <field1> <field2> FROM <table> INTO TABLE <itab1>

FOR ALL ENTRIES IN <itab1>

WHERE <field1> EQ <value>.

check this link for sample program.

http://web.mit.edu/ist/org/admincomputing/dev/no_all_entries_in.htm

Regards,

Sruthi

Read only

Former Member
0 Likes
660

hi,

Use for all entries in select statement.

regards,

Sreevani

Read only

Former Member
0 Likes
660

Hi,

Using "for all entries" is one way.

Using a "read" within a loop at internal table.

Can also do selects separately, and by looping

at one internal table, read the other.

Regards,

Saumya

Read only

Former Member
0 Likes
660

hi

use for all entries in the select clause.

ex:

SELECT VBELN INTO TABLE T_VBAK

FROM VBAK

FOR ALL ENTRIES IN ITAB

WHERE VBELN = ITAB-VGBEL.

regards,

madhu

Read only

Former Member
0 Likes
660

HI ,

Use FOR ALL ENTRIES statement ..

  IF NOT IT_DO_TR[] IS INITIAL.
* Get OIU_DO_DP table data
    SELECT MP_NO
           BUKRS
           VNAME
           DOI_NO
           MAJPD_CD
           KOSTL
           EFF_TO_DT
      FROM OIU_DO_DP
      INTO TABLE IT_DO_DP2
      FOR ALL ENTRIES IN IT_DO_TR
      WHERE BUKRS   = IT_DO_TR-BUKRS AND
            VNAME   = IT_DO_TR-VNAME AND
            DOI_NO  = IT_DO_TR-DOI_NO.
    IF SY-SUBRC = 0.
      COMMIT WORK.
      SORT IT_DO_DP2 BY BUKRS VNAME DOI_NO MAJPD_CD.
    ENDIF.
  ENDIF.

Read only

Former Member
0 Likes
660

use this example,

SELECT CARRID CONNID CITYFROM CITYTO

INTO CORRESPONDING FIELDS OF LINE

FROM SPFLI

FOR ALL ENTRIES IN ITAB

WHERE CITYFROM = ITAB-CITYFROM AND CITYTO = ITAB-CITYTO.

Regards,

Pavan P