Application Development 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: 

HOW TO PRINT THE MATTER IN FOR ALL ENTRIES

Former Member
0 Kudos

HI HOW T PRINT THE FOR ALL ENTRIES MATTER

3 REPLIES 3

Former Member
0 Kudos

Example

Exporting all flight data for a specified departure city. The relevant airlines and flight numbers are first put in an internal table entry_tab, which is evaluated in the WHERE condition of the subsquent SELECT statement.

PARAMETERS p_city TYPE spfli-cityfrom.

TYPES: BEGIN OF entry_tab_type,

carrid TYPE spfli-carrid,

connid TYPE spfli-connid,

END OF entry_tab_type.

DATA: entry_tab TYPE TABLE OF entry_tab_type,

sflight_tab TYPE SORTED TABLE OF sflight

WITH UNIQUE KEY carrid connid fldate.

SELECT carrid connid

FROM spfli

INTO CORRESPONDING FIELDS OF TABLE entry_tab

WHERE cityfrom = p_city.

SELECT carrid connid fldate

FROM sflight

INTO CORRESPONDING FIELDS OF TABLE sflight_tab

FOR ALL ENTRIES IN entry_tab

WHERE carrid = entry_tab-carrid AND

connid = entry_tab-connid.

Regards,

Pavan

Former Member
0 Kudos

Hi Naresh,

You can only use FOR ALL ENTRIES IN ...WHERE ...in a SELECT statement.

SELECT ... FOR ALL ENTRIES IN itab WHERE cond returns the union of the solution sets of all SELECT statements that would result if you wrote a separate statement for each line of the internal table replacing the symbol itab-f with the corresponding value of component f in the WHERE condition.Duplicates are discarded from the result set. If the internal table itab does not contain any entries, the system treats the statement as though there were no WHERE cond condition, and selects all records (in the current client).

For example:

SELECT * FROM sflight INTO wa_sflight

FOR ALL ENTRIES IN ftab

WHERE CARRID = ftab-carrid AND

CONNID = ftab-connid AND

fldate = '20010228'.

This condition, return all entries of the sflight.

When using FOR ALL ENTRIES the number of matching records is restricted to the number of records in the internal table. If the number of records in the database tables is too large then join would cause overheads in performance. Additionally a JOIN bypasses the table buffering.

Thanks,

Reward If Helpful.

Former Member
0 Kudos

Hello Naresh,

Move the contents into a final table with all the required fields and then display that table.

Chk this..
 
SELECT * FROM S677 INTO TABLE T_S677
FOR ALL ENTRIES IN TBL_MARC
WHERE SSOUR EQ GC_SSOUR 
AND SPMON EQ GC_SPMON 
AND SPTAG EQ GC_SPTAG .
 
loop at T_S677.
 read table TBL_MARC with key matnr eq T_S677-matnr.
 if sy-subrc eq 0.
 else.
  delete table T_S677.
 endif.
endloop.

Regards,

Deepu.K