Fetching data slow from MSEG and BSEG table

Dear Experts,
Out  MSEG and BSEG are major tables which are very slow and taking 5-10 minutes in fetching just 20/30 records.
Why this table taking more time and how I can fatch fast  data from these table.
regards

> Out  MSEG and BSEG are major tables which are very slow and taking 5-10 minutes in fetching just 20/30 records.
> Why this table taking more time and how I can fatch fast  data from these table.
Do you select on key fields or on indexed fields? How do you select?
If not, then the database must read the full table and check which of the entries are valid for your selection.
Do an SQL trace using ST05, run the command, stop the trace and check the explain.
Markus

Similar Messages

  • From  Mseg to Bseg ( table linking )

    Hai gurus ,,
            I am doing Goods Reciept Register.
         I need a small table linking   from Mseg to Bseg.
    ( If suppose from Bseg to mseg mean we can Fetch the data like
    select  '.. . . .
    where
    Mseg-mblnr = bseg-awkry+0(10).
    In Bseg-awkey first 10 No. will be Material DOcu No.
    But how to fetch the data from Mseg to Bseg..
    Plz send the code Its too urgent.

    hi this is the relation between the keyfiels of these tables...
    mesg    bseg
    where condition...
    it_mseg-parbu  =  it_bseg-BUKRS
    it_mseg-MBLNR = it_bseg-BELNR
    it_mseg-MJAHR = it_bseg-GJAHR
    it_mseg-BUZEI   = it_bseg-BUZEI
    reward points if useful,
    venkat.
    Edited by: venkat  appikonda on Mar 29, 2008 1:56 PM

  • Data needed from emp and dept tables

    Wondering if somebody can querry the emp table and dept table that comes with some versions of oracle already built in.
    I need the data produced from these two querries
    select * from emp
    select * from dept

    If you look in ORACLE_HOME/sqlplus/demo you'll find demobld.sql which contains the script the build all the scott tables.

  • Data retrieval from proj and prps  tables

    I want to retrieve the data from proj & prps by giving selection parameter as
    project defination (proj-pspid). Please give me an idea about this. Is there any common field i  between these two.
    regards

    Hello,
    Check this:
    *--- Selektion von PSP-Elemente
      SELECT PRPS~PSPNR  PROJ~PSPID  PRPS~POSID  PRPS~POST1
             PRPS~OBJNR  PRPS~PSPHI
         INTO TABLE G_T_PSP
         FROM PRPS
         JOIN PROJ   ON PRPS~PSPHI = PROJ~PSPNR
         WHERE PROJ~PSPID IN SO_PROJ
           AND PROJ~LOEVM EQ SPACE
           AND POSID      IN SO_PSP
           AND PRART      IN SO_PRART
           AND PRPS~LOEVM EQ SPACE
           AND PRPS~PBUKR IN SO_PBUKR.
    Regards,
    Vasanth

  • Data recovery from BSIS and BSAS tables

    Hi all,
    The records in the tables BSIS and BSAS are deleted due to adhoc circumstances.
    How do I recover this data in SAP?
    Please help!!!
    Thanks,
    Raghav

    Hello Raghav,
    two possibilities without a complete restore (in a standard SAP environment):
    1) Flashback Query (but it only works if your UNDO tablespace still contains all the data - parameter undo_retention):
    http://docs.oracle.com/cd/E11882_01/appdev.112/e25518/adfns_flashback.htm#ADFNS01003
    2) LogMiner
    http://docs.oracle.com/cd/E11882_01/server.112/e22490/logminer.htm#i1005553
    Regards
    Stefan

  • Problem in Selecting the data from EKPO and KONV tables

    Hi Experts,
    Presently I am working on Report with Comparision-Sheet Between the vendor's Quotations. I have to display the Discount, Freight, Packing and Forwarding, Vat in Item level data based on the conditions made in PO.
    As per my Knowledge, Condition Types are stored in KONV Table. But there is no relation between KONV and EKPO tables.  So, I am unable to print the data for Discount, Freight, Packing and Forwarding, Vat... How can I get the values from EKPO and KONV tables?
    Thanks in Advance.
    Thanks n Regards,
    Muralikrishna.

    Don't recall if this is correct, but you may need the condition number from the header (EKKO) combined with EKPO-EBELP or other field as you key to access KONV (KNUMH and KPOSN).  My site doesn't run PP, so can't verify if the data is actually stored that, so just a possibility.

  • Create a Logical Database Based on Mseg and Bseg

    Hi,
      how can i create a Logical database using bkpf,bseg,mkpf,mseg. i need to know , which table is a root node ?
    could any one help me?
       Thanks

    Hi Amit,
           While I am Creating the Logical Database by selection MKPF as root node, i have one problem.
       my selection-screen is,
        Plant  Bseg-werks,
        G/Laccount Bseg-Hkont,
        Fin year bseg-gjahr,
        Grn Date Bkpf-Budat,
        Vendor No Bseg-lifnr,
        Po        Bseg-ebeln,
        MatNr     Bseg-matnr.
      My LDB structure is
             MKPF
    Mseg
    BKPF
    Bseg.
      My Doubt is, how can I access the glaccount details from bseg and How can i fetch the data from Mseg and Mkpf
    (Grn details) .
      If you give the Source code it is very useful to me.
      Thanks,
      Neptune.M

  • Select Query info req for ZMKPFMSEG: View of MSEG and MKPF table

    Hi
    I am fetching 7-8 records frm ZMKPFMSEG: View of MSEG and MKPF table,which based on matnr,werks & budut,which is taking a large time,there is no index in the table,so can nay one tell me how to fetch the data,to make code more effictient.
    SELECT  budat
              matnr
              menge
              bwart
              meins
              bwtar
              waers
              dmbtr
              shkzg
              matkl
              FROM  zmkpfmseg
              INTO  CORRESPONDING FIELDS OF TABLE it_mseg
              WHERE budat GE r_ytd-low
                AND matnr IN so_matnr
                AND werks = p_werks
                AND lgort IN so_lgort
                AND matkl IN so_matkl.
    plz tell me what changes have to be done in where condtion to make it run fast.
    regds

    Hi,
    Try the alternate Methods,
    ACCESS VIA SUBQUERY.
    SELECT * FROM MKPF AS M INTO CORRESPONDING FIELDS OF SWAP
                                        WHERE  BUDAT IN BUDAT AND
                                               MBLNR IN MBLNR AND
                                               VGART = 'WA' AND
                                               EXISTS ( SELECT * FROM MSEG
                                                        WHERE MBLNR = M~MBLNR
                                                        AND   MJAHR = M~MJAHR
                                                       AND   WERKS = P_WERKS
    AND matnr IN so_matnr
    AND lgort IN so_lgort
    AND matkl IN so_matkl.
        APPEND SWAP.CLEAR SWAP.
      ENDSELECT.
      LOOP AT SWAP.
        SELECT  * FROM MSEG
                                 WHERE MBLNR = SWAP-MBLNR AND
                                        MJAHR = SWAP-MJAHR AND
          IF SY-SUBRC EQ 0.
            MOVE-CORRESPONDING SWAP TO ITAB.
            MOVE-CORRESPONDING MSEG TO ITAB.
            APPEND ITAB.CLEAR ITAB.
            CLEAR MSEG.
          ENDIF.
        ENDSELECT.
        CLEAR : SWAP,ITAB.
      ENDLOOP.
    Try this,
    SELECT budat
    matnr
    menge
    bwart
    meins
    bwtar
    waers
    dmbtr
    shkzg
    matkl
    FROM zmkpfmseg
    INTO CORRESPONDING FIELDS OF TABLE it_mseg
    WHERE budat GE r_ytd-low
    AND matnr IN so_matnr
    AND lgort IN so_lgort
    AND matkl IN so_matkl.
    delete it_mseg where WERKS NE p_WERKS .
    Reward Points if helpful.
    Regards,
    Balakumar.G

  • Oracle Assets Category-wise Report from FA and GL tables

    Hi,
    I am developing a customized report (Schedule of Fixed Assets) in the Oracle Assets Module, Which includes Category Wise Opening Balance, additions, adjustments, transfer IN, Transfer OUT and Retirements of Cost and Depreciations. I am using FA tables (FA_CATEGORY_BOOKS, FA_CATEGORIES_B) for category_id, category_name (segment1 of category combination) and book_type_code (Book Name). And I am also using GL tables (GL_BALANCES, GL_JE_HEADERS, GL_JE_LINES) for the amount of begin_balance_dr,begin_balance_cr,accounted_dr and accounted_cr.
    The report gets the category_id,category_name from FA_CATEGORIES_B and book_type_code, asset_account_ccid, reserve_account_ccid and book_type_code from FA_CATEGORY_BOOKS for a single book. The sum of accounted_dr or sum of accounted_cr is calculated for a single category_id whose asset_account_ccid is matched with code_combination_id of GL_JE_LINES.
    There are 15 books each have many projects (FA_CATEGORIE_B.segment6). This report is working as desired for 14 books but in one book there is same asset_account_ccid and reserve_account_ccid for more than one category_id(s). That’s why the same amount is displayed against the multiple category_ids .
    As functionally it is possible in Oracle Assets to have same asset_account_ccid or reserve_account_ccid for more than one category_ids, I want to know that is there any other attribute(except asset_account_ccid,reserve_account_ccid and code_combination_id) which can be used to get the separate data for each category_id from GL tables.
    Regards,
    Fahim
    [email protected]

    hi vijay,
    thanks for your quick reply,
    i'm preparing a reports,fields from bsis and bseg database tables,
    and,my select statement giving error,saying that cluster table can't be joined,
    my problem is,how to write the select statement without inner join those tables,is there any alternative,
    i heard there is 'select for all entries',but i don't know proper usage of that addition,
    regards,
    kc

  • FBL5N t code and BSEG table is showing wrong contract number

    Hi,
    The proces flow is contract number>sales order>DMR-->Invoice
    Now when I am checking the VBFA table it's showing correct contract number against invoices but FBL5N t code and BSEG table are showing wrong contract numbers.
    Why FBL5N and BSEG table is showing wrong contract number?
    Currently we are using one enhancement and user exit is used to incorporate one customized field as identifier for bill type.
    1. During the billing document release to accounting VFX3, The user exit triggering and it is update the customized fields and Net settlement indicator.
    2. Using the Invoice number, get the fields VGBEL(Document number of the reference document) and VGPOS (Item number of the reference item) from VBRP and read table VBAP with VBELN and POSNR, to get DMR number (Sales Document) that created for the Invoice.
    3. Use fields VGBEL and VGPOS on table VBAP to get the sale order number.
    4. By using the Sales order number, get the Distribution channel to update Net indicator field
    In accounting table BSEG-UZAWE = JF must be updated on the customer line.
    5. Retrieve the sale order number and item level to get customized field from table VBAP
    Any pointers.
    Thanks
    Ashu

    Hi Reazuddin,
    Thanks for your reply,
    I am concercerned about BSEG table and using user exit EXIT_SAPLV60B_008 to post the document in FI.
    Now in we have enhanced this user exit  for contracts and included in this way.
      SELECT SINGLE ZZ_CONTRACT FROM VBAK INTO (LC_CONTRACT) WHERE VBELN EQ cvbrp-vgbel.
    Endloop.
    *Moving the values to final accounting table
    loop at xaccit.
    xaccit-vertn = lc_contract.
    xaccit-VBEL2 = xaccit-AUBEL.
    xaccit-xref3 = lc_vbel2.
    MODIFY xaccit .
    ENDLOOP.
    Clear: lc_contract,lc_vgbel,lc_vgpos,lc_vbel2.
    But I am getting correct data when checked other clients( development and quality), this problem I am getting in production.
    Do I need to ask the ABAP'er to debug this enhancement in production?
    Thanks
    Ashutosh

  • Need to fetch the plant from route and country

    Hi all,
    I need to fetch the "plant" from "route" and "country".
    is there any table having all the 3 fields, or any way to link these 3 fields ??
    thanks
    Sri

    Hi Sri,
         Try the COPA docs table CE1*
    Regards,
    Sandeep

  • To fetch XML files from database  AND regarding barcodes

    Hi !!
    I am very new to this forum...this is my first mail to this forum...
    1.) Actually I would like to know how to fetch XML files from database and then how to get the datas from that XML files???Right now i am using struts frame work...If u anyone send some sample code for this one,it is Very helpful for me.....
    2.)Using java ,how to generate Barcodes?In database I have Some serial number.While I try to display the serial number in Front end ,I should display with Barcode Corresponding to that number.Plz send some sample codes if u have.....
    Thanks in ADVANCE,

    PonJAVA wrote:
    Hi !!
    I am very new to this forum...this is my first mail to this forum...
    1.) Actually I would like to know how to fetch XML files from databaseStart with a JDBC tutorial. Check out DAO Pattern and Hibernate as well.
    and then how to get the datas from that XML files???Google Java & XML (there are many ways to do this
    Right now i am using struts frame work...Okay...
    If u anyone send some sample code for this one,it is Very helpful for me..... You haven't provided any detail regarding your task so there's no way anyone could post code for you.
    2.)Using java ,how to generate Barcodes?Search Google
    In database I have Some serial number.While I try to display the serial number in Front end ,I should display with Barcode Corresponding to that number.Plz send some sample codes if u have.....Try a JSP/Servlet tutorial.

  • Link between Anep and bseg table.

    How are ANEP and BSEG table related functionally? I am using the ANBTR field from ANEP table and retrieving the HKONT(G/L account) field from BSEG. I want to ask if entry for some assete exists in ANEP table then is it necessarty to have G/L account in BSEG table corresponding to this asset in ANEP. I am joining the two tables on BUKRS, BELNR, BUZEI and GJAHR fields.

    Hi
    For BSEG you cannot inner join. Its a cluster table and u dont have option to inner join. Instead take neccessary record in BSEG with valid condition.

  • How To UPLOAD a DATA (.DAT) fiel from PC to internal table and then split it into the data different columns

    Hi all,
    I am new to ABAP Development. I need to upload a .DAT file (the file doesn#t have any proper structure-- Please find the .DAT file in the attachment). After uploading the DATA (.DAT) fiel I need to split in into different columns. Refering the attached .DAT fiel the fields in bracets like:
    [Arbeitstag],  [Pecunia], [Mita], [Kunde], [Auftrag] and  [Position] are different fields that need to be arranged in columns in an internal table. this .DAT fiel which I want to upload and then SPLIT it into various fields will will treated as MASTER DATA table for further programming. The program that I had written is as below. Also please refer the attached .DAT table.
    Please if any one could help me. i searched a lot in different forums but couldn't find me  a solution. Also note that the attached fiel is in text (.txt) format here but in real situation the same fiel is in DATA (.DAT) format.
    *& Report  ZDEMO_ZEITERFASSUNG9
    REPORT  ZDEMO_ZEITERFASSUNG9.
    Types: Begin of ttab,
            Rec(1000) type c,
           End of ttab.
    DATA: itab  type table of ttab.
    DATA: wa_tab type ttab.
    DATA: file_str type string.
    Parameters: p_file type localfile.
    At selection-screen on value-request for p_file.
                                           CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
                                            EXPORTING
    *                                          PROGRAM_NAME        = SYST-REPID
    *                                          DYNPRO_NUMBER       = SYST-DYNNR
    *                                          FIELD_NAME          = ' '
                                               STATIC              = 'X'
    *                                          MASK                = ' '
                                             CHANGING
                                               file_name           = p_file.
    *                                        EXCEPTIONS
    *                                          MASK_TOO_LONG       = 1
    *                                          OTHERS              = 2
    Start-of-Selection.
      file_str = P_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                      = '\\10.10.1.92\Volume_1\_projekte\Zeiterfassung-SAP\BUP_ZEIT.DAT'   " This the file  source address
          FILETYPE                      = 'DAT'
          HAS_FIELD_SEPARATOR           = ';'
    *     HEADER_LENGTH                 = 0
    *     READ_BY_LINE                  = 'X'
    *     DAT_MODE                      = ' '
    *     CODEPAGE                      = ' '
    *     IGNORE_CERR                   = ABAP_TRUE
    *     REPLACEMENT                   = '#'
    *     CHECK_BOM                     = ' '
    *     VIRUS_SCAN_PROFILE            =
    *     NO_AUTH_CHECK                 = ' '
    *   IMPORTING
    *     FILELENGTH                    =
    *     HEADER                        =
        tables
          data_tab                      = itab
       EXCEPTIONS
         FILE_OPEN_ERROR               = 1
         FILE_READ_ERROR               = 2
         NO_BATCH                      = 3
         GUI_REFUSE_FILETRANSFER       = 4
         INVALID_TYPE                  = 5
         NO_AUTHORITY                  = 6
         UNKNOWN_ERROR                 = 7
         BAD_DATA_FORMAT               = 8
         HEADER_NOT_ALLOWED            = 9
         SEPARATOR_NOT_ALLOWED         = 10
         HEADER_TOO_LONG               = 11
         UNKNOWN_DP_ERROR              = 12
         ACCESS_DENIED                 = 13
         DP_OUT_OF_MEMORY              = 14
         DISK_FULL                     = 15
         DP_TIMEOUT                    = 16
         OTHERS                        = 17
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      LOOP at itab into wa_tab.
            WRITE: / wa_tab.
      ENDLOOP.
    I will be grateful to all you experts for ur inputs
    regards
    Chandan Singh

    For every Auftrag, there are multiple Position entries.
    Rest of the blocks don't seems to have any relation.
    So you can check this code to see how internal table lt_str is built whose first 3 fields have data contained in Auftrag, and next 3 fields have Position data. The structure is flat, assuming that every Position record is related to preceding Auftrag.
    Try out this snippet.
    DATA lt_data TYPE TABLE OF string.
    DATA lv_data TYPE string.
    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename = 'C:\temp\test.txt'
      CHANGING
        data_tab = lt_data
      EXCEPTIONS
        OTHERS   = 19.
    CHECK sy-subrc EQ 0.
    TYPES:
    BEGIN OF ty_str,
      a1 TYPE string,
      a2 TYPE string,
      a3 TYPE string,
      p1 TYPE string,
      p2 TYPE string,
      p3 TYPE string,
    END OF ty_str.
    DATA: lt_str TYPE TABLE OF ty_str,
          ls_str TYPE ty_str,
          lv_block TYPE string,
          lv_flag TYPE boolean.
    LOOP AT lt_data INTO lv_data.
      CASE lv_data.
        WHEN '[Version]' OR '[StdSatz]' OR '[Arbeitstag]' OR '[Pecunia]'
             OR '[Mita]' OR '[Kunde]' OR '[Auftrag]' OR '[Position]'.
          lv_block = lv_data.
          lv_flag = abap_false.
        WHEN OTHERS.
          lv_flag = abap_true.
      ENDCASE.
      CHECK lv_flag EQ abap_true.
      CASE lv_block.
        WHEN '[Auftrag]'.
          SPLIT lv_data AT ';' INTO ls_str-a1 ls_str-a2 ls_str-a3.
        WHEN '[Position]'.
          SPLIT lv_data AT ';' INTO ls_str-p1 ls_str-p2 ls_str-p3.
          APPEND ls_str TO lt_str.
      ENDCASE.
    ENDLOOP.

  • Performance issue in BI due to direct query on BKPF and BSEG tables

    Hi,
    We had a requirement that FI document number fieldshould be extracted in BI.
    Following code was written which has the correct logic but performance is bad.
    It fetched just 100 records in more than 4-5 hrs.
    The reason is there was a direct qury written on BSEG and BKPF tables(without WHERE clause).
    Is there any way to improve this code like adding GJAHR field  in where clause? I dont want to change the logic.
    Following is the code:
    WHEN '0CO_OM_CCA_9'." Data Source
        TYPES:BEGIN OF ty_bkpf,
        belnr TYPE bkpf-belnr,
        xblnr TYPE bkpf-xblnr,
        bktxt TYPE bkpf-bktxt,
        awkey TYPE bkpf-awkey,
        bukrs TYPE bkpf-bukrs,
        gjahr TYPE bkpf-gjahr,
        AWTYP TYPE bkpf-AWTYP,
        END OF ty_bkpf.
        TYPES : BEGIN OF ty_bseg1,
        lifnr TYPE bseg-lifnr,
        belnr TYPE bseg-belnr,
        bukrs TYPE bseg-bukrs,
        gjahr TYPE bseg-gjahr,
        END OF ty_bseg1.
        DATA: it_bkpf TYPE STANDARD TABLE OF ty_bkpf,
        wa_bkpf TYPE ty_bkpf,
        it_bseg1 TYPE STANDARD TABLE OF ty_bseg1,
        wa_bseg1 TYPE ty_bseg1,
        l_s_icctrcsta1 TYPE icctrcsta1.
        "Extract structure for Datasoure 0co_om_cca_9.
        DATA: l_awkey TYPE bkpf-awkey.
        DATA: l_gjahr1 TYPE gjahr.
        DATA: len TYPE i,
        l_cnt TYPE i.
        l_cnt = 10.
        tables : covp.
        data : ref_no(20).
        SELECT lifnr
        belnr
        bukrs
        gjahr
        FROM bseg
        INTO TABLE it_bseg1.
        DELETE ADJACENT DUPLICATES FROM it_bseg1 COMPARING belnr gjahr .
        SELECT belnr
        xblnr
        bktxt
        awkey
        bukrs
        gjahr
        AWTYP
        FROM bkpf
        INTO TABLE it_bkpf.
        IF sy-subrc EQ 0.
          CLEAR: l_s_icctrcsta1,
          wa_bkpf,
          l_awkey,
          wa_bseg1.
          LOOP AT c_t_data INTO l_s_icctrcsta1.
            MOVE l_s_icctrcsta1-fiscper(4) TO l_gjahr1.
          select single AWORG AWTYP INTO CORRESPONDING FIELDS OF COVP FROM COVP
          WHERE belnr = l_s_icctrcsta1-belnr.
          if sy-subrc = 0.
              if COVP-AWORG is initial.
           concatenate l_s_icctrcsta1-refbn '%' into ref_no.
                  READ TABLE it_bkpf INTO wa_bkpf WITH KEY awkey(10) =
                  l_s_icctrcsta1-refbn
                  awtyp = COVP-AWTYP
                  gjahr = l_gjahr1.
            IF sy-subrc EQ 0.
              MOVE wa_bkpf-belnr TO l_s_icctrcsta1-zzbelnr.
              MOVE wa_bkpf-xblnr TO l_s_icctrcsta1-zzxblnr.
              MOVE wa_bkpf-bktxt TO l_s_icctrcsta1-zzbktxt.
              MODIFY c_t_data FROM l_s_icctrcsta1.
              READ TABLE it_bseg1 INTO wa_bseg1
              WITH KEY
              belnr = wa_bkpf-belnr
              bukrs = wa_bkpf-bukrs
              gjahr = wa_bkpf-gjahr.
              IF sy-subrc EQ 0.
                MOVE wa_bseg1-lifnr TO l_s_icctrcsta1-lifnr.
                MODIFY c_t_data FROM l_s_icctrcsta1.
                CLEAR: l_s_icctrcsta1,
                wa_bseg1,
                l_gjahr1.
              ENDIF.
            ENDIF.
                ELSE. " IF AWORG IS NOT BLANK -
                concatenate l_s_icctrcsta1-refbn COVP-AWORG into ref_no.
                READ TABLE it_bkpf INTO wa_bkpf WITH KEY awkey(20) =
                ref_no
                awtyp = COVP-AWTYP
                gjahr = l_gjahr1.
            IF sy-subrc EQ 0.
              MOVE wa_bkpf-belnr TO l_s_icctrcsta1-zzbelnr.
              MOVE wa_bkpf-xblnr TO l_s_icctrcsta1-zzxblnr.
              MOVE wa_bkpf-bktxt TO l_s_icctrcsta1-zzbktxt.
              MODIFY c_t_data FROM l_s_icctrcsta1.
              READ TABLE it_bseg1 INTO wa_bseg1
              WITH KEY
              belnr = wa_bkpf-belnr
              bukrs = wa_bkpf-bukrs
              gjahr = wa_bkpf-gjahr.
              IF sy-subrc EQ 0.
                MOVE wa_bseg1-lifnr TO l_s_icctrcsta1-lifnr.
                MODIFY c_t_data FROM l_s_icctrcsta1.
                CLEAR: l_s_icctrcsta1,
                wa_bseg1,
                l_gjahr1.
              ENDIF.
            ENDIF.
               endif.
          endif.
            CLEAR: l_s_icctrcsta1.
            CLEAR: COVP, REF_NO.
          ENDLOOP.
        ENDIF.

    Hello Amruta,
    I was just looking at your coding:
    LOOP AT c_t_data INTO l_s_icctrcsta1.
    MOVE l_s_icctrcsta1-fiscper(4) TO l_gjahr1.
    select single AWORG AWTYP INTO CORRESPONDING FIELDS OF COVP FROM COVP
    WHERE belnr = l_s_icctrcsta1-belnr.
    if sy-subrc = 0.
    if COVP-AWORG is initial.
    concatenate l_s_icctrcsta1-refbn '%' into ref_no.
    READ TABLE it_bkpf INTO wa_bkpf WITH KEY awkey(10) =
    l_s_icctrcsta1-refbn
    awtyp = COVP-AWTYP
    gjahr = l_gjahr1.
    Here you are interested in those BKPF records that are related to the contents of c_t_data internal table.
    I guess that this table does not contain millions of entries. Am I right?
    If yes, the the first step would be to pre-select COVP entries:
    select BELNR AWORG AWTYP into lt_covp from COVP
    for all entries in c_t_data
    where belnr = c_t_data-belnr.
    sort lt_covp by belnr.
    Once having this data ready, you build an internal table for BKPF selection:
    LOOP AT c_t_data INTO l_s_icctrcsta1.
      clear ls_bkpf_sel.
      ls_bkpf_sel-awkey(10) = l_s_icctrcsta1-refbn.
      read table lt_covp with key belnr = l_s_icctrcsta1-belnr binary search.
      if sy-subrc = 0.
        ls_bkpf_sel-awtyp = lt_covp-awtyp.
      endif.
      ls_bkpf_sel-gjahr = l_s_icctrcsta1-fiscper(4).
      insert ls_bkpf_sel into table lt_bkpf_sel.
    ENDLOOP.
    Now you have all necessary info to read BKPF:
    SELECT
    belnr
    xblnr
    bktxt
    awkey
    bukrs
    gjahr
    AWTYP
    FROM bkpf
    INTO TABLE it_bkpf
    for all entries in lt_bkpf_sel
    WHERE
      awkey = lt_bkpf_sel-awkey and
      awtyp = lt_bkpf_sel-awtype and
      gjahr = lt_bkpf_sel-gjahr.
    Then you can access BSEG with the bukrs, belnr and gjahr from the selected BKPF entries. This will be fast.
    Moreover I would even try to make a join on DB level. But first try this solution.
    Regards,
      Yuri

Maybe you are looking for

  • Updates suddenly stopped working?

    I obtained my Photoshop from a school a couple or few years back. I believe they claimed the serial would work forever. But the updates just stopped working. They all download fine in the Adobe Application Updates Manager but when it goes to install,

  • FCP won't recognize my DV device

    I recently upgraded to FCP 5.1.1 and can't get it to recognize my DV. At first FCP would open without the "unable to locate external device" warning and not even show a DV device as an option. Now it shows the warning and just won't acknowledge my ca

  • Cannot view photos in iPhoto 09

    I have iLife 09 and am new to the Mac world. I am wondering why iPhoto will not allow me to see pictures I was once able to. I used some of my photos in iMovie and iDVD, and they worked just fine. I went back in to view the pictures and edit them for

  • Can I use an iPad 2 3G bought in the USA with a different phone carrier in my home country?

    I intend to buy an iPad 2 3G  in the USA and bring it back to my home country (Chile) but I'm not sure if the broadband connection will work here with a phone carrier different from AT&T or Verizon. If somebody knows the answer please let me know as

  • HT1222 What is a pass code,for this next up date.never been asked that before

    What's the pass code for this next update.never been asked that in the past