Skip to Content
author's profile photo Former Member
Former Member

For all entries

Hi,

I belive I have some issue regarding "for all entries" ?

clear: i_mara,i_mara[].

  • i_mara now includes 0 row.

  • i_mvke now includes 1 row.

  • Get MARA

select *

from mara

into corresponding fields of table i_mara

for all entries in i_mvke

where matnr eq i_mvke-matnr.

i_mara now includes 10000 rows.

i_mvke now includes 1 row.

I'm confused.... a for all entries in should work as a INNER JOIN ...?

I want i_mara to include only 1 row after the select..

//Martin

Message was edited by: Martin Andersson

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 02, 2005 at 07:52 AM

    Hi,

    The <b>where matnr eq i_mvke-matnr</b> condition will fetch all records that match the given criteria. It you want to fetch only one record:

    1. Issue ...UPTO 1 ROWS, or

    2. Specify the WHERE clause upto complete key fields to uniquely identify a single row, or

    3. Issue SELECT SINGLE...

    Hope this helps.

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      As per the SAP documentation on help.sap.com,

      <b>In case of SELECT ... FOR ALL ENTRIES IN <itab> WHERE <cond>, if you specify a field of the internal table <itab> as an operand in a condition, you address all lines of the internal table. The comparison is then performed for each line of the internal table. For each line, the system selects the lines from the database table that satisfy the condition. The result set of the SELECT statement is the union of the individual selections for each line of the internal table. Duplicate lines are automatically eliminated from the result set. If <itab> is empty, the addition FOR ALL ENTRIES is disregarded, and all entries are read.

      </b>

      Only specifying matnr in your where clause might not be able to uniquely identify a particular record. So although you have a single entry in your itab, more than one entries correspond to it in the DB tab. See if you can further specify the complete primary key.

      Take a look at http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3a1f358411d1829f0000e829fbfe/frameset.htm for further details on FOR ALL ENTRIES.

      Hope this helps.

      Regards

      Message was edited by: Shehryar Khan

  • Posted on Feb 02, 2005 at 08:21 AM

    Hello Martin,

    you specify complete key of MARA, so this should work perfectly (just select into table, corresponding fields is slower).

    Maybe your matnr in i_mvke hasn't correct format? Be sure, to use exact database format:

    Most customers use rules, which are implemented in function module

    CONVERSION_EXIT_ALPHA_INPUT

    .

    Regards,

    Christian

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 02, 2005 at 08:22 AM

    Hi Martin,

    Have you really <b>1</b> entry in table i_mvke ?

    if there's no entry in i_mvke you'll get all entries

    of mara in i_mara.

    regards Andreas

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.