Performance Issue: Select From BSEG & BKPF

Hi experts,
Performance issue on the select statements; how can I improve the performance?
Select Company Code (BUKRS)
Accounting Document Number (BELNR)
                    Document Type (BLART)
                    Posting Date in the Document (BUDAT)
                    Document Status (BSTAT)
                    Reversal Document or Reversed Document Indicator (XREVERSAL)
           From Accounting Document Header (BKPF)
             Into I_BKPF
         Where BKPF-BUKRS = I_VBAK-BUKRS_VF
       BKPF-BLART = ‘KI’
                    BKPF-BUDAT = SY-DATUM – 2 days
                    BKPF-BSTAT = Initial
                    BKPF-XREVERSAL <> ‘1’ or ‘2’
Select Company Code (BUKRS)
                    Accounting Document Number (BELNR)
                    Assignment Number (ZUONR)
                    Sales Document (VBEL2)
                    Sales Document Item (POSN2)
                    P & L Statement Account Type (GVTYP)
            From Accounting Document Segment (BSEG)
              Into I_BSEG
          Where BSEG-BUKRS = I_VBAK-BUKRS
        BSEG-VBELN = I_VBAK-VBEL2
        BSEG-POSN2 = I_VBAP-POSNR
             BSEG-BELNR = I_BKPF-BELNR
                     P & L Statement Account Type (GVTYP) = ‘X’

Hi,
to improve the performance, you can use the secondary indices viz., BSIK / BSAK, BSID / BSAD, BSIS.
Hope this helps.
Best Regards, Murugesh AS

Similar Messages

  • [Performance Issue] Select from MSEG

    Hi experts,
    Need your help on how to improve the performance in the select from MSEG, it takes about 30 minutes to just finish the select. Thanks!
        SELECT mblnr
               mjahr
               zeile
               bwart
               matnr
               werks
               lgort
               charg
               shkzg
               menge
               ummat
               lgpla
          FROM mseg
          INTO CORRESPONDING FIELDS OF TABLE i_mseg2
           FOR ALL ENTRIES IN i_likp
          WHERE bwart IN ('601','602','653','654')
           AND matnr IN s_matnr
           AND werks IN s_werks
           AND lgort IN s_sloc
           AND lgpla EQ i_likp-vbeln.

    store all the vbeln to ranges.
    ranges:r_vbeln for i_likp-vbeln.
    r_vbeln-option = 'EQ'.
    r_vbeln-sign = 'I'.
    loop at i_likp.
    r_vbeln-low = i_likp-vbeln.
    append r_vbeln.
    endloop.
    sort r_vbeln ascending
    delete adjacent duplicates from r_vbeln.
    then modify the fetch as below.
    donot use a loop to fetch data from mseg.
    SELECT mblnr mjahr zeile bwart matnr werks lgort charg shkzg menge ummat lgpla
    FROM mseg client specified INTO CORRESPONDING FIELDS OF TABLE i_mseg2
    FOR ALL ENTRIES IN i_likp
    where mandt = sy-mandt
    and (bwart = '601' or bwart = '602' or bwart = '653' or bwart = '654' )
    AND matnr IN s_matnr
    AND werks IN s_werks
    AND lgort IN s_sloc
    AND lgpla in r_vbeln.
    there is another table where u can get this data...i,ll let u know shortly...
    try with this if useful
    reward points....

  • Select From BSEG

    Hi
    The below mentioned piece of code is throwing a dump in Production system.
    Is there any way of alternate selection.
      IF NOT it_pos[] IS INITIAL.
        SELECT * FROM bseg INTO
                 TABLE it_bseg
                 FOR ALL ENTRIES  IN it_pos
                     WHERE  bukrs IN dd_bukrs
                     AND    belnr = it_pos-belnr
                     AND    gjahr = it_pos-gjahr.
      ENDIF.
    Regards
    Subin.S

    I think you need to post a few more details of the environment and error to assist people in offering solution.
    Questions I think of are:
    - What type of dump are you getting? - Out of Time? Out of Memory? Other?
    - How many entries are in internal table it_pos[] before the BSEG select starts?
    - How many entries are in BSEG approximately?
    - Do you need all the BSEG records to be selected into an internal table at once or can you process them in smaller sets?
    - Do you have a number of other large internal tables in your program?  Can any of these be cleared to free up memory?
    - can you run SQL trace (ST05) against the program to see the execution time for each fetch from BSEG and how many records each fetch returns?
    - why are you doing two selects from BSEG? What is the difference between them? normally better to get all the fields at the same time instead of selecting twice.
    - in Development or Test where there is less data, does tha program run OK?  If so, can you run it in SE30 to see what that transaction highlights as performance or similar issues?
    - what table or tables do you fill table it_pos[] from?  are there any duplicate records in this internal table?
    - what SAP version are you running?  32 bit or 64 bit?  What database?
    To solve an issue like this with a program these and probably dozens of other questions must be asked and answered - and as the person on the site you are the only one able to get the answers. 
    Posting more details will help forum readers to evaluate the issue in light of their experience and to provide further suggestions.  The more information you can give - the more likely that someone will be able to answer.
    thanks
    Andrew

  • Selection from BSEG table

    Hi all
    In one of my program i have to use selection from BSEG by using non key fields like anln1, hkont  etc.
    My program run time taking too much time i.e 1.5 to 2hrs
    Is there any criteria to reduce my run time.
    plz help
    thks
    sateesh

    Hi
    If you need a select by field hkont (so G/L account) use the table BSIS (open item) and BSAS (cleared item)  instead of BSEG, just Eric said.
    SELECT * FROM BSAS WHERE BUKRS = BUKRS
                                              AND HKONT = HKONT.
       SELECT SINGLE * FROM BSEG WHERE BUKRS = BSAS-BUKRS
                                                              AND BELNR = BSAS-BELNR
                                                              AND GJAHR = BSAS-GJAHR
                                                              AND BUZEI  = BSAS-BUZEI.
             SELECT SINGLE * FROM BKPF WHERE BUKRS = BSAS-BUKRS
                                                                   AND BELNR = BSAS-BELNR
                                                                   AND GJAHR = BSAS-GJAH.
    Max
    Edited by: max bianchi on Nov 5, 2008 11:03 AM

  • Selecting from bseg

    Abap Gurus,
    I am fetching belnr dmbtr buzei hkont from bseg
    for all entries from one table say 'TAB'
    where hkont = TAB-hkont
    and koart = 'S'.
    but in in the code inspector check it;s showing error
    The message is
    "Large table BSEG: No field of a table index in WHERE"
    How to optimize a fetch from a larger cluster table BSEG
    rewards if useful.
    Thanks in advance

    Hi,
         Alternatives to Reading BSEG (Accounting Document Segment).
    Since performance is an issue if reading data from BSEG table ( being a cluster table ), maybe you would
    consider using the tables:
              BSAD      Accounting     : Secondary Index for Customers (Cleared Items)
              BSAK      Accounting     : Secondary Index for Vendors (Cleared Items) 
              BSAS      Accounting     : Secondary Index for G/L Accounts (Cleared Items)
              BSID      Accounting     : Secondary Index for Customers
              BSIK      Accounting     : Secondary Index for Vendors    
              BSIS      Accounting     : Secondary Index for G/L Accounts
              instead of BSEG.
              It depends on what your program has to select (if you're only looking for customers
              you can use BSID and BSAD etc.)
              These are normal database tables, not clusters. Normally every record from BSEG
              can be found back in one of these 6 tables and a program which selects data from
              these tables runs faster than from BSEG.
    Reward points if helpful
    Thanks
    Shambhu

  • Selecting from bseg misses dupicalte entry

    Hi,
    i select entries from bkpf/bseg as below:
      select bukrs belnr gjahr budat bldat waers
             into table lt_bkpf
             from bkpf
             where bukrs in s_bukrs
             and   blart in s_blart
             and   bldat in s_bldat
             and   budat in s_budat
      select bukrs belnr hkont wrbtr dmbtr shkzg vbund
             from bseg
             into table lt_bseg
             for all entries in lt_bkpf
             where bukrs =   lt_bkpf-bukrs
             and   belnr =   lt_bkpf-belnr
             and   gjahr =   lt_bkpf-gjahr
             and   hkont in  s_hkont.
    this works fine except for a few docs which all have the same 'issue' where there is a duplicate WRBTR value in bseg. e.g.
    BUKRS|BELNR|BUZEI|WRBTR|HKONT
    1000|12345678|001|1000.00|7777
    1000|12345678|002|1355.00|7777
    1000|12345678|003|1000.00|7777
    1000|12345678|004|9879.00|7777
    my select statements output :
    1000|12345678|001|1000.00|7777
    1000|12345678|002|1355.00|7777
    1000|12345678|004|9879.00|7777
    Notice that item 3 is not found.
    Note 416076 looks kind of related but we are on 470 and that is only for 4.6X.
    Any ideas, as I am stumped?
    thanks.

    This is a trap when using the FOR ALL ENTRIES option on a select.  It is mentioned in the documentation of the command.  It is not related to indexes of the table.
    FOR ALL ENTRIES has the same result as a SELECT DISTINCT -- duplicates are removed from the result set.
    to get all entries that exist, make sure you specify ALL fields of the table primary key in the list of fields you retrieve.
    so add the missing two fields to your internal table and modify your BSEG select to the following.
      select bukrs belnr GJAHR BUZEI hkont wrbtr dmbtr shkzg vbund
             from bseg
             into table lt_bseg
             for all entries in lt_bkpf
             where bukrs =   lt_bkpf-bukrs
             and   belnr =   lt_bkpf-belnr
             and   gjahr =   lt_bkpf-gjahr
             and   hkont in  s_hkont.
    This will get all BSEG entries.
    To prove this in DEV/Unit Test environment with less data available, try the following:
      select bukrs shkzg
             from bseg
             into table lt_bseg
             for all entries in lt_bkpf
             where bukrs =   lt_bkpf-bukrs
             and   belnr =   lt_bkpf-belnr
             and   gjahr =   lt_bkpf-gjahr
             and   hkont in  s_hkont.
    Andrew

  • Selection from bseg with year

    Hi,
    Iam trying to use bsak-budat with bseg-gjahr.But lengths are not same. I had offsetting with budat.But values are not matching...could any one tell me how to do that?
    points guaranteed
    cheers
    kaki
        select BUKRS LIFNR AUGDT AUGBL GJAHR BELNR  BUZEI BUDAT BLDAT
            CPUDT WAERS BLART BSCHL SHKZG DMBTR WRBTR SGTXT HKONT SKFBT
             from bsak
             into corresponding fields of table t_bsak
              where
              lifnr in s_lifnr and
              BUKRS in s_bukrs and
              budat le s_budat and                          augdt in s_augdt.
    loop at t_bsak.
      l_year = t_bsak-budat(4).
    endloop.
      CHECK NOT t_bsak[] IS INITIAL.
      select BUKRS LIFNR AUGDT AUGBL GJAHR BELNR
           SHKZG DMBTR WRBTR SGTXT SKFBT KOSTL BSCHL HKONT BUZEI
         into corresponding fields of table t_bseg from bseg
                FOR ALL ENTRIES IN t_bsak
                where belnr = t_bsak-belnr and
                      gjahr = l_year and        " xxxxxx
                      bukrs = t_bsak-bukrs.

    Define a field I_YEAR in int table T_BSAK.
    DATA Begin of t_BSAK,
    I_YEAR LIKE BSEG-GJAHR,
    end of t_bsak.
    loop at t_bsak.
    t_bsak-l_year = t_bsak-budat(4).
    modify t_bsak.
    endloop.
    Then
    select BUKRS LIFNR AUGDT AUGBL GJAHR BELNR
    SHKZG DMBTR WRBTR SGTXT SKFBT KOSTL BSCHL HKONT BUZEI
    into corresponding fields of table t_bseg from bseg
    FOR ALL ENTRIES IN t_bsak
    where belnr = t_bsak-belnr and
    gjahr = t_bsak-i_year and " xxxxxx
    bukrs = t_bsak-bukrs.
    Alternatively why not select gjahr from BSAK .
    Cheers .
    Sanjay

  • Need to select from BSEG on Non Key fields.

    Hi all,
    I am developing a report on Work Order Cost Analysis. The selection screen has Order Type (AFPO-DAUAT), Plant (AFPO-DWERK), Date range (AFKO-GLTRI) and Part Number (AFKO-PLNBEZ) as the selection criteria. <b>All the orders and their corresponding object numbers (OBJNR) are picked in an internal table</b>, for all orders that fulfill the selection criteria and their Actual Finish Date (AFKO-GLTRI) falls between the entered date range.
    Now comes the problem, <b>corresponding to these Order Numbers I need to pick records from BSEG.</b> Since this is not a key field in BSEG, its not indexed and the report times out on the Development Server itself.
    <b>I also tried using COEP</b> table as the fields that I need are present there as well (Though I am not sure weather it would be give me all the lines of records that I need from BSEG), but that operation also times out.
    LDBs also don't seem to help. Is there any way I can achieve the above?
    <b>PLEASE HELP. REWARDS GUARANTEED.</b>
    Regards,
    Nikhil

    OK - a couple of things:
    In the select from covp, you are retrieving the CO document data not the FI document data, so you need the reference documents.
    Even though OBJNR is the first field of a key it will not be very selective. It would be better if you could specify more fields. Fortunately, some are standard and you can probably figure out what to use. If you can limit this to a single fiscal year, it would be best. Failing that, you should specify any (or all) fiscal years in a range table (using =).
    This is the select that I came up with:
    SELECT refbk refbn refgj refbz
           FROM  covp
           INTO  CORRESPONDING FIELDS OF TABLE it_covp
           FOR ALL ENTRIES IN it_worder
           WHERE lednr = '00'               "Standard ledger
           AND   objnr = it_worder-objnr
           AND   gjahr IN s_gjahr
           AND   wrttp = '04'               "Actuals
           AND   versn = '000'              "Plan/Actual ver.
           AND orgvg = 'RFBU'.              "FI Postings
    I filled s_gjahr with the individual years from 1995 to 2006 and it ran in under 20 minutes. (The first select was wide open and selected all.)
    Rob
    By the way - do you still need to go to BSEG, or can you get everything you need from COVP?
    Message was edited by: Rob Burbank

  • [Performance Tuning] Select from QMEL

    Hi experts,
    I have a problem with regards with the select from QMEL table, it takes too long to execute. Your input is very much appreciated.
      IF i_sales_orders[] IS NOT INITIAL.
        SELECT qmnum
               vbeln
          FROM viqmel
          INTO TABLE i_viqmel
           FOR ALL ENTRIES IN i_sales_orders
         WHERE vbeln EQ i_sales_orders-vbeln.
      ENDIF.
    Regard,
    Ng

    Table QMEL appears to have an index by cuatomer/sales org/distrib channel/division/...etc  (index MCK).
    If what you are looking for is sales order data, then you should be able to read these fields from VBAK into your i_sales_order internal table first (primary key - should be quick), and then read a smaller volume of data from QMEL:
    IF i_sales_orders[] IS NOT INITIAL.
    SELECT qmnum
    vbeln
    FROM qmel
    INTO TABLE i_viqmel
    FOR ALL ENTRIES IN i_sales_orders
    WHERE kumun = i_sales_orders-kunnr
    AND vkorg = i_sales_orders-vkorg
    AND vtweg = i_sales_orders-vtweg
    AND spart = i_sales_orders-spart 
    AND vbeln EQ i_sales_orders-vbeln.
    ENDIF.

  • SSAS Tabular Performance Issue moving from Laptop to Server

    Hi all,
    I've got an issue where my tabular model in SSAS on a Lenovo W520 laptop (DEV) is out-performing the same model on a Dell R720 server (details of each system below).  Our unit tests involves 1 query that takes 2-3 seconds on the laptop
    vs 12-15 seconds on the server.  The main difference is the laptop is running Windows 7 Pro and the server is Windows Server 2012 R2. 
    So for some additional tests we did the following:
    1. Loaded up the model on another laptop (same model and specs as before) the same way we moved the model over to the server and it performed as expected 2-3 seconds for the query.
    2. Loaded up the model on a dell OptiPlex system (i3 processor, 8GB Ram, Win7 Pro) and runs 2-3 seconds still for the query.
    3. Loaded up Win2k8R2 on the dell OptiPlex system (above) and still run 2- 3 seconds)
    At this point we are thinking it is an OS issue between 2008R2 and Server 2012 R2 but not sure what the true difference is between the OS(s) that would cause such a huge performance difference.  We thought it might be the power saving mode that ships
    with 2012 R2 so set that performance but still seeing a long lag in the query.
    Laptop Specs:
    Lenovo W520
    1 x i7 2.5GHz 2860QM Processor (8 Cores, )
    16 GB Memory (DDR3, Dual)
    Windows 7 Pro
    Server Specs:
    Dell R720
    2 x E5-2697 V2 (12 Cores each, 2.7GHz, with turbo boost enabled)
    4 x 32GB Memory (LRDIM 1866 MT/s)
    Windows Server 2012 R2 (All latest updates and drivers)
    There has to be some simple setting I'm missing in the 2012 R2 server that is causing this poor performance in SQL Server.  I've seen folks in the tabular forums using Server 2012 R2 so there has to be a way to have this server perform better. 
    I'm about at my wits end on this one and reaching out for help from the experts out there.  What advice can you give me?
    Thanks in advance for any help you can provide!
    Best regards,
    Michael

    Hi Michael,
    Acording to your description, you encounter the perofrmance issue in SQL Server Analysis Services Tabular model, right?
    as you increase the data load, add more users, or run complex queries, you need to have a strategy for maintaining and tuning performance. Here is a document that describes strategies and specific techniques for getting the best performance from your tabular
    models, including processing and partitioning strategies, DAX query tuning, and server tuning for specific workloads.
    http://msdn.microsoft.com/en-us/library/dn393915.aspx
    Besides, if you cannot determine your answer here or on your own for a complex problem, consider opening a support case with Microsoft. Visit this link to see the various support options that are available to better meet your needs:
    http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone
    Regards,
    Charlie Liao
    TechNet Community Support

  • Performance issue - Select statement

    Hi  I am having the 10 lack records in the KONP table . If i am trying to see all the records in SE11 , it is giving the short dump TSV_TNEW_PAGE_ALLOC_FAILED . I know this is because of less memory in the Server . Is there any other way to get the data ? How to optimise the below SELECT statement if i have large data in the table .
    i_condn_data - is having 8 lack records .
    SELECT knumh kznep valtg valdt zterm
            FROM konp
            INTO TABLE i_condn_data_b
            FOR ALL ENTRIES IN i_condn_data
            WHERE knumh = i_condn_data-knumh
            AND kschl = p_kschl.
    Please suggest .

    Hi,
    try to use "UP TO n ROWS" to control the quantity of selected data in each Loop step.
    Something like this:
    sort itab by itab-knumh.
    flag = 'X'.
    while flag = 'X'.
    SELECT knumh kznep valtg valdt zterm
    FROM konp
    INTO TABLE i_condn_data_b UP TO one_million ROWS
    WHERE knumh > new_value_for_selection
    AND kschl = p_kschl.
    describe table i_condn_data_b lines i.
    read table i_condn_data_b index i.
    new_value_for_selection = i_condn_data_b-knumh.
    *....your logic for table i_condn_data_b
    if  one_million  > i.
    clear flag.
    endif.
    endwhile.
    Regards

  • How to perform multiple selection from dropdown list

    Hi,
           I have developed one application in which i have taken one dropdownbyindex and entered some values in it, now i need to have multiple selection of entries, can any one please suggest how to do these
    Regards,
    Prasanna

    A drop-down list is by definition a 1-from-many selector.
    Armin

  • [URGENT]: BSEG performance issue

    Hi experts,
    Need help on how to improve on the performance of select from BSEG table. Points will be rewarded. Thanks!
    IF i_vbappay[] IS NOT INITIAL.
        SELECT bukrs
               belnr
               zuonr
               vbel2
               posn2
               gvtyp
          FROM bseg
          INTO TABLE i_bseg
          FOR ALL ENTRIES IN i_vbappay
         WHERE bukrs EQ i_vbappay-bukrs
           AND vbel2 EQ i_vbappay-vbeln
           AND posn2 EQ i_vbappay-posnr
           AND gvtyp EQ c_x.
      ENDIF.

    hi,
    The below fields should be follow the same Sequence as per the table BSEG
    bukrs
    belnr
    zuonr
    vbel2
    posn2
    gvtyp
    nad also, in the where condition fields should follow the same sequence
    Regards
    Sudheer

  • Selecting from BKPF and BSEG

    Hi all,
    Can someone help me optimize the performance of this code as i don't know how else to select from BSEG as i cannot use a join coz its a cluster table. I need to find a way to improve the perfomance.Any help would be much appreciated.
    SELECT belnr gjahr bukrs budat stblg awkey blart
             FROM bkpf INTO CORRESPONDING FIELDS OF TABLE t_bkpf
             WHERE belnr IN s_belnr and
                   gjahr = p_gjahr  and
                   bukrs = p_bukrs.
      LOOP AT t_bkpf.
          SELECT belnr gjahr buzei ebeln ebelp
               wrbtr fipos geber fistl fkber
               augbl augdt shkzg
        INTO CORRESPONDING FIELDS OF table t_bseg
        FROM bseg
        WHERE belnr = t_bkpf-belnr
        AND   gjahr = t_bkpf-gjahr
        AND   bukrs = t_bkpf-bukrs.
    Thanks alot
    seema

    Hi Seema,
    You have to avoid the database retrival inside the loop.You can use for all entries.
    This is taken from a link.
    Some of the SAP tables are not transparant, but pooled or clustered. Be aware of this !
    There are a lot of limitations on how such tables can be accessed. You can not include such
    tables in database views and join constructs. The FI-GL table BSEG, which is one of our
    biggest PR1 tables, is an example of a clustered table. At the database-level, there is no table
    called BSEG, but instead RFBLG is being used for the BSEG data. Most of the fields known
    in BSEG are not known in the database table RFBLG, but are compressed in a VARDATA
    field of RFBLG. So tests in the WHERE clause of SELECTs agains BSEG are not used by
    the database (e.g. lifnr = vendor account number, hkont = G/L account, kostl = cost center).
    As a consequence, these tests are done after the facts similar to using the CHECK statement,
    and as already said in tip 1, CHECK statements are worse than tests in the WHERE-clause.
    Check this link also.
    How to Read BSEG Efficiently
    you'll never select table bkpf alone.
    alternatives:
    1) select with header information from bkpf
    2) use secondary index tables
    Re: Tuning cluster table selection
    3) use logical data base e.g.: BRF
    Hope this helps.If so,reward points.Otherwise, get back.

  • Performance issue with BSEG

    Hi,
              I am having serious performance issue due to BSEG table .I am having a change request in which I have to solve the performance issue with regard to BSEG. The situation was that previously they had used select * on both BKPF and BSEG. I removed the select * and selected only those fields which are required as shown below. I also tried using cursors. But the problem is happening in the TEST server where BSEG is having more than 1 crore entries. I have gone through some threads but still not able to understand how to solve this problem. Please help
    select bukrs belnr gjahr bldat bstat from bkpf into table T_BKPF_p
                                                    WHERE BUKRS IN sd_bukrs AND
                                                    BLDAT < s_bldat-low
                                                    and  BSTAT = ' ' .
    select bukrs belnr gjahr shkzg dmbtr hkont from bseg into table T_BSEG_C
                                            FOR ALL ENTRIES IN t_BKPF_p
                                            WHERE BUKRS = T_bkpf_p-bukrs
                                            AND   BELNR = T_bkpf_p-belnr
                                            AND   GJAHR = T_bkpf_p-gjahr
                                            AND   HKONT = SKB1-SAKNR.

    Hi Kunal,
    Here is my take on your issue.
    In your select statement on BKPF you are selecting every BKPF record for a specified company code and blank document status that was created before a specified date. If your company has implemented SAP 10 years ago, and your user enters todays date and leaves the company code field blank you will effectively be retrieving almost all the records from BKPF (excluding the ones created today or those with non-blank document status). This would effectively be a huge amount of data. After that you are looking for the corresponding BSEG records for all the records that you have selected in BKPF.
    My question to you is why do you need to look at all the records before a given date? Why not ask the user to enter a smaller date range and make the document date and the company code a mandatory entry? You do not have to look at 10 years worth of data especially if you are running this online (as opposed to in the background).
    Your BSEG select looks correct. There is very little that you can do except for adding BUZEI to the field list. If you use for all entries and do not include the entire primary key you could lose data.
    TABLES: bkpf,
            skb1.
    SELECT-OPTIONS: s_bldat  FOR bkpf-bldat OBLIGATORY,
                    sd_bukrs FOR bkpf-bukrs OBLIGATORY.
    TYPES: BEGIN OF ty_bkpf,
            bukrs TYPE bkpf-bukrs,
            belnr TYPE bkpf-belnr,
            gjahr TYPE bkpf-gjahr,
            bldat TYPE bkpf-bldat,
            bstat TYPE bkpf-bstat,
          END OF ty_bkpf,
          BEGIN OF ty_bseg,
            bukrs TYPE bseg-bukrs,
            belnr TYPE bseg-belnr,
            gjahr TYPE bseg-gjahr,
            buzei TYPE bseg-buzei,
            shkzg TYPE bseg-shkzg,
            dmbtr TYPE bseg-dmbtr,
            hkont TYPE bseg-hkont,
          END OF ty_bseg.
    DATA: t_bkpf_p TYPE TABLE OF ty_bkpf,
          t_bseg_c TYPE TABLE OF ty_bseg.
    SELECT bukrs
           belnr
           gjahr
           bldat
           bstat
    FROM bkpf
    INTO TABLE t_bkpf_p
    WHERE bukrs IN sd_bukrs
    AND   bldat IN s_bldat
    AND   bstat EQ space .
    IF NOT t_bkpf_p[] IS INITIAL.
      SELECT bukrs
             belnr
             gjahr
             buzei
             shkzg
             dmbtr
             hkont
        FROM bseg
        INTO TABLE t_bseg_c
        FOR ALL ENTRIES IN t_bkpf_p
        WHERE bukrs EQ t_bkpf_p-bukrs
        AND   belnr EQ t_bkpf_p-belnr
        AND   gjahr EQ t_bkpf_p-gjahr
        AND   hkont EQ skb1-saknr.
    ENDIF.

Maybe you are looking for

  • PDF TOC in Japanese illegible

    Hi all, I generate Japanese PDF documents with  DocBook and Apache FOP (Version 1.0). For the Japanese text I embed MSP Gothic and also MS PMincho. Both fonts are available on Windows 7 by default. When I look into the properties of the PDF document,

  • How do I unlock my phone if i dont remember the code?

    I am going back to an old phone and it is locked. I cant remember the code what do I do?

  • Text file to XML integration.

    Hi, My Text file is picking from source but not writing to target. Getting "RuntimeException in Message-Mapping transformatio~". But when i test message mapping it showing success. All the fields are mapped properly and Conversion is also correct, wh

  • HT4236 Syncing photos with itunes

    When I synced my photos from my computer to my ipod touch it created two photo albums. How do I delete one of them off of my device? Chyatt

  • Adobe digital edition failed!!!

    hi there,2 days before I bought an e reader however I'm travelling a lot in the country and outside as well,I was absolutely very disappointed with adobe digital editiond however I've purchased some e books and just cannot figure out how can I author