Skip to Content
author's profile photo
Former Member

FOR ALL ENTRIES ERROR

When we use FOR ALL ENTRIES, its order of data in internal table is changed what exists in the FIRST internal table.

Why its order changed, can anyone suggest me.

THANKS IN ADVANCE.

Regards

Rajaram

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 08:06 AM

    Hi

    why the data in the first Internal table will change?

    see the selects here, it won't change

    select

    vbeln " Billing Doc

    fkdat " Billing Date

    kunag " Customer Number

    fkart " Billing Type

    vkorg " Sales Organization

    land1 " Country

    bukrs " Company Code

    netwr " Net Value

    waerk " Currency

    kdgrp " Customer Group

    bzirk " Sales Employee

    into table it_vbrk

    from vbrk

    where

    bukrs = p_bukrs and

    vkorg in s_vkorg and

    land1 in s_land1 and

    kunag in s_kunnr and

    kdgrp in s_kdgrp and

    bzirk in s_bzirk and

    rfbsk = c_rfbsk.

    sort it_vbrk by vbeln fkdat kunnr.

    select kunnr " Customer Number

    gjahr " Fiscal Year

    belnr " Acc.Document

    buzei " Item

    budat " Posting Date

    blart " Doc Type

    shkzg " Dr/Cr Indicator

    dmbtr " Amount(Local Curr)

    dmbe2 " Amount(Doc Curr)

    waers " Currency

    zterm " Payment Terms

    vbeln " Billing Doc

    zfbdt " Baseline Date

    zbd1t " No of days

    into table it_bsad1

    from bsad

    for all entries in it_vbrk

    where kunnr = it_vbrk-kunnr and

    vbeln = it_vbrk-vbeln and

    bukrs = it_vbrk-bukrs and

    ( budat le p_date and

    budat ge v_date1 ) and

    blart = c_blart.

    sort it_bsad1 by kunnr gjahr belnr buzei budat.

    Regards

    Anji

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Rajaram..

      This is the reason:

      Here the FOR ALL ENTRIES is used to fetch the data from ZMASTER. So the records are fetched in the SORTED Order of the Primary key in Table ZMASTER.

      If you want them to be in the Sorted order of MATNR then.

      SELECT matnr arktx KWMENG VRKME FROM vbap

      INTO corresponding fields of table it_zlist

      WHERE vbeln = zctlk-vbeln.

      if sy-subrc = 0.

      select matnr test zsno ztnam from zmaster

      into corresponding fields of table it_first

      for all entries in it_zlist

      where matnr = it_zlist-matnr.

      endif.

      <b>

      SORT IT_ZLIST BY MATNR.</b>

      Reward if Helpful.

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 08:05 AM

    sort the internal table by the field which u are using in for all entries.

    Regards

    Vasu

    Add comment
    10|10000 characters needed characters exceeded