Select BSEG

Hi,
I have a performance issue when selecting data from BSEG. I've already read some threads about it, and recommend to use other tables like BSID and BSAD, but I can't get all the fields that I need from those tables. The select is:
SELECT bukrs belnr gjahr gsber dmbtr hkont werks ebeln ebelp projk
  FROM bseg
  INTO TABLE it_bseg
   FOR ALL ENTRIES IN it_data
WHERE bukrs EQ it_data-bukrs
   AND belnr EQ it_data-belnr
   AND gjahr EQ it_data-gjahr.
What other tables do I need to use to get all those fields and use the same condition? What are the links from those tables?
Regards,
Isaac Meléndez

Before trying any other table try making this small adjustment to your code.
DATA it_data_tmp LIKE TABLE OF it_data.
IF NOT it_data[] IS INITIAL.
  it_data_tmp[] = it_data[].
  SORT it_data_tmp BY bukrs belnr gjahr.
  DELETE ADJACENT DUPLICATES FROM it_data_tmp
    COMPARING
      bukrs
      belnr
      gjahr.
  SELECT bukrs
         belnr
         gjahr
         gsber
         dmbtr
         hkont
         werks
         ebeln
         ebelp
         projk
    FROM bseg
    INTO TABLE it_bseg
    FOR ALL ENTRIES IN it_data_tmp
    WHERE bukrs EQ it_data_tmp-bukrs
    AND   belnr EQ it_data_tmp-belnr
    AND   gjahr EQ it_data_tmp-gjahr.
ENDIF.

Similar Messages

  • F110 free selections bseg-werks

    I am trying to include the bseg-werks field (Center) as a parameter for the free selections in the automatic payment run setting (f110) but the listings of options include many bseg fields but werks. I would sure appreciate your help in this matter.

    WERKS is the field for Plant.  When you select the Free Selection tab, you have the option of selecting Document, Vendor Master or Customer Master.  Both the Vendor Master and the Customer Master have the WERKS field available.  Unfortunately, the plant field is not available at the line items level.  You may have to be a bit more creative and find another way to go after it if you need it at the line item.
    I hope this helps!

  • 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.

  • Selecting document list by gsber

    I want to display document list from BKPF..but there is not GSBER field..it exists in BSEG table.but the table is not indexed table.when i use it,performance will be horrible.
    How can i select data according to GSBER?
    Best regards..

    not possible to create secondary index on BSEG (cluster table).
    Anything else you could narrow down the selection with?
    posting date, CPU date, document type? -> use the indexes on BKPF then select BSEG with "for all entries"
    account number? -> use the index tables BSIS, BSAS etc.
    Company code should always be part of the selection.
    Last exit would be to create a secondary index on BUKRS and GSBER on the aforementioned index tables.
    Thomas

  • By passing Cluster Table BSEG ?

    What is the science of using Cluster tables? I mean why are cluster tables used for ? + HOW CAN I BY PASS CLUSTER TABLER to get the data quickly ??

    Hi,
    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
    Cluster Table : Cluster tables are logical tables that must be assigned to a table cluster when they are defined. Cluster tables can be used to strore control data. They can also be used to store temporary data or texts, such as documentation.
    A clustered and a pooled table cannot be read from outside SAP because certain data are clustered and pooled in one field.
    One of the possible reasons is for instance that their content can be variable in length and build up. Database manipulations in Abap are limited as well.
    But pool and cluster table is a many to one relationship table. This means many pool table store in a database table which is know as table pool.
    All the pool table stored table in table pool does not need to have any foreign key relationship but in the case of cluster table it is must. And pool and cluster table is basically use to store application data.
    For pool and cluster table you can create secondary index and you can use select distinct, group for pool and cluster table. You can use native SQL statement for pool and cluster table.
    Regards,
    Raj.

  • BSEG-BELNR based on VBRK-VBELN

    Dear All,
    Happpy Diwali.
    I want BSEG-BELNR based on Invoice no(VBRK-VBELN).
    Please tale me another way to get same data as per below code.
    DATA : V_BELNR TYPE BKPF-BELNR.
        LOOP AT IT_DATA .
          SELECT SINGLE  BELNR
            INTO V_BELNR
             FROM BSEG
            WHERE VBELN = IT_DATA-INVNO
            AND SHKZG = 'S'.
            if sy-subrc = 0.
            iT_DATA-BELNR = V_BELNR .
           MODIFY IT_DATA TRANSPORTING BELNR.
          endif.
      CLEAR V_BELNR.
        ENDLOOP.
    Kindly advice another select query for above query.
    Regards,
    Parshuram.

    Hi Parshuram,
    Please Select the BKPF-BELNR  where BKPF-AWKEY = VBRK-VBELN And BKPF-AWTYP = 'VBRK' .
    Select BSEG-BELNR from BSEG WHERE   BUKRS = BKPF-BUKRS
                                                                        BELNR = BKPF-BELNR
                                                                        GJAHR = BKPF-GJAHR.
    This Solution will work fast and efficiently.
    Regards ,
    Maruthi

  • Purchase order to payment

    my client requirement is status of the po till payment i want to generate a sap query any body pls guide me purchase order ->down payment ->goods reciept-> invoice verification -> vendor payment
    i want to generate this report vendor wise as well as the material and po
    pls give me indetails tables and fields
    advance thanks for kind reply

    hi,
    Seelct EKBE u2013 EBELN, LIFNR
    Where EKEB- BUKRS Eq (Company Code entered in the selection screen)
               EKBE u2013 BEDAT Eq (Purchasing Document Date entered in the selection screen)
    Select all EKBE u2013 EBELN  in to EKBE 
    Invoice and GRN Document Number: - 
             Select EKEB-BELNR, BUDAT, DMBTR, WRBTR, WAERS
                         Where  EKBE u2013 EBELN   Eq  EBELN Entered in the selection screen
                                     EKBE u2013 GJAHR Eq  GJAHR Entered in the selection screen
                                     EKBE u2013 BUDAT  Eq  BUDAT Entered in the selection screen
                           EKBE u2013 VGABE  Eq  1 (Goods Receipt) (in case of Invoice GRN)
                                     EKBE u2013 VGABE  Eq  2 (Invoice Receipt) (in case of Invoice MIRO)
             Eenter all EKBE u2013 BELNR into BKPF and select BKPF- BELENR, WAERS
                                    BKPF - BUKRS Eq  BUKRS Entered in the selection screen
                                    BKPF u2013 GJAHR Eq  EKBE - GJAHR
                                    BKPF u2013 BUDAT  Eq EKBE - BUDAT 
                                    BKPF u2013 AWKEY Eq  EKBE u2013 BELNR + GJAHR
             Eenter all BKPF u2013 BELNR into BSEG and select BSEG u2013 BELENR, DMBTR
                                   BSEG - BUKRS   Eq  BKPF - BUKRS 
                                   BSEG u2013 GJAHR  Eq  BKPF - GJAHR
                                   BSEG u2013 BUDAT  Eq  EKBE - BUDAT 
                                   BSEG- BELNR    Eq  BKPF u2013 BELNR
    For Payment Document  Select  BSEG u2013 AUGBL
                                     Where BSEG- BELNR    Eq  BKPF u2013 BELNR
                                                BSEG - BUKRS   Eq  BKPF - BUKRS 
                                                BSEG u2013 GJAHR  Eq  BKPF - GJAHR
                                                BSEG u2013 BUDAT  Eq  EKBE - BUDAT 
    Eenter all BSEG u2013 AUGBL into BSEG and select BSEG u2013 BELENR, DMBTR ,
    Where BSEG u2013 BELNR Eq BSEG - BSEG u2013 AUGBL
    For Advance Payment Document  Select  BKPF u2013 BELNR, WAERS and KURSF
                         Where BKPF - BUKRS Eq  BUKRS Entered in the selection screen
                                    BKPF u2013 GJAHR Eq  EKBE - GJAHR
                                    BKPF u2013 BUDAT Eq EKBE - BUDAT 
                                    BKPF u2013 TCODE Eq FBA7 and FBA6
    Enter all BKPF u2013 BELNR into BSEG and select BSEG u2013 BELENR, DMBTR ,
                                     Where BSEG- BELNR    Eq BKPF u2013 BELNR
                                                BSEG - BUKRS   Eq BKPF - BUKRS 
                                                BSEG u2013 GJAHR Eq  BKPF - GJAHR
    Reagrds,
    Rama Mohan

  • SAP QUERY report for vendor line items

    Hi
    I have created a SAP QUERY report for vendor line items with fields vendor no.,vendor name,amount,company code and period.But there is one line item i donot know from wher system is getting it picked with is not in that vedor account,when i compare with fbl1n.I checked the document number too...the same doc number is twice in my query report.One with correct amount and another with wrong one.How do i chk.Where did i go wrong in creating query.I used logical database KDF.
    Please advise.

    i chked...how do we get the amount displayed in query...it just displays amount no debit credit symbol... i have selected BSEG-DMBTR field but no -/+ sign,how is it done in query,please suggest.

  • F110 payment run - Plant wise

    Dear All,
    We have a  scenario where clients is having five plants under one legal entity.
    Client wants F110 payment run  separately for all vendor invoices specific to the plant.
    For all plants , there are separate bank accounts and respective invoice must go to plant specific bank account as this is legal requirement of the country.
    Could you please let me know configuration steps to manage this scenario.
    Also can you let us know, how can we make payment to selected Vendors in F110 ( additional field tab).
    In paramater tab,we have the option to incorporate the selected vendor codes.
    In additional field tab,we have only 3 row with a range of Vendor codes.
    Now i want to make payment to 50 vendors(specific to one plant) the vendor codes are 001,18,58,193,etc......how can we do this  while we run the payment program.
    Do suggest
    Regards

    When you are posting an invoice, some field in the invoice document must have plant information. Based on that you can substitute the House Bank. Lets say for example, You enter the value "Plant1" in the Assignment field of the vendor invoice. and you want to pay Plant1 invoices through house Bank HBK01. Then your should create a substitution rule saying if the value in say assignment field is "Plant1" then substitute House Bank field in the vendor line with value HBK01. If you are using a dedicated vendor number ranges specific to plant, then you can do the house bank substitution based on vendor ID as well, and then you don't have to enter Plant info in the invoice.
    Then all the invoices will have right house bank data. Now to make sure that you are paying to vendor posting specific to a plant in the payment run. You can go to FREE SELECTION tab of payment run(F110) when you enter parameters, and in the drop down under field name double click others option and select the document and enter. and then select and enter the field that you are using to enter plant information. In my example I have used Assignment field to enter plant information. So, I will select BSEG-ZUONR. Then I will go to Values field and enter "Plant1". Then Payment run will pick up only "Plant1" invoices.
    If you already using some rules to enter the house bank in the invoice, then you might not want to use the substitution rule. But find out which field in the vendor invoice has plant infomation, and select that field as i have shown above though FREE SELECTION.
    Thanks
    ROn

  • Time out issues

    I have a program which will retrieve the accounting information, the result as like as T-code F.19, but when i execute the program it will caused time out issue, I have not idea how to solve it. Could you help. Here is the source code which cause time out. Thank!
       select * from bsis
          into corresponding FIELDS OF table it_bsis
          where bukrs in so_bukrs and
                budat in so_budat and
                augdt = '00000000' and
                dmbtr ne 0.
        loop at it_bsis.
          select single * from bseg
             where bukrs = it_bsis-bukrs and
                   belnr = it_bsis-belnr and
                   gjahr = it_bsis-gjahr and
                   buzei = it_bsis-buzei and
                   ebeln in so_ebeln and
                   matnr in so_matnr and
                   hkont in so_hkont.
          if sy-subrc = 0.
              MOVE-CORRESPONDING BSEG TO BSIS_TAB.
              BSIS_TAB-WAERS = it_bsis-WAERS.
              BSIS_TAB-BUDAT = it_bsis-BUDAT.
              BSIS_TAB-BLART = it_bsis-BLART.
              IF it_BSIS-SHKZG = 'H'.
                BSIS_TAB-DMBTR = 0 - BSEG-DMBTR.
                BSIS_TAB-DMBE2 = 0 - BSEG-DMBE2.
                BSIS_TAB-DMBE3 = 0 - BSEG-DMBE3.
                BSIS_TAB-WRBTR = 0 - BSEG-WRBTR.
              ENDIF.
              APPEND BSIS_TAB.
          endif.
        endloop.

    Avoid selecting BSEG within the it_bsis loop. BSIS will have huge data and when you do data selection for BSEG inside this loop things will only worsen.
    My points:
    BSIS:
    1. Avoid 'INTO CORESSPONDING FIELDS OF" during the bsis table fetch. Instead define your target structure with the required fields and select only those fields from the BSIS table.
    2. Make sure that only "Key fields" are used in your filter (where condition) for this BSIS table fetch.
    3. I presume your company code in selection (so_bukrs) is a mandatory field. If not suggest for mandatory option.
    BSEG:
    To avoid selection of BSEG inside the bsis loop do the following.
    1. Sort it_bsis by  bukrs belnr gjahr buzei.
    2. Move the contents of it_bsis into a temporary table of same structure, say it_bsis_tmp.
    3. delete adjacent duplicates from it_bsis_tmp comparing bukrs belnr gjahr buzei.
    4. Now use the below selection:
       select <fields required from bseg>
         from bseg
         into table it_bseg
         for all entries in it_bsis_tmp
    where bukrs = it_bsis_tmp-bukrs and
    belnr = it_bsis_tmp-belnr and
    gjahr = it_bsis_tmp-gjahr and
    buzei = it_bsis_tmp-buzei and
    ebeln in so_ebeln and
    matnr in so_matnr and
    hkont in so_hkont.
    if sy-subrc eq 0.
      sort it_bseg by bukrs belnr gjahr buzei.
    endif.
    5. Modify your loop construct as below:
    loop at it_bsis.
      read table it_bseg into wa_bseg with key bukrs = it_bsis-bukrs
                                                                  belnr = it_bsis-belnr
                                                                  gjahr = it_bsis-gjahr
                                                                  buzei = it_bsis-buzei
                                                                  binary search transporting <required fields>.
    if sy-subrc eq 0.
       move the required fields from wa_bseg to your BSIS_TAB.
      BSIS_TAB-WAERS = it_bsis-WAERS.
    BSIS_TAB-BUDAT = it_bsis-BUDAT.
    BSIS_TAB-BLART = it_bsis-BLART.
    IF it_BSIS-SHKZG = 'H'.
    BSIS_TAB-DMBTR = wa_BSEG-DMBTR * -1.
    BSIS_TAB-DMBE2 = wa_BSEG-DMBE2 * -1.
    BSIS_TAB-DMBE3 = wa_BSEG-DMBE3 * -1.
    BSIS_TAB-WRBTR = wa_BSEG-WRBTR * -1.
    ENDIF.
    APPEND BSIS_TAB.
    endif.
    endloop.

  • Mass Change on FBL5N

    Hi,
    I need to do a mass change on a specific field for several document numbers shown on the customer line item
    I go to this path: Tcode FBL5N > Environment > Mass change > New Values
    Unfortunately, the field which I want to edit ( invoice reference field ) is not included in the list. Is there a way to do it?
    Thanks.

    Dear,
    If you want to perform the mass change in FBL5N with Invoice Reference field.
    I think before you try with mass change you need to do the below changes in you setting
    after executing the FBL5N select>Menue>Settings-->click on Soecial Fields
    Here you have give or select BSEG-REBZG and save the settings (for this you should have the right or authorisatin or client modifyable authorisatoan then only you can do this settings)
    I hope it will cleares your dought....
    Regards,
    Gureddy

  • Help Me on Report

    Hi,
    In the selecion Screen User Enter
    we are retiving the data like VALUT , WRBTR, SHKZG from BSEG table on the basis of VALUT
    we are took the openning balence from the Selection -Screen
    I want closing balence for every day and the closing balence for next day openning balence
    same thing for every month end also this is based on Value date
    Please send the sample code,
    if anybody help me on this iam very much thankful to them.
    Award points for helpful answer
    Thanks
    SEK

    hi,
    there're 2 alternatives:
    1) select bseg with valut (which will have a bad performance)
    2) save your items in an extra customer table with key = bseg-key 
    and create an index to field VALUT (with BTE or an user-exit)
    A.

  • Adding  fields in the  transaction  FS10N ( G/L  Account LIne Item  Display

    Hi all,
    in G/L  Account Balance Display( FS10N)  once i get list display when i click
    CUMULATIVE DISPLAY button it will go to G/L  Account LIne Item  Display list
    Here i have to add CUSTOMER field (sold to party or partner)  And NAME field in
    the list beside G/L account and  company code fileds
    Please let me know how to proceed.
    shall i have to do any back ground setting or
    i have to copy the program in to Z program
    then modify?
    urgent requirement
    please let me know
    thanks

    Hi,
    For writing a substitution exit code you will need the help of your ABAPer.
    Use T Code GGB1 to create a substitution. In the application Area select Financial Accounting --> Line item.
    Create a substitution for your company code. Under Substitution Create Step. When you click on step it will give you a list of fields in BSEG table. Select field name XREF1 or XREF2 or XREF3 any one. In the next screen select "Exit". In the Prerequisites give conditions as BKPF-BUKRS = 1000 (your company code).
    In the Substitution select your exit code against  your XREF1 or XREF2 or XREF3 field.
    While writing the exit code you can give the logic as select BSEG-KUNNR and pass to table KNA1. Then populate BSEG-XREF1 with KNA1-NAME1
    Save this substitution and activate it in T Code "OBBH"
    While writing Substitution exit copy the standard program "RGGBS000" and create your Z program. Write your new code in the Z program. This step should be done before you create a substitution. Use T Code GCX2 and maintain your Z program against Application Area "GBLS".
    Also see to it that the Reference Key1 / 2 / 3 field is made optional in all the Posting Keys and Field Status Groups.
    Please let me know whether this helps.
    Regards,
    Swapnil

  • Find obligatory fields in the transaction MM01

    Hi,
    My requirement is to create a Z table which will store all mandatory fields from the transaction MM01.
    Is there a way to know which fields are mandatory without being in the transaction MM01 or OMS9? In which system table is this information saved?
    Regards,
    Roberto

    Hi,
    For writing a substitution exit code you will need the help of your ABAPer.
    Use T Code GGB1 to create a substitution. In the application Area select Financial Accounting --> Line item.
    Create a substitution for your company code. Under Substitution Create Step. When you click on step it will give you a list of fields in BSEG table. Select field name XREF1 or XREF2 or XREF3 any one. In the next screen select "Exit". In the Prerequisites give conditions as BKPF-BUKRS = 1000 (your company code).
    In the Substitution select your exit code against  your XREF1 or XREF2 or XREF3 field.
    While writing the exit code you can give the logic as select BSEG-KUNNR and pass to table KNA1. Then populate BSEG-XREF1 with KNA1-NAME1
    Save this substitution and activate it in T Code "OBBH"
    While writing Substitution exit copy the standard program "RGGBS000" and create your Z program. Write your new code in the Z program. This step should be done before you create a substitution. Use T Code GCX2 and maintain your Z program against Application Area "GBLS".
    Also see to it that the Reference Key1 / 2 / 3 field is made optional in all the Posting Keys and Field Status Groups.
    Please let me know whether this helps.
    Regards,
    Swapnil

  • PGI-profit center

    Hi All,
    We have activated the split valuation for material code (XXXX)
    Material Code1---------- Split valuation “”A”” No costing Views
    Material Code1----------- Split valuation “”B”” No Costing Views
    When we are doing the PGI for the above material codes. System is not picking the profit centre from the material master (unable to maintaining costing views due to split valuation)....
    Please help...
    Thanks

    Hi
    As Ajay rightly pointed out, you can create costing views independent of the valuation type.
    Try using MM01 and just select plant (do not enter valuation type) and then choose the costing views, you should be able to maintain it then.
    Once done, I am sure the same profit center would be used in PGI.
    However if your requirement is to have different profit center per valuation type, then I can only think of using Ztable for this purpose. You cannot save multiple profit centers in the same material master (Table MARC)
    In this case, you can use subsitution as suggested above, by selecting BSEG-MATNR, BSEG-WERKS & BSEG-BWTAR combination in your Ztable to derive correct profit center.
    Hope the above information was useful
    Regards
    Mustafa

Maybe you are looking for

  • Error message when installing over existing software.

    I built a LabVIEW installer that basically only installs the DAQmx drivers. This installer installed DAQmx 8.5. Because of the need to include a LabVIEW app with our software, I have rebuilt this installer and it now installs DAQmx 8.6 as well as the

  • My iphone 5 wont let me update apps keeps popping up with old apple id how do i fix this

    my iphone 5 wont let me update apps keeps popping up with old apple id how do i fix this??

  • Synchronous AI, AO and DI

    Hello LabVIEW community - I am have some difficulty in getting my application to work properly - specifically monitoring the status of a DI line during AI and generating an AO waveform. The equipment I am using consists of: cDAQ 9172 chassis, 9401 DI

  • Just few issues left for a full complete Gnome-Arch :D.

    This is the first time with arch, actually i did try earlier, but could never get it to boot. Never figured out how to handle a seperate /boot. This time everything in single "/". I am using thinkpad T61, with nvidia quadro 140NVS, T9300, intel 4635

  • Button on page 0 - how to branch to new page

    I have a button (named 'P0_RUN_TASK') created on page 0 that I need to use to branch to other pages. The page to branch will depend on the values of other items on page 0. How do I do this? Application Process?