cancel
Showing results for 
Search instead for 
Did you mean: 

for all entries

Former Member
0 Kudos

what is the use ,syntax and functionality of the FOR ALL ENTRIES?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

If you have to select information from 2 or more tables, then you either use join or use nested select which is not advisible.

Alternatively, you can fetch required fields in one internal table for one databse table and other fields from 2nd db table in other internal table.

So, after fetching information from 1st dbtable you will have to fetch other information from 2nd dbtable only for entries that were selected previously.

Eg: You want to get Employee's Organisation name and Employee's name.

select pernr orgeh from pa0001 into table i_0001 where pernr in s_pernr and endda = '99991231' and orgeh in s_orgeh.

if sy-subrc = 0.

**Now get Employee name for only those employee having organisation given in selection-screen and selected in first internal table,

select pernr vorna from pa0002 into table i_0002 FOR ALL ENTRIES in i_0001 where pernr = i_0001-pernr and endda = '99991231'.

endif.

Now you can print the information on screen as PERNR is common field which connects the information.

Regards

Navneet

Former Member
0 Kudos

Hi,

to get the records based on the values in an internal table..

Ex..

DATA: T_MATNR TYPE STANDARD TABLE OF MARA.

DATA: T_MATERIAL TYPE STANDARD TABLE OF MARC.

  • Let's say we have records in the internal table T_MATNR.

  • to get the records from the database table MARC based on the records

  • in the internal table T_MATNR use FOR ALL ENTRIES

  • For for all entries check if the internal table is populated..otherwise

  • it will fetch all the records

IF NOT T_MATNR[] IS INITIAL.

SELECT * FROM MARC INTO TABLE T_MATERIAL

FOR ALL ENTRIES IN T_MATNR

WHERE MATNR = T_MATNR-MATNR.

ENDIF.

Thanks

Naren