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

Similar Messages

  • 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

  • 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

  • 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

  • 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

  • How to fetch data from bseg based  on 2 internal tables in 1 select query?

    hi,
    i have bukrs and belnr in one internal table and bukrs and vbeln in another internal table..now if i select from bseg twice using for all entries for fields bukrs vbeln and bukrs belnr twice in 2 select statements its fine..but since bseg is a huge table i want to use select only once..but the problem is that none of the belnrs in the one internal table will have vbeln in another internal table....ie if vbeln is selected from bseg based on belnr in 1 internal table non eof those vbeln will be equal to vbeln on another internal tables..in this scenario even if i take all data from two internal tables into 1 single internal table and then use for all entries on vbeln and belnr of that table ..but i think this will not work because and AND operator will not work because no record will satisfy both vbeln and belnr conditions..even if i use OR operator if the 1st condition satisfies the select clause will not enter into the second clause and all the records will not be fetched...Please help how should i tackle this..

    Hi vijaya,
    no simple select statement solution so far.
    As BSEG is a huge table you should try to get the full key values into another internal table first.
    SAP avoids direct selections from BSEG.
    Pleas consider the use of one of the secondary index tables first:
          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 Item
          BSEC : One-Time Account Data Document Segment
          BSEG : Accounting Document Segment
          BSID : Accounting: Secondary Index for Customers
          BSIK : Accounting: Secondary Index for Vendors
          BSIS : Accounting: Secondary Index for G/L Accounts
    you may include
          BKPF : Accounting Document Header
    for restrictions about time and document type.
    The last step is a FOR ALL ENTRIES selection from BSEG providing the full key values.
    Although you may have even more selects, the overall performance will be much better.
    Regards,
    Clemens

  • Abap query to select a line item # from bseg on basis of following pattern:

    Hello,
    I want to retrieve the line item # from bseg which has the following pattern,
    account type = S
    AND
    gl account starting from 135***** , 136***** , 137*****
    , 138***** , 139*****
    hope i am comprehendable. How do i go on writing the query,
    Thanks..
    Shehryar

    Hi Shehryar,
    This will fetch records with GL A/C starting with <b>13</b> only , if you want 14 and others also write sepearate conditions using <b>LIKE</b> statements.
    REPORT zztest.
    DATA : itab TYPE STANDARD TABLE OF bseg WITH HEADER LINE.
    SELECT * FROM bseg INTO TABLE itab WHERE <b>koart = 'S'
    AND
    hkont LIKE '13%'</b>.
    This will take a lot of DB time for fetching the records, try to include Key Fields(BUKRS and GJAHR .. if possible others).
    Regards,
    Arun Sambargi.
    Regards

  • Regarding Select data from *BSEG

    Hi Experts,
    I am studying the logic of an ABAP in which data has been fetched by a select statement like this
    SELECT * FROM *BSEG
    When i double clicked on *BSEG, system says *BSEG does not exist. Also, there is no table as *BSEG in ABAP dictionary.
    Please let me know what does *BSEG signifies and what it is ?
    Thanks in advance,
    Akash Sawant

    Hi Akash,
    If you declare *BSEG  means its acts as a structure for the corresponding DB table.
    Check this sample code,
    tables : mara, *mara.
    DATA : ITAB LIKE TABLE OF *MARA WITH HEADER LINE.
    SELECT * FROM *MARA INTO TABLE ITAB.
    LOOP AT ITAB.
    WRITE : ITAB-MATNR.
    ENDLOOP.
    Thanks,
    reward If Helpful.

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

  • Problem while selecting BELNR from BSEG

    Hi Experts,
    I have a report performance problem while fetching BELNR from BSEG table.
    I have to print latest BELNR from BSEG where BUZID = ‘M’ but at the time of execution of report, It is taking too much time (More that hour and sometimes it gets hanged).
    I have also gone through the comments provided by experts for previous problems asked in this forum e.g. BSEG is a cluster table that is why data retrieval takes long time etc.
    Can any one has any other idea or suggestion  or any other way to solve this problem
    Regards,
    Neeraj

    Hi,
    1) Try to create an index on BUZID field
    2) Don't use SELECT/ENDSELECT statement. Instead of that extract all the concerned entries from BSEG into an internal table :
    select belnr from bseg appending table itab where buzid = 'M'.
    then do this :
    sort itab by belnr.
    describe itab lines n.
    read table itab index n.
    Please reward if helpful.
    Regards,
    Nicolas.

  • Query is too slow from bseg selection

    SELECT BELNR BLDAT BUDAT XBLNR GJAHR tcode WAERS AWKEY FROM BKPF INTO
      TABLE
      ITBKPF WHERE BUKRS EQ P_BUKRS AND BELNR IN S_BELNR AND BUDAT IN
        P_BUDAT
        AND STBLG = ''
        AND ( TCODE = 'MIRO' OR
                             TCODE = 'MR8M' OR
                             TCODE = 'MB11' OR
                             TCODE = 'MB1B' OR
                            TCODE = 'MIGO_GI' OR
                            TCODE = 'MIGO_TR' OR
                             TCODE = 'MB1A' ).
       IF SY-SUBRC EQ 0.
              SORT itBKPF.
            ELSE.
              MESSAGE 'No data for the relevant date' TYPE 'A'.
             LEAVE LIST-PROCESSING.
            ENDIF.
    SELECT A1LIFNR A1NAME1 A1ORT01 A1STRAS B1~j_1icstno
      INTO TABLE it_werks
      FROM ( LFA1 AS A1 INNER JOIN j_1imocomp AS B1 ON A1werks = B1werks )
    **********************************************this is too slow*************
    SELECT BUKRS BELNR GJAHR BUZEI BUZID BSCHL SHKZG GSBER MWSKZ
            DMBTR HKONT LIFNR LANDL Matnr werks MENGE EBELP xref3
            INTO CORRESPONDING FIELDS OF TABLE ITABBSEG
            FROM BSEG
            FOR ALL ENTRIES IN ITBKPF
            WHERE BELNR = ITBKPF-BELNR
            AND GJAHR = ITBKPF-GJAHR
            AND ( BSCHL = '86' OR BSCHL = '96' or BSCHL = '89' OR BSCHL = '99'  )
            AND WERKS IN S_WERKS
            AND BUZID <> 'F' .
    ****************************************this is too slow
    Moderator message: Please Read before Posting in the Performance and Tuning Forum
    locked by: Thomas Zloch on Aug 5, 2010 2:08 PM

    You should have provided the full key of the cluster file behind BSEG (RFBLG), every key is in BKPF, so add BUKRS
    SELECT bukrs belnr gjahr buzei buzid bschl shkzg gsber mwskz
           dmbtr hkont lifnr landl matnr werks menge ebelp xref3
      INTO CORRESPONDING FIELDS OF TABLE itabbseg
      FROM bseg
      FOR ALL ENTRIES IN itbkpf
      WHERE bukrs = itbkpf-bukrs
        AND belnr = itbkpf-belnr
        AND gjahr = itbkpf-gjahr
        AND ( bschl EQ '86' OR bschl EQ '96' OR bschl EQ '89' OR bschl EQ '99' )
        AND werks IN s_werks
        AND buzid EQ 'F' .
    You could also extract the whole accounting document in the internal table, and then delete record using the not-database-key selections.
    SELECT bukrs belnr gjahr buzei buzid bschl shkzg gsber mwskz
           dmbtr hkont lifnr landl matnr werks menge ebelp xref3
      INTO CORRESPONDING FIELDS OF TABLE itabbseg
      FROM bseg
      FOR ALL ENTRIES IN itbkpf
      WHERE bukrs = itbkpf-bukrs
        AND belnr = itbkpf-belnr
        AND gjahr = itbkpf-gjahr.
    DELETE itabbseg WHERE
      ( bschl NE '86' AND bschl NE '96' AND bschl NE '89' AND bschl NE '99' )
      OR NOT ( werks IN s_werks )
      OR BUZID NE 'F' .
    In both case, perform some tests with tools like SE30 or ST05.
    Regards,
    Raymond

  • Performance problem with selecting records from BSEG and KONV

    Hi,
    I am having performance problem while  selecting records from BSEG and KONV table. As these two tables have large amount of data , they are taking lot of time . Can anyone help me in improving the performance . Thanks in advance .
    Regards,
    Prashant

    Hi,
    Some steps to improve performance
    SOME STEPS USED TO IMPROVE UR PERFORMANCE:
    1. Avoid using SELECT...ENDSELECT... construct and use SELECT ... INTO TABLE.
    2. Use WHERE clause in your SELECT statement to restrict the volume of data retrieved.
    3. Design your Query to Use as much index fields as possible from left to right in your WHERE statement
    4. Use FOR ALL ENTRIES in your SELECT statement to retrieve the matching records at one shot.
    5. Avoid using nested SELECT statement SELECT within LOOPs.
    6. Avoid using INTO CORRESPONDING FIELDS OF TABLE. Instead use INTO TABLE.
    7. Avoid using SELECT * and Select only the required fields from the table.
    8. Avoid nested loops when working with large internal tables.
    9. Use assign instead of into in LOOPs for table types with large work areas
    10. When in doubt call transaction SE30 and use the examples and check your code
    11. Whenever using READ TABLE use BINARY SEARCH addition to speed up the search. Be sure to sort the internal table before binary search. This is a general thumb rule but typically if you are sure that the data in internal table is less than 200 entries you need not do SORT and use BINARY SEARCH since this is an overhead in performance.
    12. Use "CHECK" instead of IF/ENDIF whenever possible.
    13. Use "CASE" instead of IF/ENDIF whenever possible.
    14. Use "MOVE" with individual variable/field moves instead of "MOVE-
    CORRESPONDING" creates more coding but is more effcient.

  • Selection from bsak & bseg

    Hi experts,
    Iam trying to extract data from bsak & bseg something like..
    Litm  pk
    001   31 19000038 20050303   20050610
    but i need to extract compelete Line items & posting keys like..
    Litm  pk  budat    belnr     augbl
    001   31  20051010 190000038 20050303
    002   40
    003   40
    004   40 
    001   31  20051010 190000039 20050303
    002   40
    003   40
    004   40  
    Could any one tell me how can achieve this logic through internal table?Points guaranteed.
    reward guaranteed
    Kaki

    Hi all,
    Pls look into my code.I need to display complete "Line item" and "posting keys" for the particular "Doc no".
    REPORT  Z1F_RFKEPL00 no standard page heading
            line-size 140
            line-count 65
            message-id Z1.
    TABLES: LFA1,t005t,bsak,bseg,t001,skat.
    data: begin of t_bsak occurs 0,
            bukrs like bsak-bukrs,        "company code
            lifnr like bsak-lifnr,        "Vendor acc number
            augdt like bsak-augdt,        "Clearing date
            AUGBL like bsak-AUGBL,        "Clearing Document
            GJAHR like bsak-GJAHR,        "year
            belnr like bsak-belnr,        "Document number
            BUZEI like bsak-BUZEI,        "Line Item
            budat like bsak-budat,        "Posting Date in the Document
            bldat like bsak-bldat,        "Document date in document
            blart like bsak-blart,        "Document type
            BSCHL like bsak-BSCHL,        "Posting key
            WAERS like bsak-WAERS,        "Currency key
            CPUDT like bsak-cpudt,        "Accounting Document Entry Date
            SHKZG like bsak-shkzg,        "Debit/Credit Indicator
            DMBTR like bsak-dmbtr,        "Amount in local currency
            WRBTR like bsak-wrbtr,        "Amount in document currency
            SGTXT like bsak-sgtxt,        "Item Text
            SAKNR LIKE bsak-saknr,        "G/L Account Number
            hkont like bsak-hkont,        "General Ledger Account
            SKFBT LIKE BSAK-SKFBT,        "Amount Eligible for Cash Discount
            KOSTL LIKE BSEG-KOSTL,        "Cost center
            ktopl like t001-ktopl,        "chart of accounts
            txt20 like skat-txt20,        "Short test for the GL acc
          end of t_bsak.
    data: begin of t_lfa1 occurs 0,
            lifnr like lfa1-lifnr,
            name1 like lfa1-name1,
            land1 like lfa1-land1,
            landx like t005t-landx,
          end of t_lfa1.
    data: begin of t_header occurs 0,
            bukrs like bsak-bukrs,
            hkont like bsak-hkont,
            lifnr like bsak-lifnr,
            land1 like lfa1-land1,
            landx like t005t-landx,
          end of t_header.
    data: begin of t_data occurs 0,
             belnr like bsak-belnr,
             bukrs like bsak-bukrs,
             gjahr like bsak-gjahr,
             hkont like bsak-hkont,
             augbl like bsak-augbl,
             bschl like bsak-bschl,
             buzei like bsak-buzei,
             KOSTL LIKE BSEG-KOSTL,
    end of t_data.
    selection-screen begin of block blk1 with frame title text-001.
    select-options: s_lifnr for bsak-lifnr,
                    s_bukrs for bsak-bukrs.
    selection-screen end of block blk1.
    selection-screen begin of block blk2 with frame title text-002.
    parameters s_budat like bsik-budat default sy-datum.
    select-options: s_augdt for bsak-augdt.
    selection-screen end of block blk2.
    selection-screen begin of block blk3 with frame title text-003.
    parameters: stand as checkbox default 'X',
                park as checkbox.
    selection-screen end of block blk3.
    start-of-selection.
      perform process_data.
    top-of-page.
      perform set_page_header.
    *&      Form  process_data
          text
    form process_data.
      data: line like t_bsak occurs 0 with header line.
      data: l_wrbtr(10) type c.
      data: l_debit type bsak-wrbtr,l_credit type bsak-wrbtr,
            l_balance type bsak-wrbtr.
      data:l_hkont(10) type n.
    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 BUKRS in s_bukrs and budat le s_budat   " Open  items
                             order by lifnr.
      select BUKRS LIFNR AUGDT AUGBL GJAHR BELNR  BUDAT BLDAT CPUDT
      WAERS BLART  SHKZG DMBTR WRBTR SGTXT SKFBT KOSTL BSCHL hkont BUZEI
             from bsak into corresponding fields of table t_bsak
              where BUKRS eq '1000' and
                     lifnr = 'AARONWU'.
      sort t_bsak by BUDAT.
      loop at t_bsak.
        select belnr bukrs gjahr hkont buzei bschl from bseg
                into table t_data  where belnr = t_bsak-belnr and
                                     bukrs = t_bsak-bukrs and
                                     gjahr = t_bsak-gjahr.
       select single * from bseg
                where belnr = t_bsak-belnr and
                                    bukrs = t_bsak-bukrs and
                                    gjahr = t_bsak-gjahr.
       move-corresponding bseg to t_data.
       move bseg-belnr to t_data-belnr.
       move bseg-bukrs to t_data-bukrs.
       move bseg-gjahr to t_data-gjahr.
       move bseg-hkont to t_data-hkont.
       move bseg-kostl to t_data-kostl.
       move bseg-bschl to t_data-bschl.
       if sy-subrc = 0.
         append t_data.
         clear t_data.
       endif.
    endloop.
    loop at t_bsak.
    to get vendor name
        select single * from lfa1 where lifnr = t_bsak-lifnr.
        move lfa1-lifnr to t_lfa1-lifnr.
        move lfa1-land1 to t_lfa1-land1.
        move lfa1-name1 to t_lfa1-name1.
        if sy-subrc = 0.
          append t_lfa1.
          clear t_lfa1.
        endif.
      endloop.
    to get vendor country
      loop at t_lfa1.
        select single * from t005t where land1 = t_lfa1-land1 and
                                         SPRAS = 'E'.
        move t005t-landx to t_lfa1-landx.
        if sy-subrc = 0.
          modify t_lfa1.
          clear t_lfa1.
        endif.
      endloop.
      delete adjacent duplicates from t_lfa1.
    *Display----
    *to display header
    data: l_buzei type bseg-buzei.
      loop at t_lfa1.
        write:/1(6) t_bsak-bukrs    color 2,
                7(8) t_bsak-hkont    color 2,
                18(10) t_bsak-lifnr   color 2.
        write:/30(10) t_lfa1-name1.
        write:/30(10) t_lfa1-landx.
        uline.
        loop at t_bsak where lifnr = t_lfa1-lifnr.
          l_wrbtr = t_bsak-wrbtr.
          if t_bsak-wrbtr = t_bsak-skfbt.
            concatenate l_wrbtr '-' into l_wrbtr.
          endif.
         loop at t_data where belnr = t_bsak-belnr and
                               bukrs = t_bsak-bukrs and
                               gjahr = t_bsak-gjahr.
            l_buzei = t_data-buzei.
          endloop.
          write:/15(10) t_bsak-BUDAT no-zero    color 2,
                  26(5) t_bsak-BLART            color 2,
                  30(10) t_bsak-belnr           color 2,
                  42(10) t_bsak-BLDAT           color 2,
                  58(5)  t_bsak-buzei           color 2,
                  63(4)  t_bsak-BSCHL           color 2,
                  75(7)  t_bsak-AUGDT           color 2,
                  84(10) t_bsak-AUGBL           color 2,
                  119(7) t_bsak-WAERS           color 2,
                126(12) t_bsak-WRBTR          color 2.
                  126(12) l_wrbtr               color 2.
          write:/55 t_bsak-sgtxt.
       write:/60(10) t_bsak-hkont,
             80(10) t_bsak-kostl,
             90(30) t_bsak-txt20.
            clear l_wrbtr.
        endloop.
        uline.
        write:/1(6) t_bsak-bukrs    color 2,
               7(8) t_bsak-hkont    color 2,
               18(10) t_bsak-lifnr   color 2.
        uline.
      endloop.
      write:/1(6) t_bsak-bukrs    color 2,
             7(8) t_bsak-hkont    color 2,
            18(10) t_bsak-lifnr   color 2,
            105(5)  t_bsak-waers  color 2.
      line[] = t_bsak[].
      loop at line.
        if line-shkzg = 'H'.
          l_debit = l_debit + line-wrbtr.
        endif.
        if line-shkzg = 'S'.
          l_credit = l_credit + line-wrbtr.
        endif.
      endloop.
      l_balance = l_debit -  l_credit.
      write:115(15) l_debit.   write:135(1) 'D'.
      write:/115(15) l_credit. write:135(1) 'C'.
      for balnce
      write:/90(5) 'Bal.:'.
      write:115(15) l_balance.
      clear: l_debit,l_credit,l_balance.
      uline.
    endform.                    "process_data
    *&      Form  set_page_header
          text
    FORM set_page_header.
      call function 'Z_REPORT_TITLE'
        EXPORTING
          line_size       = sy-linsz
          sy_title        = 'List of Vendor Line Items'
          uline           = 'X'
          first_page_only = ' '.
      write :1(15)  'Allocation'            color col_heading,
             15(10) 'Pstng'         color col_heading,
             25(5)  'Do'             color col_heading,
             30(10) 'Documnet'          color col_heading,
             40(10) 'Doc'        color col_heading,
             50(8)  'BusA'              color col_heading,
             58(5)  'LIm'        color col_heading,
             63(4)  'PK'         color col_heading,
             67(4)  'S'       color col_heading,
             71(4)  'P'       color col_heading,
             75(7)  'Clrg'       color col_heading,
             82(10) 'Clearing'       color col_heading,
             92(20) 'D/c discount Amnt'       color col_heading,
             112(5) 'Rsn'       color col_heading,
             117(2) 'G'       color col_heading,
             119(7)  'Curr-'       color col_heading,
             126(12) 'Amount in'       color col_heading,
             138(2)  'T'       color col_heading.
      write space.
      write :1(15)  'number'            color col_heading,
             15(10) 'date'            color col_heading,
             25(5)  'ty'      color col_heading,
             30(10) 'number'     color col_heading,
             40(18) 'date'         color col_heading,
             58(5)  ''        color col_heading,
             63(4)  ''         color col_heading,
             67(4)  'I'       color col_heading,
             71(4)  'K'       color col_heading,
             75(7)  'date'       color col_heading,
             82(24) 'doc.no'       color col_heading,
             105(20) 'in LC'       color col_heading,
             112(5) 'code'       color col_heading,
             117(2) 'L'       color col_heading,
             119(7) 'ency'       color col_heading,
             126(12) 'doc.curr.'       color col_heading,
             138(2) 'X'       color col_heading.
      write space.
      uline.
    ENDFORM.                    " set_page_header

Maybe you are looking for

  • JSF 1.1 and Tomcat 6

    Hello, I don't know if this issue was already discussed, but I'm porting my application from Tomcat 5.5.25 to Tomcat 6.0.26 and I'm using JSF 1.1. I encountered problems when receiving events for Tree element. The return value for getSelected() metho

  • Not getting response from Client Proxy

    Hi, We are developing a scenario - File->PI->Proxy using ABAP Proxies.We are posting a file thru PI 7.0 to R/3 .In R/3 the server proxy(Inbound Asynchronous) will receive the message and BAPI will be called. The response from the BAPI will be reachin

  • Syncing with Outlook 2007, Vista OS

    Hi. A brief intro before my question. Recently I've tried Outlook for XP on my computer which uses Vista and I wasn't able to sync the Outlook calendar with my curve. I've looked at Outlook 2007 and it is certified for use on Vista so I anticipate my

  • Changed my AD password now cant get into enable !!!

    Hi Changed my AD password and now i cannot get into the enable side of the cisco switches on our network (we have no routers). Looking on the logs for the ACS v4.2 I can see the following - On TACACS+ Accounting you can see the connections which have

  • Any way to Synchronize Metadata?

    Is there a way to sync the metadata from one image to another? Or even better in batch? You know, Something like the button in Camera Raw "Synchronize Settings", which is a big time saver for me. For example: I've tagged an image for a project, down