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

Former Member
0 Likes
1,730

hi all,

please explain the concept of for all entries if possible sample code

16 REPLIES 16
Read only

GauthamV
Active Contributor
0 Likes
1,711

hi,

plz use the search functionality available in SDN.

u have hundreds of forums regarding this.

Read only

Former Member
Read only

Former Member
0 Likes
1,711
Read only

Former Member
0 Likes
1,711

hi,

see for eg.

Table 1 : ZARK_TEST has 2 fields

code description

001 one

003 three

004 Four

Table 2: ZARK has 2 fields

code name

001 tina

002 mina

004 rina

005 bina

select code name

into table ZARK_DATA

from ZARK

for all entires in ZARK_TEST

where code = ZARK_TEST-code.

so the values in ZARK_DATA will be

Code Name

001 Tina

004 Rina

i think this was a simple example to understand ..... if any query reply back.

reward points if useful.......:-)

and mark the post answered once ur problem is solved ....

Edited by: Ajantha Ratnakumar on Jun 23, 2008 3:37 PM

Read only

Former Member
0 Likes
1,711

hiii

For all entries works as join query..see the code below.here in i_mara internal table i have taken data from mara table then for all entries in i_mara table i get data from marc table.here it will check & will join with i_mara table only.& will get data for all the entries in i_mara ..& will give records in i_marc table.

CONSTANTS:
    lc_lang VALUE 'E'.                 " Language Key

  SELECT matnr                         " Material Number
    FROM mara
    INTO TABLE i_mara
   WHERE matnr IN s_matnr.





  IF i_mara[] IS NOT INITIAL.
    SELECT matnr                       " Material Number
           werks                       " Plants
           prctr                       " Profit Center
      FROM marc
      INTO TABLE i_marc
       FOR ALL ENTRIES IN i_mara
     WHERE matnr = i_mara-matnr
       AND werks IN s_werks.

  ENDIF.                               " IF i_mara[] IS NO

reward if useful

thx

twinkal

Read only

Former Member
0 Likes
1,711

Hi,

select matnr

mtart

meins

from mara

into table it_mara

where matnr in s_matnr.

if not it_mara[] is initial.

select matnr

pstat

werks

from marc

into table it_marc

for all entries in it_mara

where matnr = it_mara-matnr.

you can use for all entries option if you want to fetch some data from a table for all datas in a internal table you can use it.

here the first itab contains material number fetched from Mara, for all these material numbers we need werks, so we can use all entries option to fecth plant details for all the material numbers in table it_mara.

Read only

former_member206377
Active Contributor
0 Likes
1,711

content copied from ABAP key word documentation removed by moderator. DO NOT REPEAT THIS

Edited by: Durairaj Athavan Raja on Jun 23, 2008 1:05 PM

Read only

Former Member
0 Likes
1,711
Read only

Former Member
0 Likes
1,711

select * from vbak
into table i_vbak
up to 50 rows.
* This will get 1st 50 rows of the Sales Document Header data 
if sy-subrc = 0.

Select * from vbap 
into table i_vbap 
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
 if sy-subrc = 0.
*This will get data from VBAK table for the records retrieved from *previous select

 endif.
endif.
Read only

Former Member
0 Likes
1,711

Hi,

if int_cntry[] is not intial.

Select * from zfligh appending table int_fligh

For all entries in int_cntry

Where cntry = int_cntry-cntry.

endif..

thanks,

srii.

Read only

Former Member
0 Likes
1,711

Hi karanam,

for all entries are used where we want to fetch all data in one table with correspond to other example:-

select vbeln posnr

into table t_tab

from vbap.

select vbeln posnr

into t_tab1

from table vbrp

all entries in t_tab

where vbeln eq t_tab-vbeln.

there sholud be 1 key field in common between the two table which acts as a base(like vbeln in above case) its is same as putting the loop outside a select statement but its is better in terms of performance of the code.

Regards

Ankur

Read only

Former Member
0 Likes
1,711

hi,

see for eg.

Table 1 : ZARK_TEST has 2 fields

code description

001 one

003 three

004 Four

Table 2: ZARK has 2 fields

code name

001 tina

002 mina

004 rina

005 bina

select code name

into table ZARK_DATA

from ZARK

for all entires in ZARK_TEST

where code = ZARK_TEST-code.

so the values in ZARK_DATA will be

Code Name

001 Tina

004 Rina

i think this was a simple example to understand ..... if any query reply back.

reward points if useful.......:-)

and mark the post answered once ur problem is solved ....

Read only

0 Likes
1,711

Hi Ajantha Ratnaku...

Infuture do not edit the content posted by Moderator.

Read only

0 Likes
1,711

can i know wat did i modify ?

i modified my own reply only......

Read only

0 Likes
1,711

Hi everyone.

Moderators have the possibility to edit all postings. Whenever they do so they will leave a notice at the end of the posting that they edited it. In most cases they will mark their edits clearly. Moderators only edit postings if there is something in them that is breaking the rules of engagement. Every edit should be seen as a warning; instead of editing moderators just might delete your posting.

In this thread I have noticed a double posting and people asking for points. I don't like to see that in the forums. As the original question has not an appropriate subject and could be solved by a simple search the whole thread should not have been started at all. Therefore I will lock this thread.

Best regards,

Jan Stallkamp

Read only

Former Member
0 Likes
1,711

Hi,

Search in SDN, there are many threads on this topic.

Thanks,

Sriram Ponna.