Bseg Table Issue

Hi,
Below is my code, it taking much time to get the data from BSEG table and even after executing for long time it not populating the data into internal table. If i pass single account in selection screen, it is displaying the data.
Please help me out.
  SELECT hkont lkorr FROM t030hb INTO CORRESPONDING FIELDS OF
                      TABLE gt_tr_t030hb
                      WHERE ktopl = 'ZCOA'
                      AND   bwber = 'TR'
                      and hkont in so_hkont.
  IF gp_pprct IS INITIAL.
  loop at gt_tr_t030hb.
    SELECT hkont prctr bewar dmbe2 FROM bseg INTO CORRESPONDING
                       FIELDS OF table gt_hkont for all entries
                       in gt_tr_t030hb
                       WHERE bukrs IN so_bukrs
                       AND prctr IN so_prctr
                       AND saknr = gt_tr_t030hb-hkont
                       AND vbund IN so_vbund
                       and gjahr in so_gjahr
                       and xauto = 'X'.
Thanks,
Pavan.
Message was edited by: Pavan Panduru

Hi
Try to select the items from BSIS/BSAS:
- One solution can be:
TABLES: BSIS.
DATA:  GT_TR_T030HB LIKE STANDARD TABLE OF  T030HB.
SELECT-OPTIONS: SO_BUKRS FOR BSIS-BUKRS,
                SO_HKONT FOR BSIS-HKONT,
                SO_GJAHR FOR BSIS-GJAHR,
                SO_PRCTR FOR BSIS-PRCTR,
                SO_VBUND FOR BSIS-VBUND.
DATA: BEGIN OF GT_HKONT OCCURS 0,
        BUKRS LIKE BSIS-BUKRS,
        HKONT LIKE BSIS-HKONT,
        GJAHR LIKE BSIS-GJAHR,
        BELNR LIKE BSIS-BELNR,
        BUZEI LIKE BSIS-BUZEI,
        PRCTR LIKE BSIS-PRCTR,
        BEWAR LIKE BSIS-BEWAR,
        DMBE2 LIKE BSIS-DMBE2,
      END OF GT_HKONT.
DATA: XAUTO.
SELECT * FROM T030HB INTO TABLE GT_TR_T030HB
                    WHERE HKONT IN SO_HKONT
Open Items (BSIS)
SELECT BUKRS HKONT GJAHR BELNR BUZEI
       PRCTR BEWAR DMBE2
       FROM BSIS INTO TABLE GT_HKONT
        FOR ALL ENTRIES IN GT_TR_T030HB
                      WHERE BUKRS IN SO_BUKRS
                        AND HKONT = GT_TR_T030HB-HKONT
                        AND GJAHR IN SO_GJAHR
                        AND PRCTR IN SO_PRCTR
                        AND VBUND IN SO_VBUND.
Cleared items
SELECT BUKRS HKONT GJAHR BELNR BUZEI
       PRCTR BEWAR DMBE2
       FROM BSAS APPENDING TABLE GT_HKONT
        FOR ALL ENTRIES IN GT_TR_T030HB
                      WHERE BUKRS IN SO_BUKRS
                        AND HKONT = GT_TR_T030HB-HKONT
                        AND GJAHR IN SO_GJAHR
                        AND PRCTR IN SO_PRCTR
                        AND VBUND IN SO_VBUND.
If you need to check if the item is automatically loaded:
LOOP AT GT_HKONT.
  SELECT SINGLE XAUTO FROM BSEG INTO XAUTO
                                WHERE BUKRS = GT_HKONT-BUKRS
                                  AND BELNR = GT_HKONT-BELNR
                                  AND GJAHR = GT_HKONT-GJAHR
                                  AND BUZEI = GT_HKONT-BUZEI.
  IF XAUTO = SPACE.
    DELETE GT_HKONT.
  ENDIF.
ENDLOOP.
Other solution can be
TABLES: BSIS.
DATA:  GT_TR_T030HB LIKE STANDARD TABLE OF  T030HB.
SELECT-OPTIONS: SO_BUKRS FOR BSIS-BUKRS,
                SO_HKONT FOR BSIS-HKONT,
                SO_GJAHR FOR BSIS-GJAHR,
                SO_PRCTR FOR BSIS-PRCTR,
                SO_VBUND FOR BSIS-VBUND.
DATA: BEGIN OF T_DOCUMENT OCCURS 0,
        BUKRS LIKE BSIS-BUKRS,
        GJAHR LIKE BSIS-GJAHR,
        BELNR LIKE BSIS-BELNR,
        BUZEI LIKE BSIS-BUZEI,
      END   OF T_DOCUMENT.
DATA: BEGIN OF GT_HKONT OCCURS 0,
        HKONT LIKE BSIS-HKONT,
        PRCTR LIKE BSIS-PRCTR,
        BEWAR LIKE BSIS-BEWAR,
        DMBE2 LIKE BSIS-DMBE2,
      END OF GT_HKONT.
DATA: XAUTO.
Open Items (BSIS)
SELECT BUKRS GJAHR BELNR BUZEI
       FROM BSIS INTO TABLE T_DOCUMENT
        FOR ALL ENTRIES IN GT_TR_T030HB
                      WHERE BUKRS IN SO_BUKRS
                        AND HKONT = GT_TR_T030HB-HKONT
                        AND GJAHR IN SO_GJAHR
                        AND PRCTR IN SO_PRCTR
                        AND VBUND IN SO_VBUND.
Cleared items
SELECT BUKRS GJAHR BELNR BUZEI
       FROM BSAS INTO TABLE T_DOCUMENT
        FOR ALL ENTRIES IN GT_TR_T030HB
                      WHERE BUKRS IN SO_BUKRS
                        AND HKONT = GT_TR_T030HB-HKONT
                        AND GJAHR IN SO_GJAHR
                        AND PRCTR IN SO_PRCTR
                        AND VBUND IN SO_VBUND.
Auto items
SELECT HKONT PRCTR BEWAR DMBE2
       FROM BSEG INTO TABLE GT_HKONT
        FOR ALL ENTRIES IN T_DOCUMENT
                      WHERE BUKRS = T_DOCUMENT-BUKRS
                        AND BELNR = T_DOCUMENT-BELNR
                        AND GJAHR = T_DOCUMENT-GJAHR
                        AND BUZEI = T_DOCUMENT-BUZEI
                        AND XAUTO = 'X'.
Try
Max

Similar Messages

  • ST05 Trace on a select query on BSEG table

    hi all,
    this is my select query on table BSEG table:
      SELECT bukrs
             belnr
             gjahr
             buzei
             KOART
             mwskz
             kostl
             lifnr
             aufnr
             werks
             ebeln
             txjcd
             projk FROM bseg
                   INTO TABLE i_bseg
                   FOR ALL ENTRIES IN i_ad_tab
                  WHERE bukrs EQ i_ad_tab-bukrs  AND
                        belnr EQ i_ad_tab-belnr  AND
                        gjahr EQ i_ad_tab-gjahr.
    when i m doing SQL trace ST05 on this query and in the detail statement showed the following query
    SELECT
      "MANDT" , "BUKRS" , "BELNR" , "GJAHR" , "PAGENO" , "TIMESTMP" ,
      "PAGELG" , "VARDATA"
    FROM
      "RFBLG"
    WHERE
      "MANDT" = ? AND  "BUKRS" = ? AND  "BELNR" = ? AND  "GJAHR" = ?
    ORDER BY
      "MANDT" , "BUKRS" , "BELNR" , "GJAHR" , "PAGENO"
    what is RFBLG table in SE11, but could not find it.
    what is RFBLG?also, the above select query giving me performance issues.. the "for all entries" clause is used as per norms...
    please suggest a solution..

    hi
    good
    The famous BSEG table is a cluster table.
    It is as was correctly stated part of the Accounting Document Segment. It is part of the Pool cluster RFBLG and lives in the package: FBAS (Financial accounting 'Basis').
    You can't read a cluster table exactly the way you read a database (old speak, transparent table).
    You can use a program to read called RFPPWF05
    Note 435694: Display BSEG item by calling FB09D (modified FB09)
    Other possiblity: Other possibility: CALL DIALOG 'RF_ZEILEN_ANZEIGE', but since this is a dialog I don't think this would work.
    In any event go to FBAS Package (development class) to see your business objects, class library and functions.
    you must use keyfields bukrs , belnr, gjahr
    (so 1st select table bkpf) to select bseg.
    or use secondary index tables:
    bsas, bsis, bsik, bsak, bsid, bsad
    Regards,
    Raj.

  • How to improve performance by pulling data instead of BSEG table?

    Hi,
    We are facing issue in which we have to pull material no for some non copa postings.
    But if we use BSEG table then serious performance issues are coming up..
    so are there any other tables / combination of tables that we can look for instead of BSEG?

    Hi,
    BSEG is Cluster table, you can only select with key fields.
    if you have a select:
    select belnr budat wrbtr from bseg
              into table it_bseg
               where bukrs = bukrs
                   and belnr = belnr
                   and gjahr = gjahr
                   and bschl = 31.
    it's much better to select of this way:
    select belnr budat wrbtr from bseg
              into table it_bseg
               where bukrs = bukrs
                   and belnr = belnr
                   and gjahr = gjahr.
    delete it_bseg where bschl ne '31'.
    Regards,
    Fernando

  • Performance Problem in using the BSEG table - Required alternative

    Hi All,
    Pl go thru the below program.
    I am unable to change this code
    It is having 46 performance errors
    Pls check the code and suggest.
    *To get Pmt Doc No & Posting Date
      SELECT SINGLE
             BELNR
             ZFBDT
             FROM BSEG
             INTO (WA_ZFT011_FIFO-PAY_DOC_NO, WA_ZFT011_FIFO-POST_DATE)
             WHERE AUGBL = W_CLR_DOC
               AND AUGDT = WA_ZFT011_FIFO-CLR_DATE
               AND BSCHL = '15'.
      IF SY-SUBRC <> 0.
        SELECT SINGLE
               BELNR
               ZFBDT
               FROM BSEG
               INTO (WA_ZFT011_FIFO-PAY_DOC_NO, WA_ZFT011_FIFO-POST_DATE)
               WHERE AUGBL = W_CLR_DOC
                 AND AUGDT = WA_ZFT011_FIFO-CLR_DATE
                 AND BSCHL = '11'.
    The above code is having performance error "NO field of a table Index in WHERE"
    The same error repeated for 45 select statements and for all statements the "BSEG" table is used for selecting data.
    But creating a secondary index on BSEG table columns will not be possible
    So pls suggest me accordingly
    Awaits for the Reply.
    P Kamal

    Hi,
    Perhaps my post here: Re: BSEG table performance issues might help you.
    Regards, Gerd Rother

  • Repalcement of  Bseg table

    HI,
    I am using Bseg table in one of my report, but it takes too much time to execute. SO am looking for any alternative table for BSEG table. Can Any one Please Help to sort out this problem.
    Thanks
    Imran

    BSEG always gives performance issue if you do not have indexed key fields in where condition.
    1. do not try to pass every available field in where condition, only use indexed fields in where condition. you may select more data in internal table & then filter fron internal table.
    2. if do not have index fields , them write select statements on other secondary indexed tables like
    BSAD,BSAK,BSAS,BSID,BSIK,BSIS  get all required fields & then write select on BSEG.
    If you have proper where condition then select on BSEG is quite fast.

  • Function module for BSEG table

    Hi Guru's,
      SELECT bukrs
             belnr
             gjahr
             budat
             monat
             waers
             awkey
        FROM bkpf
        INTO TABLE i_bkpf_data
        WHERE  bukrs EQ pa_bukrs AND
               budat IN so_budat.
    SORT i_bkpf_data BY bukrs belnr gjahr.
        IF i_bkpf_data[] IS NOT INITIAL.
          SELECT bukrs belnr gjahr koart dmbtr wrbtr pswsl
                 kokrs kostl hkont aufnr lifnr ebeln buzei shkzg
            FROM bseg
            INTO TABLE i_bseg_data
            FOR ALL ENTRIES IN i_bkpf_data
            WHERE 
                    bukrs  EQ pa_bukrs AND
                   belnr    EQ i_bkpf_data-belnr AND
                   gjahr    EQ i_bkpf_data-gjahr AND
                   kostl    IN so_kostl AND
                   lifnr      IN so_lifnr AND
                   hkont   IN so_hkont.
       ENDIF.
    I got performance issue on this Query..while accessing the data from BSEG table,its makes performance issue in my program so i want to improve performance of the program.i was analysed that BSEG table makes performance issue..
    Hi..Anybody give the solution imporving this Query or give some function module for accessing BSEG table..
    Note..I want to pass my selection inputs also into function module..i was seen some function module for BSEG,those are not satisfying the my inputs so those also making performance issue..
    Regards
    P.Senthil Kumar

    Hi Everybody,
    About how to use this function Does anyone have an idea?
    I've found it.
    call function 'FI_DOCUMENT_READ'
    exporting
       i_awtyp = 'VBRK'
       i_awref = vbfa_tab-vbeln
       i_awsys = vbrk-logsys
       i_bukrs = vbrk-bukrs
       i_gjahr = vbrk-gjahr
    tables
       t_bkpf = xbkpf
       t_bseg = xbseg
    exceptions
    wrong_input = 1
    not_found = 2.
    But this is not enough.
    Best Regards Rasim.

  • F110 - Grouping the vendor invoices by BSEG table fields

    Hi,
    I want to group the vendor invoices while making the payment through F110,  based on a BSEG table field. The settings in Grouping Key configuration (OBAP) only allows me to choose the fileds from BSIK table and not possible to select the fields from BSEG table.  Is there any other way to group the vendor invoices based on BSEG fileds?  How can we achieve this requirement in SAP?
    Thanks and Regards
    Koteswararao padarti

    Hi,
    I created the substitution and also grouping key based on the BSIK-KIDNO filed. But the system is not able to group the vendor invoices by payment reference.  I already tried the following options
    Seperate Payments for each Ref in FBZP settings
    Can anyone let me know what is missing in the configuration to group the invoices for payment by payment reference.
    Regards
    Koteswararao Padarti

  • XREF3 field not getting populated in BSEG table while posting MIRO

    Hi,
         I have one query in MIRO tcode.I have activated xref3 field in MIRO tcode using enhancement LMR1MF6Q.Now when i try to post document with some values in xref3 field on screen ,value is not getting populated in BSEG table.Please tell me what else needs to be done to achieve this ?
    any hint on this?
    Thanks & Regards,
    Soniya S.

    Hi,
    1.- According to SAP Note 904652 - MIRO: Different from FB60
    https://service.sap.com/sap/support/notes/904652
    MIRO is an independent Materials Management (MM) transaction that does not
    claim to be the same as the accounting transactions (such as FB60 or FB01).
    MIRO was developed to allow users to process vendor invoices within the
    context of the MM procurement processes as simply as possible.
    For this reason, among other differences, the field selection was limited
    to the absolutely necessary. For example, the following fields from the
    accounting document are not available in Transaction MIRO (this list is not
    complete):
    Reference key (BSEG-XREF1, -XREF 2, -XREF 3)
    2.- SAP Note 1156325 - BAdIs in the Logistics Invoice Verification environment
    https://service.sap.com/sap/support/notes/1156325
    Have a look at badi MRM_ITEM_CUSTFIELDS.
    This badi will create a new tab at item level in order to display the new fields.
    I haven´t used this badi so i cannot talk from experience here.
    Think twice before deciding.
    Best regards.

  • Error while activating the BSEG table

    hi guys ,
                today i joined SAP SCN . I have this error
    First i appended a structure of 5 fields in BSEG table .Then i tried to delete this append structure.
    But while deletiing it took nearly 20-25 minutes to process and timed out.So the structure is deleted
    from BSEG table but those 5 fields are still present in view V_QCMBSEG .Because of this BSEG table
    is now partially active .what should i do other than access key .

    Dear Deepak,
    welcome to SCN.
    How did you append structure in BSEG without access key, if you had appended you must have done it will access key as it is a standard table.
    secondly, the time out error is because BSEG is a cluster table, and the data volume in Bseg is very large as all the accounting document from various module is stored in this table, hence while deleting it system will check each line item wise before activating the table.
    Now the workaround is to check with your basis team to increase the memory index so that time out dump is eradicted and BSG becomes Active.
    Best practice: Don't append structure to standard table unless it is very crucial. if you are doing it for some report, kindly do a table join ( BSEG cannot be used as it is a cluster), you will get the same data in various secondary index table, by doing this the performance of the report will be better.
    Regards,
    M S Lokesh

  • Error while appending structure into BSEG Table

    We had appended BSEG table with a ZSTRUCTURE to enable Custom field in MIRO. Subsequently there was a change required in the appended field. After Changing the field there was adjustment required to activate the appended table . However due to slow system performance during that time the Adjustment SE14 timed out. And created inconsistency in BSEG table.
    If I Do the Table adjustment now it is showing below error.
    We tried to delete the append structure also but the structure is not appearing in the append structure list to delete.
    Even if we try deleting the Z structure from se11 it is throwing below error.
    Any one could help me out to resolve this..

    hi Ramesh,
    Please First Check if the Database version and disctionary version are in sync.
    Also, it could be the case that you would have enhanced an already existing Append stucture. which might be being used in other BKPF dependent tables.
    Please check

  • PO Line Item Number not filled in BSEG Table

    HI,
    While posting to goods receipt through MIGO FI documents are generated.
    For these  FI documents ,  in BSEG table the corresponding  PO line item numbers (EBELP )are not getting filled up,
    How can they be filled. can it be done through any standard configuration?

    Hi,
    Check if you are doing the summarization of FI doc. You can check reading these notes:
    SAP Note 36353 - AC interface: Summarizing FI documents
    SAP Note 77161 - Summarization of FI postings w.ref.to purchase orders
    I hope this helps you
    Regards
    Eduardo

  • 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

  • Data fetching from BSEG table

    Hi,
    I have used smartforms for generating suppler payment statement for financial department. more time duration is taken by the program when it is generating.
    I think this problem comes while data fetching from BSEG table. because, it has more records for one vendor ID.
    I want reduce this time duration.
    Please guide me.

    Have you tried this selection in se16? I'm quite sure that It will take
    a long time.
    The problem has been explained in this group before and I think you
    should search for bseg in the answers given.
    As a hint: It has to do with the selection universe. You are restricting
    only bukrs from the primary key (all the other restrictions in your
    where clause are filters that are applied on SAP's side (not on the
    database side)). The problem is that bseg isn't stored as separated
    fields in the RDBMS, but as a table with the primary key and a stream of
    bits in a raw field.
    You should review and change the logic you're using before reading bseg.
    It's the only way you'll improve the performance of this select. (for
    example, you could use one or more secondary index tables - bi or ba
    to retrieve belnr and access bseg with a better where clause).

  • Update BSEG table for PERNR

    Hi,
    How to update PERNR Field BSEG Table?
    My scenario is to update the (Personnel Number ) PERNR Field in FB50 Transaction.
    I get the following fields details from a third party system
    Document Information 
    o     I_BUKRS (Company Code) u2013 example: 0010
    o     I_BELNR (Document Number) u2013 example: 1700006041
    o     I_GJAHR (Fiscal Year) u2013 example: 2008
    u2022     Final Approver ID
    o     I_PERNR (Personnel No.) u2013 example U0050049
    For all line items of the document (represented by the key  (I_BUKRS, I_BELNR, I_GJAHR)) need to update the BSEG-PERNR field in FB50.
    Please let me know if you have any ideas like BAPI's or any alternative.
    Thanks & Regards,
    Satya

    Hi
    Try to use below the FM's
    FMUDBSEGH_UPDATE
    FMUDBSEG_UPDATE
    G_BKPF_BSEG_UPDATE
    before to that you need to read data from FM READ_BSEG. then update.
    hope it helps you
    Thanks!
    Edited by: Prasanth Maddela on Apr 21, 2009 6:26 PM

  • Down load from BSEG Table

    Hi
    Friends
    we have around 50 millions records in the Bseg table.
    i need to down load only 5 fields .
    one our friend suggested using ABAP code we can down load.
    But i would like to know from you is there any Transcation code to down load only 4 or 5 fields from bseg fro all the company codes since we have around 50 million Records inthe table.
    Thanks in advance.

    Hi Ravindra,
    Good afternoon and greetings,
    In SE16 itself you can down only the selected field by choosing the User Parameters...Alternatively, you can create a query using SQVI and select only those fields for displaying and downloading.
    If you require any assistance on SQVI, please let me know.
    Points awarded is highly appreciated, if the above mentioned solution meets your requirement.
    Thanking you
    With kindest regards
    Ramesh Padmanabhan
    Consultant

Maybe you are looking for

  • In imovie, how do I fit a photo inside the screen? Every time I try to zoom out it bounces back in!

    According to the help page, I remove the kens burn effect by matching the start and end frames. The problem is the photo remains zoomed in! And whenever I try to zoom out it just revert right back to where it was zoomed in. I've tried looking for set

  • Computer to TV Hookup Vs. Apple TV : Quality

    I was thinking of purchasing an Apple TV soon but I have a few concerns about spending $300 plus cables. If I hook my computer up to my TV will it be the same or better quality that Apple TV offers? Thanks

  • CUIC Report - Queue Status

    Dear Group I am recently been started working with UCCE platform, for one of our client who is using CTI Desktop Client (V8.5) required to have A field in the CTI screen about the number of calls currently queued or waiting in the queue A CUIC report

  • Collect statment in ABAP

    how to use collect statement. Moderator Message: F1 Edited by: kishan P on Apr 8, 2011 3:49 PM

  • How do I duplicate an audio cd using Disk Utility?

    I follow the instructions and after it creates the image it says to put in the new cd. Then it says there is not enough room on the new cd and won't let me continue. But it is a new blank cd. Any ideas? Thanks