Skip to Content
avatar image
Former Member

For ALL Entries

Hi Friends,

when i am writing the FOR ALL ENTRIES TO JOING A 2 TABLES ..

FOR EXAMPLE I AHVE 2 TABLES..

1)VBAK.

2)VBAP.

MY QUESTION IS :

FIRST I WANT TO WRITE SELECT STATEMENT FROM VBAK OR VBAP??

WHICH TABLE I WANT TO WRITE SELECT QUERY?? THE COMPARE TO ANOTHER TABLE???

PLS.EXPLAIN ANY ONE.

REGARDS,

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 16, 2007 at 02:33 PM

    Hi,

    You have to write with respect to VBAK,

    If not l_t_vbak[] is initial.

    Select vbeln posnr .... from vbap in to l_t_vbap

    for all entries in l_t_vbak

    where vbeln = l_t_vbak-vbeln.

    endif.

    <b>Reward if helpful.</b>

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Uma Shankar,

      thanks for ur help in a short time.

      i ahve more doubt in for all entries.

      that is :

      can write for entries concept any HEADER TABLE TO ITEM TABLE.

      LIKE VBAK TO LPIS TABLE..

      PLS EXPLAIN.

      REGARDS,

  • avatar image
    Former Member
    Aug 16, 2007 at 02:37 PM

    Hi,

    Use the following piece of code to get an understanding of the same.

    SELECT VBELN from VBAK into itab_VBAK.

    SELECT VBELN POSNR MATNR from VBAP into itab_VBAP for all entries in itab_VBAK.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I forgot the where clause in my earlier post.

      Hi,

      Use the following piece of code to get an understanding of the same.

      SELECT VBELN from VBAK into itab_VBAK.

      SELECT VBELN POSNR MATNR from VBAP into itab_VBAP for all entries in itab_VBAK where VBELN = itab_VBAK-VBELN.

  • avatar image
    Former Member
    Aug 16, 2007 at 02:37 PM

    first select header data -> if you see data here then go to item level.

    the same logic applicable to any other tables

    Logic would be

    select * from vbak into table i_vbak . -> this is main table

    if sy-subrc eq 0.

    select * from vbap into table i_vbap

    for all entries in i_vbak.

    endif.

    Thanks

    Seshu

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Seshu,

      the Technical people are required Functional Knowledge??

      functional people are explaining theire Issues on busness level.

      but Technical People Don't have Functional Knowledge.

      How technical people solve issues according to functional issues.

      pls.explain.

      regards,

  • avatar image
    Former Member
    Aug 16, 2007 at 02:38 PM

    first select from VBAK into table t_vbak

    if t_vbak[] is not initial.

    select from vbap

    for all entries in t_vbak

    where vbap-vbeln = t_vbak-vbeln.

    endif.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2007 at 03:13 PM

    Hi vijay,

    FOR ALL ENTRIES does not do a JOIN.

    select vbak~vbeln vbap~posnr ...
      into corresponding fields of table i_vbak_vbap
      from VBAP "first the table with more records
      join vbap on vbap~vbeln = vbak~vbeln
      where vbak~erdat in s_erdat.
    

    The job of combining the values from 2 databse tables in one internal table is done by the database.

    The primary use of FOR ALL ENTRIES is to make sure the WHERE condition does not get too long (thousands of values in a select-option-range will cause a dump).

    Regards,

    Clemens

    Add comment
    10|10000 characters needed characters exceeded