Joining of cluster tables

Hello Mr .kishan ,navneet ,sachin and aakash ,
I asked a doubt and you guyz are making mountain out a molehill.No one is Mr .Know here in this comm, the community should cater to the needs of all the proficiency levels .
You should also try to think about the freshers or novices who are starting their careers in SAP ABAP.
My primary concern was ,why we cant join cluster tables ?? all the MR KNOWS have given answers like ,we cant join ,we cant join .I wanted technical reason for it ,
Using for all entries is a solution they gave ,that i know .You think i havent searched the forum before asking the query .
Show me the correct technical valid reason for my query in the previous posted threads ,then i will accept my fault.
You should answer in a polite manner not bullying or degrading the SDN users that you report me to someone or delete my profile .Very disappointing experience .
Thank you .

I did not see you first question, so I can't comment on that. I assume it was quite easy to mix up your question with the many redundant ones that clog up this forum without providing added value. Also, there is no basic right that your requestions be answered, everybody is volunteering here, so you should act a bit more humble as the one seeking for advice.
To help the good cause:
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21f083446011d189700000e8322d00/content.htm
> You need the structural information stored in the ABAP Dictionary to read the data from a pooled table or cluster table correctly. These tables can therefore only be processed using Open SQL with the cluster interface, and not with Native SQL directly in the database.
I assume this applies to joins as well which are done at database level, the table structure needs be known and is not in case of cluster tables.
Thomas

Similar Messages

  • Join cluster table

    Hi
    I would like to make a joint with a table cluster (bseg) but the system put an error compilation. what a solution? Thank you for answer. 
    Even the creation of a view does not make with the tables cluster.

    Hi,
      You cannot write join for cluster tables like BSEG..Instead you can use FOR ALL ENTRIES options..
    EX..
    DATA: T_BKPF TYPE STANDARD TABLE OF BKPF,
          T_BSEG TYPE STANDARD TABLE OF BSEG.
    SELECT * FROM BKPF
           INTO TABLE T_BKPF
           WHERE....
    IF NOT T_BKPF IS INITIAL.
      SELECT * FROM BSEG
             INTO TABLE T_BSEG
             FOR ALL ENTRIES IN T_BKPF
             WHERE BUKRS = T_BKPF-BUKRS
             AND   BELNR = T_BKPF-BELNR
             AND   GJAHR = T_BKPF-GJAHR..
    ENDIF.
    Thanks,
    Naren

  • How to join cluster table?

    How to join the cluster table with the transparent table?In specific ,can you pls tell me how can i join bkpf and bseg?

    Hi Aravind,
    Check this code,
    tables : bkpf,
             bseg.
       INTERNAL TABLE AND WORK AREA FOR THE FIELDS IN BKPF TABLE         *
    data : begin of itab_bkpf occurs 0,
           bukrs like bkpf-bukrs,            "Company Code.
           gjahr like bkpf-gjahr,            "Fiscal Year.
           budat like bkpf-budat,            "Posting Date in the Document.
           belnr like bkpf-belnr,            "Accounting document number.
           blart like bkpf-blart,            "Document Type.
           end of itab_bkpf.
    data : wa_bkpf like line of itab_bkpf.
       INTERNAL TABLE AND WORK AREA FOR THE FIEDLS IN BSEG TABLE         *
    data : begin of itab_bseg_debit occurs 0,
           bukrs like bseg-bukrs,            "Company Code.
           gjahr like bseg-gjahr,            "Fiscal Year.
           belnr like bseg-belnr,            "Accounting Document Number.
           buzei like bseg-buzei,            "Line Item.
           hkont like bseg-hkont,            "General Leadger Account.
           shkzg like bseg-shkzg,            "Credit/Debit Indicator.
           wrbtr like bseg-wrbtr,            "Amount in Document Currency.
           pswsl like bseg-pswsl,            "Update Currency for Gen.Ledger
           dmbtr like bseg-dmbtr,            "Amount in local currency.
           sgtxt like bseg-sgtxt,            "Item Text.
           zuonr like bseg-zuonr,            "Assignment Number.
           end of itab_bseg_debit.
    data : itab_bseg_credit like standard table of itab_bseg_debit with
           header line.
                      FINAL OUTPUT INTERNAL TABLE                        *
    data : begin of itab_output occurs 0,
           belnr(08)            ,
           bukrs(04)            ,
           budat like bkpf-budat,
           buzei(03)            ,
           hkont(07)            ,
           blart(02)            ,
           shkzg(01)            ,
           wrbtr(08)            ,
           pswsl(05)            ,
           dmbtr(10)            ,
           sgtxt(19)            ,
           zuonr(10)            ,
    end of itab_output.
    constants : c_debit  type c value 'S',
                c_credit type c value 'H'.
                               SELECT-OPTIONS                            *
    selection-screen begin of block input with frame title text-t01.
    select-options : s_bukrs for bkpf-bukrs.
    parameters     : p_year like bkpf-gjahr visible length 2.
    select-options : s_budat  for bkpf-budat,
                     s_dbacct for bseg-hkont,
                     s_cracct for bseg-hkont,
                     s_amt    for bseg-dmbtr.
    selection-screen end of block input.
         SELECTING RECORDS FROM BKPF TABLE BASED ON THE CONDITION        *
    select bukrs gjahr budat belnr blart
           from  bkpf into table itab_bkpf
           where bukrs in s_bukrs and
                 gjahr eq p_year  and
                 budat in s_budat.
        SELECTING DEBIT LINE ITEMITEMS FROM BSEG FOR THE DOCUMENT        *
                      NUMBER SELECTED FROM BKPF                          *
    if not itab_bkpf[] is initial.
      select bukrs gjahr belnr buzei
             hkont shkzg wrbtr pswsl
             dmbtr sgtxt zuonr
             from bseg into table itab_bseg_debit
             for all entries in itab_bkpf
             where bukrs eq itab_bkpf-bukrs and
                   belnr eq itab_bkpf-belnr and
                   gjahr eq itab_bkpf-gjahr and
                   hkont in s_dbacct        and
                   shkzg eq c_debit         and
                   dmbtr in s_amt.
        SELECTING CREDIT LINE ITEMITEMS FROM BSEG FOR THE DOCUMENT       *
                      NUMBER SELECTED FROM BKPF                          *
      select bukrs gjahr belnr buzei
             hkont shkzg wrbtr pswsl
             dmbtr sgtxt zuonr
             from bseg into table itab_bseg_credit
             for all entries in itab_bkpf
             where bukrs eq itab_bkpf-bukrs and
                   belnr eq itab_bkpf-belnr and
                   gjahr eq itab_bkpf-gjahr and
                   hkont in s_cracct        and
                   shkzg eq c_credit        and
                   dmbtr in s_amt.
    endif.
    sort itab_bkpf        by bukrs gjahr belnr.
    sort itab_bseg_credit by bukrs gjahr belnr.
                         LOOPING THE DEBIT ENTRIES                       *
    loop at itab_bseg_debit.
    READING THE CREDIT ENTRIES WHICH MATCHES WITH HE CURRENT DOC. NUMBER *
      read table itab_bseg_credit with key
                 bukrs = itab_bseg_debit-bukrs
                 gjahr = itab_bseg_debit-gjahr
                 belnr = itab_bseg_debit-belnr binary search.
      if sy-subrc eq 0.
    *READING THE POSTING DATE AND DOCUMENT TYPE FOR THE CURRENT DOUCMENT   *
           AND APPENDING THE DEBIT AND CREDIT ENTRIES                    *
        read table itab_bkpf into wa_bkpf with key
                   bukrs = itab_bseg_debit-bukrs
                   gjahr = itab_bseg_debit-gjahr
                   belnr = itab_bseg_debit-belnr binary search.
        itab_output-belnr = itab_bseg_debit-belnr.
        itab_output-bukrs = itab_bseg_debit-bukrs.
        itab_output-budat = wa_bkpf-budat.
        itab_output-buzei = itab_bseg_debit-buzei.
        itab_output-hkont = itab_bseg_debit-hkont.
        itab_output-blart = wa_bkpf-blart.
        itab_output-shkzg = itab_bseg_debit-shkzg.
        itab_output-wrbtr = itab_bseg_debit-wrbtr.
        itab_output-pswsl = itab_bseg_debit-pswsl.
        itab_output-dmbtr = itab_bseg_debit-dmbtr.
        itab_output-sgtxt = itab_bseg_debit-sgtxt.
        itab_output-zuonr = itab_bseg_debit-zuonr.
        append itab_output.
        itab_output-belnr = itab_bseg_credit-belnr.
        itab_output-bukrs = itab_bseg_credit-bukrs.
        itab_output-budat = wa_bkpf-budat.
        itab_output-buzei = itab_bseg_credit-buzei.
        itab_output-hkont = itab_bseg_credit-hkont.
        itab_output-blart = wa_bkpf-blart.
        itab_output-shkzg = itab_bseg_credit-shkzg.
        itab_output-wrbtr = itab_bseg_credit-wrbtr.
        itab_output-pswsl = itab_bseg_credit-pswsl.
        itab_output-dmbtr = itab_bseg_credit-dmbtr.
        itab_output-sgtxt = itab_bseg_credit-sgtxt.
        itab_output-zuonr = itab_bseg_credit-zuonr.
        append itab_output.
      endif.
    endloop.
    sort itab_output by belnr budat shkzg.
                     LOOPING OUTPUT INTERNAL TABLE                       *
    *FORMAT INTENSIFIED INPUT.
    *FORMAT INVERSE ON.
    loop at itab_output.
      format hotspot on.
      format color 5 inverse.
      write :/  sy-vline,
               000 itab_output-belnr, 12  sy-vline,
               013 itab_output-bukrs, 17  sy-vline,
               019 itab_output-budat,     sy-vline,
               034 itab_output-buzei, 40  sy-vline,
               042 itab_output-hkont,     sy-vline,
               054 itab_output-blart, 60  sy-vline,
               065 itab_output-shkzg, 70  sy-vline,
               072 itab_output-wrbtr,     sy-vline,
               085 itab_output-pswsl,     sy-vline,
               093 itab_output-dmbtr,     sy-vline,
               106 itab_output-sgtxt,     sy-vline,
                   itab_output-zuonr,     sy-vline.
      format hotspot off.
    endloop.
    uline 0(139).
    <b>Regards,
    Jackie.</b>

  • Doubt in Cluster table

    Hi Experts,
    Can You plz tell How to import/read data from cluster table? Plz give me the syntaxes also..
    Thanx in advance.

    use  read statement i don't think in cluster table there is any restruction for read  and select u can  use  open sql but  not  join in cluster table .
    Database table defined in the ABAP Dictionary, whose version on the database is not only assigned to one table defined in the ABAP Dictionary. Several cluster tables are assigned to a table cluster in the database. The intersection of the key fields of the cluster tables forms the primary key of the table cluster. The other columns of the cluster tables are stored in compressed form in a single column VARDATA of the table cluster. <b>You can access cluster tables only via Open SQL, and only without using joins.</b>

  • Retrieve data from cluster tables

    hi
    can any one explain me how to retrieve data from cluster tables
    Regards
    sachin

    you can write a select
    select * from KONV
           into table it_konv
    where <condition>
    you cant join.. cluster tables..

  • How to fetch data from cluster tables

    hi
    i need to know  how to fetch data from cluster tables please update me if any
    i know that we cannot use joins in cluster table we use view etc
    but i need detailed inforation on methods for fetching data from cluster tables
    regards
    Nishant

    Hi,
        Check the following links
    http://fuller.mit.edu/hr/cluster_tables.html
    The specified item was not found.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33

  • Re: join cluster table into transperant table in ABAP Queries

    Hi gurus
    How to join cluster tables into transperant tables in ABAP Queries,
    I want to join KNA1, KNB2, BSEG(cluster table)
    pls explain me
    amk

    Hi
    You can use join for KNA1 and KNB1 which will much faster
    then use for all entries of this itab to get the BSEG to improve the performance
    here you need to do some trial and error method by joining  removing the tables and also for all entries
    regards
    Shiva

  • Why Inner join or Outer join is not used for Pool or Cluster tables  ?

    Hi SAP-ABAP Experts .
    With Due Regards .
    May u explain me why Inner join or Outer join is not useful for Pool or Cluster tables  ?
    because peoples advised not use Joins for Pool and Cluster tables , What harm will take place , If we do this ?
    Best Regards to all : Rajneesh

    Both Pooled and Cluster Tables are stored as tables within the database. Only the structures of the two table types which represent a single logical view of the data are defined within the ABAP/4 Data Dictionary. The data is actually stored in bulk storage in a different structure. These tables are commonly loaded into memory (i.e., 'buffered') due to the fact they are typically used for storing internal control information and other types of data with little or no external (business) relevance.
    Pooled and cluster tables are usually used only by SAP and not used by customers, probably because of the proprietary format of these tables within the database and because of technical restrictions placed upon their use within ABAP/4 programs. On a pooled or cluster table:
    Secondary indexes cannot be created.
    You cannot use the ABAP/4 constructs select distinct or group by.
    You cannot use native SQL.
    You cannot specify field names after the order by clause. order by primary key is the only permitted variation.
    I hope it helps.
    Best Regards,
    Vibha
    Please mark all the helpful answers

  • Joining of cluster  and pooled tables ,transparent tables

    Hi,
    I wanted to do join between  cluster  ,pooled and transparent tables  but inner join won't allow  to join between  transparent or cluster tables or pooled tables .  The requirements are that join should take place dynamically  between transparent ,cluster ,pooled tables .I have written the Function module for joining multiple tables for transparent tables but unable to implement same for the transparent and cluster or pooled tables.How to handle the joining of tables between pooled or cluster  and transparent tables kindly provide me the answer .
    Thanks,
    jahnavi.

    Hi Jahnavi,
    My suggestion would be... if you want to retrieve the data between cluster tables and transparent tables.. its better to go for views instead of cluster tables then that would be easier for you to retrieve the data
    let us take one example BSEG its a cluster table where as there is one view VBSEGK it contains almost all the important fields needed so that u can make use of those or you can look into BSIK and BSAK tables so it better to avoid the cluster tables while retriving the data from the performance point of view

  • Reg: how to join more than one cluster table into one

    Hi gurus
    How to join more than one cluster table into one
    amk

    Hi,
    You cannot join cluster tables
    Best way is to select from the header table and then select from the item table table using for all entries of header table.
    regards,
    Advait

  • How to 'inner join' internal table or cluster table ??

    Hi,
    when i inner join table BSEG it said is a cluster table can't be inner joined .
    i wonder how i can "inner join" bseg with a internal table such as
    data: begin of i_bseg_trans,
            bukrs like bseg-bukrs,
            gjahr like bseg-gjahr,
            belnr like bseg-belnr,
            total_runtimes like i_runtimes-total,
            already_runtimes like i_runtimes-already,
            left_runtimes like i_runtimes-left,
          end of i_bseg_trans.
    and similar things trouble me  when considering several internal tables .
    thanks for any help!!

    Hi,
    but if there's more than 2 tables,  for example
    data: begin of it_bseg occurs 0,
            bukrs like bseg-bukrs,
            else_1 type i,
         end of it_bseg.
    data: begin of t occurs 0,
            bukrs like bseg-bukrs,
          end of t.
    data: begin of r occurs 0,
            bukrs like bseg-bukrs,
            else type c,
          end of r.
    select bukrs from bkdf into table t.
    select bukrs from bkdf into corresponding fields of table it_bseg.
    select bseg~bukrs      "else_1
    from bseg      "it_bseg
      into table r
      for all entries in t
      where bseg~bukrs = t-bukrs.
          " and it_bseg-bukrs = t-bukrs.
    in the select clause i mean whether there's a method similar to the way just drop the " in my code.
    now my solution is to use another loop on it_bseg, but i think when table amount is large this is really a boring solution.

  • I want to join the table vbrk,vbrp,konv but konv is cluster table .

    Hi
       konv is the cluster table . so   I  want to join the table vbrk,vbrp,konv and fields are vbeln, knumv is possible .
    if it isn't possible. what is the another method output is doc. no.(vbrp-vbeln) condition doc. no.(vbrk-knumv) , condition(konv-kschl), tax rate(konv-mwsk1), quantitty(vbrp-fkimg) .reply pls... as soon as possible..

    hi
    good
    1) Open
        Select
               Mard~matnr
               Makt~maktx
          From Makt
          Inner Join Mard
          on    Maktmatnr = Mardmatnr
          Where Makt~Spras = SY-LANGU
    2) Native Oracle
          SELECT Mard.matnr,
                 Makt.maktx
          From Makt, Mard
          Where Makt.mandt = Mard.mandt
            And Makt.matnr = Mard.matnr
            And Makt.mandt = :SY-MANDT
            And Makt.spras = :SY-LANGU
    3) KONV is Cluster - BAD LUCK!
        Select VBRK~VBELN
               VBRP~POSNR
               KONV~KSCHL
               KONV~KWERT    
          From ( VBRK Inner Join VBRP
                 On VBRKVBELN = VBRPVBELN )
               Inner Join KONV
                 On  VBRKKNUMV = KONVKNUMV
                 And VBRPPOSNR = KONVKPOSN
    4) KONV is Cluster - BAD LUCK!
        Select KONV~KNUMV
               KONV~KPOSN
               KONV~KSCHL
               KONV~KWERT    
          From KONV
          Where KONV~KNUMV in (
               Select VBRK~KNUMV
                 From VBRK Inner Join VBRP
                 On VBRKVBELN = VBRPVBELN
                Where VBRKKNUMV = KONVKNUMV
                  And VBRPPOSNR = KONVKPOSN
    5) Open
             Select VBRP~MATNR
                    Sum( VBRP~NETWR )
              From VBRP
              Group By VBRP~MATNR 
    6) Native Oracle        
             Select VBRP.MATNR ,
                    Sum( VBRP.NETWR )
              From VBRP
              Where mandt = :sy-mandt
              Group By VBRP.MATNR         
    7) Native Oracle
             Select VBRP.MATNR ,
                    Count( VBRP.NETWR ),
                    Sum( VBRP.NETWR )
              From VBRP
              Where mandt = :sy-mandt
              Group By VBRP.MATNR    
    8) Open
             Select VBRP~MATNR
                    makt~maktx
                    Sum( VBRP~NETWR )
              From VBRP inner Join MAKT
                On VBRPMATNR = MAKTMATNR
              Where MAKT~SPRAS = SY-LANGU
              Group By VBRPMATNR maktmaktx      
    9) Native Oracle         
             Select VBRP.MANDT,
                    VBRP.MATNR,
                    MAKT.MAKTX,
                    Sum( VBRP.NETWR )
              From VBRP , MAKT
             Where  VBRP.MANDT = MAKT.MANDT
               And  VBRP.MATNR = MAKT.MATNR
               And  MAKT.SPRAS = :SY-LANGU
              Group By VBRP.MANDT, VBRP.MATNR, MAKT.MAKTX   
    10) Open          
         SELECT EKET~EBELN 
                EKET~EINDT 
                EKET~WAMNG 
                EKET~WEMNG 
          From  ( ekko INNER JOIN ekpo
                  ON  ekkomandt = ekpomandt
                  AND ekkoebeln = ekpoebeln
                INNER JOIN eket
                ON  ekpomandt = eketmandt
                AND ekpoebeln = eketebeln
                AND ekpoebelp = eketebelp
                AND EKET~WAMNG > 0
                AND EKETWAMNG <> EKETWEMNG
         Where EKPO~MATNR = 'NB220'
           And EKPO~WERKS  In ('P001', 'P004', 'L004')
           And EKKO~BSTYP = 'F'
           And EKKO~BSART = 'UB'
           And EKPO~ELIKZ <> 'X'
           And EKKO~LOEKZ <> 'X'     
    11) Native Oracle      
         SELECT EKET.EBELN, 
                EKET.EINDT, 
                EKET.WAMNG, 
                EKET.WEMNG 
          FROM  ( ekko INNER JOIN ekpo
                  ON  ekko.mandt = ekpo.mandt
                  AND ekko.ebeln = ekpo.ebeln
                INNER JOIN eket
                ON  ekpo.mandt = eket.mandt
                AND ekpo.ebeln = eket.ebeln
                AND ekpo.ebelp = eket.ebelp
                AND EKET.WAMNG > 0
                AND EKET.WAMNG <> EKET.WEMNG
         Where EKPO.MATNR = 'NB220'
           And EKPO.WERKS  In ('P001', 'P004', 'L004')
           And EKKO.BSTYP = 'F'
           And EKKO.BSART = 'UB'
           And EKPO.ELIKZ <> 'X'
           And EKKO.LOEKZ <> 'X'
    thanks
    mrutyun^

  • How do we join cluster table bseg?

    Friends ,
    i just wanna know as 2 how can we combine bseg and bkpf tables.
    since bkpf is a transparent table and bseg is a cluster table.
    regards
    Essam
    [email protected]

    Hi Essam,
        REPORT  ztestport_01.
    TABLES : bkpf,
             bseg.
       INTERNAL TABLE AND WORK AREA FOR THE FIELDS IN BKPF TABLE         *
    DATA : BEGIN OF itab_bkpf OCCURS 0,
           bukrs LIKE bkpf-bukrs,            "Company Code.
           gjahr LIKE bkpf-gjahr,            "Fiscal Year.
           budat LIKE bkpf-budat,            "Posting Date in the Document.
           belnr LIKE bkpf-belnr,            "Accounting document number.
           blart LIKE bkpf-blart,            "Document Type.
           END OF itab_bkpf.
    DATA : wa_bkpf LIKE LINE OF itab_bkpf.
       INTERNAL TABLE AND WORK AREA FOR THE FIEDLS IN BSEG TABLE         *
    DATA : BEGIN OF itab_bseg_debit OCCURS 0,
           bukrs LIKE bseg-bukrs,            "Company Code.
           gjahr LIKE bseg-gjahr,            "Fiscal Year.
           belnr LIKE bseg-belnr,            "Accounting Document Number.
           buzei LIKE bseg-buzei,            "Line Item.
           hkont LIKE bseg-hkont,            "General Leadger Account.
           shkzg LIKE bseg-shkzg,            "Credit/Debit Indicator.
           wrbtr LIKE bseg-wrbtr,            "Amount in Document Currency.
           pswsl LIKE bseg-pswsl,            "Update Currency for Gen.Ledger
           dmbtr LIKE bseg-dmbtr,            "Amount in local currency.
           sgtxt LIKE bseg-sgtxt,            "Item Text.
           zuonr LIKE bseg-zuonr,            "Assignment Number.
           END OF itab_bseg_debit.
    DATA : itab_bseg_credit LIKE STANDARD TABLE OF itab_bseg_debit WITH
           HEADER LINE.
                      FINAL OUTPUT INTERNAL TABLE                        *
    DATA : BEGIN OF itab_output OCCURS 0,
           belnr(08)            ,
           bukrs(04)            ,
           budat LIKE bkpf-budat,
           buzei(03)            ,
           hkont(07)            ,
           blart(02)            ,
           shkzg(01)            ,
           wrbtr(08)            ,
           pswsl(05)            ,
           dmbtr(10)            ,
           sgtxt(19)            ,
           zuonr(10)            ,
    END OF itab_output.
    CONSTANTS : c_debit  TYPE c VALUE 'S',
                c_credit TYPE c VALUE 'H'.
                               SELECT-OPTIONS                            *
    SELECTION-SCREEN BEGIN OF BLOCK input WITH FRAME TITLE text-t01.
    SELECT-OPTIONS : s_bukrs FOR bkpf-bukrs.
    PARAMETERS     : p_year LIKE bkpf-gjahr visible length 2.
    SELECT-OPTIONS : s_budat  FOR bkpf-budat,
                     s_dbacct FOR bseg-hkont,
                     s_cracct FOR bseg-hkont,
                     s_amt    FOR bseg-dmbtr.
    SELECTION-SCREEN END OF BLOCK input.
         SELECTING RECORDS FROM BKPF TABLE BASED ON THE CONDITION        *
    SELECT bukrs gjahr budat belnr blart
           FROM  bkpf INTO TABLE itab_bkpf
           WHERE bukrs IN s_bukrs AND
                 gjahr EQ p_year  AND
                 budat IN s_budat.
        SELECTING DEBIT LINE ITEMITEMS FROM BSEG FOR THE DOCUMENT        *
                      NUMBER SELECTED FROM BKPF                          *
    IF NOT itab_bkpf[] IS INITIAL.
      SELECT bukrs gjahr belnr buzei
             hkont shkzg wrbtr pswsl
             dmbtr sgtxt zuonr
             FROM bseg INTO TABLE itab_bseg_debit
             FOR ALL ENTRIES IN itab_bkpf
             WHERE bukrs EQ itab_bkpf-bukrs AND
                   belnr EQ itab_bkpf-belnr AND
                   gjahr EQ itab_bkpf-gjahr AND
                   hkont IN s_dbacct        AND
                   shkzg EQ c_debit         AND
                   dmbtr IN s_amt.
        SELECTING CREDIT LINE ITEMITEMS FROM BSEG FOR THE DOCUMENT       *
                      NUMBER SELECTED FROM BKPF                          *
      SELECT bukrs gjahr belnr buzei
             hkont shkzg wrbtr pswsl
             dmbtr sgtxt zuonr
             FROM bseg INTO TABLE itab_bseg_credit
             FOR ALL ENTRIES IN itab_bkpf
             WHERE bukrs EQ itab_bkpf-bukrs AND
                   belnr EQ itab_bkpf-belnr AND
                   gjahr EQ itab_bkpf-gjahr AND
                   hkont IN s_cracct        AND
                   shkzg EQ c_credit        AND
                   dmbtr IN s_amt.
    ENDIF.
    SORT itab_bkpf        BY bukrs gjahr belnr.
    SORT itab_bseg_credit BY bukrs gjahr belnr.
                         LOOPING THE DEBIT ENTRIES                       *
    LOOP AT itab_bseg_debit.
    READING THE CREDIT ENTRIES WHICH MATCHES WITH HE CURRENT DOC. NUMBER *
      READ TABLE itab_bseg_credit WITH KEY
                 bukrs = itab_bseg_debit-bukrs
                 gjahr = itab_bseg_debit-gjahr
                 belnr = itab_bseg_debit-belnr BINARY SEARCH.
      IF sy-subrc EQ 0.
    *READING THE POSTING DATE AND DOCUMENT TYPE FOR THE CURRENT DOUCMENT   *
           AND APPENDING THE DEBIT AND CREDIT ENTRIES                    *
        READ TABLE itab_bkpf INTO wa_bkpf WITH KEY
                   bukrs = itab_bseg_debit-bukrs
                   gjahr = itab_bseg_debit-gjahr
                   belnr = itab_bseg_debit-belnr BINARY SEARCH.
        itab_output-belnr = itab_bseg_debit-belnr.
        itab_output-bukrs = itab_bseg_debit-bukrs.
        itab_output-budat = wa_bkpf-budat.
        itab_output-buzei = itab_bseg_debit-buzei.
        itab_output-hkont = itab_bseg_debit-hkont.
        itab_output-blart = wa_bkpf-blart.
        itab_output-shkzg = itab_bseg_debit-shkzg.
        itab_output-wrbtr = itab_bseg_debit-wrbtr.
        itab_output-pswsl = itab_bseg_debit-pswsl.
        itab_output-dmbtr = itab_bseg_debit-dmbtr.
        itab_output-sgtxt = itab_bseg_debit-sgtxt.
        itab_output-zuonr = itab_bseg_debit-zuonr.
        APPEND itab_output.
        itab_output-belnr = itab_bseg_credit-belnr.
        itab_output-bukrs = itab_bseg_credit-bukrs.
        itab_output-budat = wa_bkpf-budat.
        itab_output-buzei = itab_bseg_credit-buzei.
        itab_output-hkont = itab_bseg_credit-hkont.
        itab_output-blart = wa_bkpf-blart.
        itab_output-shkzg = itab_bseg_credit-shkzg.
        itab_output-wrbtr = itab_bseg_credit-wrbtr.
        itab_output-pswsl = itab_bseg_credit-pswsl.
        itab_output-dmbtr = itab_bseg_credit-dmbtr.
        itab_output-sgtxt = itab_bseg_credit-sgtxt.
        itab_output-zuonr = itab_bseg_credit-zuonr.
        APPEND itab_output.
      ENDIF.
    ENDLOOP.
    SORT itab_output BY belnr budat shkzg.
    then loop your final itab_output
    and give write command to print
    your fields.
    <b>Regards,
    Jackie.</b>
    Message was edited by:
            Jackie

  • Regarding performance on cluster tables.vvv.urgent!

    friends,
      i know that cluster tables cannot be joined with transparent tables....
       however i need performance improvement for the following code....
       if possible is there a way to join bkpf or bseg to improve performance....can we create view foe bkpf and bseg if yes then how.....
      please modify the below code for improvement in performance.
      START-OF-SELECTION.
      SELECT bukrs belnr gjahr budat FROM bkpf INTO TABLE i_bkpf
      WHERE bukrs = p_bukrs AND "COMPANY CODE
              gjahr = p_gjahr AND "FISCAL YEAR
              budat IN s_budat. "POSTING DATE IN DOC
      IF sy-subrc = 0.
      SELECT bukrs belnr gjahr hkont shkzg dmbtr FROM bseg INTO TABLE
            i_bseg FOR ALL ENTRIES IN  i_bkpf
            WHERE bukrs = i_bkpf-bukrs AND "COMPANY CODE
                  belnr = i_bkpf-belnr AND "A/CING DOC NO
                  gjahr = i_bkpf-gjahr AND "FISCAL YEAR
                  hkont = p_hkont. "General Ledger Account"
        IF sy-subrc = 0.
         SELECT bukrs belnr gjahr hkont shkzg dmbtr FROM bseg INTO TABLE
                i_bseg1 FOR ALL ENTRIES IN  i_bseg
                WHERE bukrs = i_bseg-bukrs AND  "COMPANY CODE
                      belnr = i_bseg-belnr AND  "A/CING DOC NO
                      gjahr = i_bseg-gjahr.   "FISCAL YEAR
        ENDIF.
      ENDIF.
      IF NOT i_bseg1[] IS INITIAL.
        LOOP AT i_bseg1.
          IF i_bseg1-hkont = p_hkont AND i_bseg1-shkzg = 'S'.
            v_sumgl = v_sumgl + i_bseg1-dmbtr.
          ELSEIF i_bseg1-hkont = p_hkont AND i_bseg1-shkzg = 'H'.
            v_sumgl = v_sumgl - i_bseg1-dmbtr.
          ELSEIF i_bseg1-hkont NE p_hkont .
            IF i_bseg1-shkzg = 'H'.
              i_bseg1-dmbtr = - i_bseg1-dmbtr.
            ENDIF.
            i_alv-hkont = i_bseg1-hkont.
            i_alv-dmbtr = i_bseg1-dmbtr.
            APPEND i_alv.
            v_sumoffset = v_sumoffset + i_bseg1-dmbtr.
          ENDIF.
        ENDLOOP.
    regards
    Essam.([email protected])

    Hi there ...
    I have read the note - thats where I found the link to the trace note 286496.1 - on now to setup a trace
    But I still need an explanation for the methods (1,2,4 etc)
    regards
    Mette

  • Cluster tables in SAP

    Hi all,
    what are the cluster tables in SAP.
    and shall we use inner join statment on cluster tables.
    regards,
    Suresh

    HI,
    <b>CLUSTER Tables :-</b>Table clusters (clusters) are special table types in the ABAP Dictionary
    The data from several tables is stored together in a table pool or table cluster. Tables assigned to a table pool or table cluster are referred to as pooled tables or cluster tables.
    Table pool or table cluster should be used exclusively for storing internal control information (screen sequences, program parameters, temporary data, continuous texts such as documentation). Data of commercial relevance is usually stored in transparent tables.
    Can check this link for more clarity
    http://help.sap.com/saphelp_47x200/helpdata/en/81/415d363640933fe10000009b38f839/frameset.htm
    <b>We can't use inner join on clustor table.
    To Join cluster table with other table its better use
    several select statements.</b>
    This one sample code to join cluster table with other transperant table.
    In this bseg is a cluster table.
    Check it out.
    TABLES : bkpf,
             bseg.
       INTERNAL TABLE AND WORK AREA FOR THE FIELDS IN BKPF TABLE         *
    DATA : BEGIN OF itab_bkpf OCCURS 0,
           bukrs LIKE bkpf-bukrs,            "Company Code.
           gjahr LIKE bkpf-gjahr,            "Fiscal Year.
           budat LIKE bkpf-budat,            "Posting Date in the Document.
           belnr LIKE bkpf-belnr,            "Accounting document number.
           blart LIKE bkpf-blart,            "Document Type.
           END OF itab_bkpf.
    DATA : wa_bkpf LIKE LINE OF itab_bkpf.
       INTERNAL TABLE AND WORK AREA FOR THE FIEDLS IN BSEG TABLE         *
    DATA : BEGIN OF itab_bseg_debit OCCURS 0,
           bukrs LIKE bseg-bukrs,            "Company Code.
           gjahr LIKE bseg-gjahr,            "Fiscal Year.
           belnr LIKE bseg-belnr,            "Accounting Document Number.
           buzei LIKE bseg-buzei,            "Line Item.
           hkont LIKE bseg-hkont,            "General Leadger Account.
           shkzg LIKE bseg-shkzg,            "Credit/Debit Indicator.
           wrbtr LIKE bseg-wrbtr,            "Amount in Document Currency.
           pswsl LIKE bseg-pswsl,            "Update Currency for Gen.Ledger
           dmbtr LIKE bseg-dmbtr,            "Amount in local currency.
           sgtxt LIKE bseg-sgtxt,            "Item Text.
           zuonr LIKE bseg-zuonr,            "Assignment Number.
           END OF itab_bseg_debit.
    DATA : itab_bseg_credit LIKE STANDARD TABLE OF itab_bseg_debit WITH
           HEADER LINE.
                      FINAL OUTPUT INTERNAL TABLE                        *
    DATA : BEGIN OF itab_output OCCURS 0,
           belnr(08),
           bukrs(04),
           budat LIKE bkpf-budat,
           buzei(03),
           hkont(07),
           blart(02),
           shkzg(01),
           wrbtr(08),
           pswsl(05),
           dmbtr(10),
           sgtxt(19),
           zuonr(10),
    END OF itab_output.
    CONSTANTS : c_debit TYPE c VALUE 'S',
                c_credit TYPE c VALUE 'H'.
                               SELECT-OPTIONS                            *
    SELECTION-SCREEN BEGIN OF BLOCK input WITH FRAME TITLE text-t01.
    SELECT-OPTIONS : s_bukrs FOR bkpf-bukrs.
    PARAMETERS     : p_year LIKE bkpf-gjahr.
    SELECT-OPTIONS : s_budat  FOR bkpf-budat,
                     s_dbacct FOR bseg-hkont,
                     s_cracct FOR bseg-hkont,
                     s_amt    FOR bseg-dmbtr.
    SELECTION-SCREEN END OF BLOCK input.
         SELECTING RECORDS FROM BKPF TABLE BASED ON THE CONDITION        *
    SELECT bukrs gjahr budat belnr blart
           FROM bkpf INTO TABLE itab_bkpf
           WHERE bukrs IN s_bukrs AND
                 gjahr EQ p_year  AND
                 budat IN s_budat.
        SELECTING DEBIT LINE ITEMITEMS FROM BSEG FOR THE DOCUMENT        *
                      NUMBER SELECTED FROM BKPF                          *
    IF NOT itab_bkpf[] IS INITIAL.
      SELECT bukrs gjahr belnr buzei
             hkont shkzg wrbtr pswsl
             dmbtr sgtxt zuonr
             FROM bseg INTO TABLE itab_bseg_debit
             FOR ALL ENTRIES IN itab_bkpf
             WHERE bukrs EQ itab_bkpf-bukrs AND
                   belnr EQ itab_bkpf-belnr AND
                   gjahr EQ itab_bkpf-gjahr AND
                   hkont IN s_dbacct        AND
                   shkzg EQ c_debit         AND
                   dmbtr IN s_amt.
        SELECTING CREDIT LINE ITEMITEMS FROM BSEG FOR THE DOCUMENT       *
                      NUMBER SELECTED FROM BKPF                          *
      SELECT  bukrs gjahr belnr buzei
              hkont shkzg wrbtr pswsl
              dmbtr sgtxt zuonr
              FROM bseg INTO TABLE itab_bseg_credit
              FOR ALL ENTRIES IN itab_bkpf
              WHERE bukrs EQ itab_bkpf-bukrs AND
                    belnr EQ itab_bkpf-belnr AND
                    gjahr EQ itab_bkpf-gjahr AND
                    hkont IN s_cracct        AND
                    shkzg EQ c_credit        AND
                    dmbtr IN s_amt.
    ENDIF.
    SORT itab_bkpf        BY bukrs gjahr belnr.
    SORT itab_bseg_credit BY bukrs gjahr belnr.
                         LOOPING THE DEBIT ENTRIES
    LOOP AT itab_bseg_debit.
    READING THE CREDIT ENTRIES WHICH MATCHES WITH HE CURRENT DOC. NUMBER
      READ TABLE itab_bseg_credit WITH KEY
                 bukrs = itab_bseg_debit-bukrs
                 gjahr = itab_bseg_debit-gjahr
                 belnr = itab_bseg_debit-belnr BINARY SEARCH.
      IF sy-subrc EQ 0.
    *READING THE POSTING DATE AND DOCUMENT TYPE FOR THE CURRENT DOUCMENT
           AND APPENDING THE DEBIT AND CREDIT ENTRIES
        READ TABLE itab_bkpf INTO wa_bkpf WITH KEY
                   bukrs = itab_bseg_debit-bukrs
                   gjahr = itab_bseg_debit-gjahr
                   belnr = itab_bseg_debit-belnr BINARY SEARCH.
        itab_output-belnr = itab_bseg_debit-belnr.
        itab_output-bukrs = itab_bseg_debit-bukrs.
        itab_output-budat = wa_bkpf-budat.
        itab_output-buzei = itab_bseg_debit-buzei.
        itab_output-hkont = itab_bseg_debit-hkont.
        itab_output-blart = wa_bkpf-blart.
        itab_output-shkzg = itab_bseg_debit-shkzg.
        itab_output-wrbtr = itab_bseg_debit-wrbtr.
        itab_output-pswsl = itab_bseg_debit-pswsl.
        itab_output-dmbtr = itab_bseg_debit-dmbtr.
        itab_output-sgtxt = itab_bseg_debit-sgtxt.
        itab_output-zuonr = itab_bseg_debit-zuonr.
        APPEND itab_output.
        itab_output-belnr = itab_bseg_credit-belnr.
        itab_output-bukrs = itab_bseg_credit-bukrs.
        itab_output-budat = wa_bkpf-budat.
        itab_output-buzei = itab_bseg_credit-buzei.
        itab_output-hkont = itab_bseg_credit-hkont.
        itab_output-blart = wa_bkpf-blart.
        itab_output-shkzg = itab_bseg_credit-shkzg.
        itab_output-wrbtr = itab_bseg_credit-wrbtr.
        itab_output-pswsl = itab_bseg_credit-pswsl.
        itab_output-dmbtr = itab_bseg_credit-dmbtr.
        itab_output-sgtxt = itab_bseg_credit-sgtxt.
        itab_output-zuonr = itab_bseg_credit-zuonr.
        APPEND itab_output.
      ENDIF.
    ENDLOOP.
    Reward if it helps you.
    Thanks.

Maybe you are looking for