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

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

  • 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

  • Insert problem using a SELECT from table with a index by function TRUNC

    I came across this problem when trying to insert from a select statement, the select returns the correct results however when trying to insert the results into a table, the results differ. I have found a work around by forcing an order by on the select, but surely this is an Oracle bug as how can the select statements value differ from the insert?
    Platform: Windows Server 2008 R2
    Oracle 11.2.3 Enterprise edition
    (I have not tried to replicate this on other versions)
    Here are the scripts to create the two tables and source data:
    CREATE TABLE source_data
      ID                 NUMBER(2),
      COUNT_DATE       DATE
    CREATE INDEX IN_SOURCE_DATA ON SOURCE_DATA (TRUNC(count_date, 'MM'));
    INSERT INTO source_data VALUES (1, TO_DATE('20120101', 'YYYYMMDD'));
    INSERT INTO source_data VALUES (1, TO_DATE('20120102', 'YYYYMMDD'));
    INSERT INTO source_data VALUES (1, TO_DATE('20120103', 'YYYYMMDD'));
    INSERT INTO source_data VALUES (1, TO_DATE('20120201', 'YYYYMMDD'));
    INSERT INTO source_data VALUES (1, TO_DATE('20120202', 'YYYYMMDD'));
    INSERT INTO source_data VALUES (1, TO_DATE('20120203', 'YYYYMMDD'));
    INSERT INTO source_data VALUES (1, TO_DATE('20120301', 'YYYYMMDD'));
    INSERT INTO source_data VALUES (1, TO_DATE('20120302', 'YYYYMMDD'));
    INSERT INTO source_data VALUES (1, TO_DATE('20120303', 'YYYYMMDD'));
    CREATE TABLE result_data
      ID                 NUMBER(2),
      COUNT_DATE       DATE
    );Now run the select statement:
    SELECT id, TRUNC(count_date, 'MM')
    FROM source_data
    GROUP BY id, TRUNC(count_date, 'MM')You should get the following:
    1     2012/02/01
    1     2012/03/01
    1     2012/01/01Now insert into the results table:
    INSERT INTO result_data
    SELECT id, TRUNC(count_date, 'MM')
    FROM source_data
    GROUP BY id, TRUNC(count_date, 'MM');Select from that table and you get:
    1     2012/03/01
    1     2012/03/01
    1     2012/03/01The most recent month is repeated for each row.
    Truncate your table and insert with the following statement and the results should now be correct:
    INSERT INTO result_data
    SELECT id, TRUNC(count_date, 'MM')
    FROM source_data
    GROUP BY id, TRUNC(count_date, 'MM')
    ORDER BY 1, 2;If anyone has encountered this behavior before could you please let me know, I can't see that I am making a mistake as the selects results are correct they should not differ from what is being inserted.
    Edited by: user11285442 on May 13, 2013 5:16 AM
    Edited by: user11285442 on May 13, 2013 6:15 AM

    Hi,
    welcome to the forum. I cannot reproduce the same behavior.
    Could you please post the SQLPlus output while executing all commands, like it has been done by S10390?
    Also post the output of the following command:
    SELECT * FROM v$version;When you put some code or output please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    Formatted code is easier to read.
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Help selecting from records with duplicate fields

    Test_table2 is shown below with the sql to create it.
    I need to:
         Identify duplicate address_keys
            Within that set of duplicate address_keys, select only if HH_Income is the same between the two records and the HH_Age difference is less than 10
               Now the duplicate set matches the necessary criteria, and I want to select from these duplicate address_keys, only the one with the most recent verification date
    The purpose of this is to infer cohabiting couples.  In the large set of data we receive, for each HH_key if the people have the same last name they are all listed under the same HH_Key, but if they do not have same last name but live together, they will be listed as separate households (HH_key) but with the same address_key.  A further validator is if each HH_key reports the same HH_Income and if they are close in age.  We then only want to mail to one of the people, so we choose the one that has the most recent verification date.
    The result I would expect here, using the table I provided, would be
    HH_Key
    Address_Key
    HH_Type
    HH_Income
    Age
    Verification_Date
    1234
    1111
    10
    6
    50
    10-Jun-13
    Can you help?
    HH_Key
    Address_Key
    HH_Type
    HH_Income
    Age
    Verification_Date
    1234
    1111
    10
    6
    50
    10-Jun-13
    5678
    1111
    11
    6
    49
    15-Jun-12
    5544
    2222
    10
    6
    65
    10-Apr-13
    7788
    1111
    3
    3
    25
    10-Jun-13
    9898
    3333
    10
    6
    45
    18-Jun-13
    CREATE TABLE test_table2
        (HH_key varchar(20),
         address_key   varchar(20),
         HH_type varchar(2),
         HH_Income varchar(2),
         HH_age varchar(2),
         Verification_date     Date
    INSERT INTO test_table2
    (HH_Key, Address_key, HH_Type, HH_Income, HH_Age, Verification_date)
    VALUES
    (1234, 1111, 10, 6, 50, '10-Jun-13');
    INSERT INTO test_table2
    (HH_Key, Address_key,HH_Type, HH_Income, HH_Age, Verification_date)
    VALUES
    (5678, 1111, 11, 6, 49, '15-Jun-12');
    INSERT INTO test_table2
    (HH_Key, Address_key,HH_Type, HH_Income, HH_Age, Verification_date)
    VALUES
    (5544, 2222, 10, 6, 65, '10-Apr-13');
    INSERT INTO test_table2
    (HH_Key, Address_key,HH_Type, HH_Income, HH_Age, Verification_date)
    VALUES
    (7788, 1111, 3, 3, 25, '10-Jun-13');
    INSERT INTO test_table2
    (HH_Key, Address_key,HH_Type, HH_Income, HH_Age, Verification_date)
    VALUES
    (9898, 3333, 10, 6, 45, '18-Jun-13');

    I really like the results this gave, because it allows me to create a view now that contains the pair in one record.  Thanks for this response.  I think I did post the result that I was looking for which would be the one record that we would mail to:  Once I create the view with one record for each pair, then I would just need to select the verification date that was greatest with the related data.  Would that be the best approach to take?  The fact that I now have a single record for each pair is excellent!
    The result I would expect here, using the table I provided, would be
    HH_Key
    Address_Key
    HH_Type
    HH_Income
    Age
    Verification_Date
    1234
    1111
    10
    6
    50
    10-Jun-13

  • PROBLEM WITH Select * from table_name with JDBC

    Hello,
    I am using thin driver. The problem that i am having is as
    follows.
    when i execute select * from any_table_name from within java
    code i only get FIRST row back. I am using Employee.java example.
    Is there something else i should do?
    Alex
    null

    Hi Alex,
    I am writing a client application with Java. Everything works
    really well, but - same problem as you had (I know, you solved it
    - that's why I'm writing :) - reading only first column. Actually
    it works fine on its own, but when embedded in my java app -
    that's when I get the first column displayed.
    Also executing "select * from emp;" gives me a sequence of
    numbers (displayed in columns) 20, 30, 30 etc, which are in fact
    present as one of the columns when running this query without
    java.
    I appreciate your help!
    Malgosia
    Alex Korneyev (guest) wrote:
    : Hello,
    : I am using thin driver. The problem that i am having is as
    : follows.
    : when i execute select * from any_table_name from within java
    : code i only get FIRST row back. I am using Employee.java
    example.
    : Is there something else i should do?
    : Alex
    null

  • 4.0 EA1 - Cannot select from table with xmltype

    Hi,
    I have the following table. When doing a select * from horus_owner.horus_objects nothing is shown. This could be reproduced with both 10g and 11g on the database-side.
    Regards,
    Johannes
    -- Wiedergabe von TABLE DDL für Objekt HORUS_OWNER.HORUS_OBJECTS nicht möglich, da DBMS_METADATA internen Generator versucht.
    CREATE TABLE HORUS_OWNER.HORUS_OBJECTS
      ID NUMBER(32, 0) NOT NULL
    , TRE_ID NUMBER(32, 0) NOT NULL
    , WRK_ID NUMBER(32, 0) NOT NULL
    , NAME VARCHAR2(200 BYTE) NOT NULL
    , MOD_TYPE VARCHAR2(10 BYTE) NOT NULL
    , LOCKED_BY VARCHAR2(30 BYTE)
    , PETRI_XML SYS.XMLTYPE
    , AOM_XML SYS.XMLTYPE
    , SHM_XML SYS.XMLTYPE
    , ORG_XML SYS.XMLTYPE
    , ROLE_XML SYS.XMLTYPE
    , MIT_XML SYS.XMLTYPE
    , RUL_XML SYS.XMLTYPE
    , TXT_DATA CLOB
    , CREATED DATE NOT NULL
    , CREATED_BY VARCHAR2(30 BYTE) NOT NULL
    , UPDATED_BY VARCHAR2(30 BYTE)
    , UPDATED DATE
    , SIM_XML SYS.XMLTYPE
    , GLOSSARY_XML SYS.XMLTYPE
    , CONSTRAINT OBJ_PK PRIMARY KEY
        ID
      ENABLE
    LOGGING
    TABLESPACE HORUS_OWNER_DATA
    PCTFREE 10
    INITRANS 1
    STORAGE
      INITIAL 65536
      NEXT 1048576
      MINEXTENTS 1
      MAXEXTENTS UNLIMITED
      BUFFER_POOL DEFAULT
    ) NOCOMPRESS
    XMLTYPE PETRI_XML STORE AS CLOB
    XMLTYPE AOM_XML STORE AS CLOB
    XMLTYPE SHM_XML STORE AS CLOB
    XMLTYPE ORG_XML STORE AS CLOB
    XMLTYPE ROLE_XML STORE AS CLOB
    XMLTYPE MIT_XML STORE AS CLOB
    XMLTYPE RUL_XML STORE AS CLOB
    LOB (TXT_DATA) STORE AS SYS_LOB0000024538C00021$$
      ENABLE STORAGE IN ROW
      CHUNK 8192
      RETENTION
      NOCACHE
      LOGGING 
    XMLTYPE SIM_XML STORE AS CLOB
    XMLTYPE GLOSSARY_XML STORE AS CLOBALTER TABLE HORUS_OWNER.HORUS_OBJECTS
    ADD CONSTRAINT OBJ_UK UNIQUE
      WRK_ID
    , NAME
    , TRE_ID
    ENABLEALTER TABLE HORUS_OWNER.HORUS_OBJECTS
    ADD CONSTRAINT OBJ_TRE_FK FOREIGN KEY
      TRE_ID
    REFERENCES HORUS_OWNER.HORUS_TREE_NODES
      ID
    ENABLEALTER TABLE HORUS_OWNER.HORUS_OBJECTS
    ADD CONSTRAINT AVCON_1243352806_MOD_T_000 CHECK
    (MOD_TYPE
    IN ('EMP', 'ROL', 'ENT', 'OCH', 'XML', 'SHM', 'OSM', 'BUM', 'BOM',
    'BEH', 'KPI', 'RIS', 'SER', 'STR', 'SWO', 'AOM', 'CON', 'GOA', 'BUR'
    , 'BPA', 'RES', 'SIM', 'GLO','TEM', 'SAR'))
    ENABLECREATE UNIQUE INDEX HORUS_OWNER.OBJ_PK ON HORUS_OWNER.HORUS_OBJECTS (ID ASC)
    LOGGING
    TABLESPACE HORUS_OWNER_IDX
    PCTFREE 10
    INITRANS 2
    STORAGE
      INITIAL 65536
      NEXT 1048576
      MINEXTENTS 1
      MAXEXTENTS UNLIMITED
      BUFFER_POOL DEFAULT
    NOPARALLEL
    CREATE INDEX HORUS_OWNER.OBJ_TRE_FK_I ON HORUS_OWNER.HORUS_OBJECTS (TRE_ID ASC)
    LOGGING
    TABLESPACE HORUS_OWNER_IDX
    PCTFREE 10
    INITRANS 2
    STORAGE
      INITIAL 65536
      NEXT 1048576
      MINEXTENTS 1
      MAXEXTENTS UNLIMITED
      BUFFER_POOL DEFAULT
    NOPARALLEL
    CREATE UNIQUE INDEX HORUS_OWNER.OBJ_UK ON HORUS_OWNER.HORUS_OBJECTS (WRK_ID ASC, NAME ASC, TRE_ID ASC)
    LOGGING
    TABLESPACE HORUS_OWNER_IDX
    PCTFREE 10
    INITRANS 2
    STORAGE
      INITIAL 65536
      NEXT 1048576
      MINEXTENTS 1
      MAXEXTENTS UNLIMITED
      BUFFER_POOL DEFAULT
    NOPARALLEL
    CREATE INDEX HORUS_OWNER.OBJ_WRK_FK_I ON HORUS_OWNER.HORUS_OBJECTS (WRK_ID ASC)
    LOGGING
    TABLESPACE HORUS_OWNER_IDX
    PCTFREE 10
    INITRANS 2
    STORAGE
      INITIAL 65536
      NEXT 1048576
      MINEXTENTS 1
      MAXEXTENTS UNLIMITED
      BUFFER_POOL DEFAULT
    NOPARALLEL

    Not sure if this helps, but I was trying to come up with some test cases myself and I noticed some strange behavior.  4 simple test cases:
    SELECT XMLTYPE('<OUTER><INNER>TEST</INNER></OUTER>') FROM DUAL;
    SELECT XMLELEMENT("OUTER", XMLELEMENT("INNER", 'TEST')) FROM DUAL;
    SELECT XMLELEMENT("OUTER", XMLAGG(XMLFOREST('TEST' "INNER"))) FROM DUAL;
    SELECT XMLQUERY('/OUTER' PASSING XMLTYPE('<OUTER><INNER>TEST</INNER></OUTER>') RETURNING CONTENT) FROM DUAL;
    1 and 2 return the xml string in the result grid column.  3 and 4 return (XMLTYPE) with no data in the pop-up editor when double clicking the result.  I changed #3 to:
    SELECT XMLELEMENT("OUTER", XMLFOREST('TEST' "INNER")) FROM DUAL;
    and it returns the XML string.
    I used undo to revert back to my original #3 and it started showing the XML string instead of (XMLTYPE) previously observed.
    I changed my connection to another schema, ran #3 again, and it went back to (XMLTYPE).  I tried to recreate the same behavior using the 2nd schema, but I was unable to get to show the XML string. 
    In any test case where I was getting the (XMLTYPE), I was not able to see data in the pop-up editor.
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production    
    PL/SQL Release 11.2.0.3.0 - Production                                          
    CORE 11.2.0.3.0 Production                                                        
    TNS for HPUX: Version 11.2.0.3.0 - Production                                   
    NLSRTL Version 11.2.0.3.0 - Production 

  • 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 Combobox with only one item

    I'm populating Comboboxes based on selections from other
    comboboxes. I pick up the selection with the 'change' trigger,
    however when you select the top item or if there is only one item,
    the change route doesn't work. So I tried to use the 'click' and
    even the 'close' triggers instead, but they give me an errors when
    I try to access the companion ArrayCollections which hold the IDs
    for the items in the list (as commented in the code). Any ideas how
    to get this to update with just one selection?
    <!-- The first three comboboxes populate the next one in
    the list in a 'drilldown' approach -->
    <mx:ComboBox minWidth="130" maxWidth="130" id="selectSys"
    dataProvider="{sysOps.lastResult.system.data}"
    change="fillComboBox(selectSys, selectSub, 'subsystem',
    subOps, sysIDs, 1)" rowCount="10" />
    <mx:ComboBox minWidth="130" maxWidth="130" id="selectSub"
    dataProvider="{subOps.lastResult.system.data}"
    change="fillComboBox(selectSub, selectDev, 'devices',
    devOps, subIDs, 2)"/>
    <mx:HTTPService id="sysOps" useProxy="false" method="GET"
    result="sysIDs = sysOps.lastResult.system.id as
    ArrayCollection;"
    fault="mx.core.Application.application.handleFault(event);"
    url="
    http://localhost:8080/TomCustodes/rocket"/>
    <mx:HTTPService id="subOps" useProxy="false" method="GET"
    result="subIDs = subOps.lastResult.system.id as
    ArrayCollection;"
    fault="mx.core.Application.application.handleFault(event);"
    url="
    http://localhost:8080/TomCustodes/rocket"/>
    // fill destination combobox based on selection from src
    combobox
    public function fillComboBox(src:ComboBox, dest:ComboBox,
    type:String,
    serv:HTTPService, idArray:ArrayCollection, element:int) :
    void {
    // choose ID from the associated ID array with the same
    selecetedIndex
    // error occurs as the idArray ArrayCollection comes up as
    null
    var selectedID:String = idArray.getItemAt(src.selectedIndex)
    as String;
    var params:Object = {};
    params[type] = type;
    var arg:String = "arg";
    var argList:Array = new Array();
    if (element > 1) {
    var ind:int = selectSys.selectedIndex;
    var sysName:String = sysIDs.getItemAt(ind) as String;
    argList.push(sysName);
    if (element > 2) {
    ind = selectSub.selectedIndex;
    var subName:String = subIDs.getItemAt(ind) as String;
    argList.push(subName);
    argList.push(selectedID);
    params[arg] = argList;
    serv.send(params);
    Thanks!

    I think the way I would go about that is having a result
    function for the HTTPServices and set your array collections how
    you are. Then after they are set I would check to see if the length
    == 1 and if it does then recall your fillComboBox method for the
    next combo box since there isn't a way for the user to change the
    combo box they might as well have the next one already filled out.
    The other approach you could take is after you set your array
    collection to your result add dummy items via
    myAC.addItemAt({label:"Choose one"}, 0); This will ensure the user
    always has an item to change to.

  • Selecting From Column with Long Datatypes

    create table temp
    a long
    insert into temp values ('abc');
    commit;
    select * from temp
    where a = 'abc'
    I am getting the following error while am tring to select a = 'abc';
    ora-00997 : illegal use of LONG datatype
    How can i select values from a column with long datatypes

    insert into temp values ('abc');
    cannot (must not) work, when the column is type long (thats a numeric type!!)
    -> here you get an ora- 00911 errorcode
    that the select doesn't work then should be clear.
    mfg f.humer

  • Select from function with named parameters doesn't work

    Hello,
    I'm trying to execute the next sql statement:
    SELECT mypack.getvalue(user_id => 231, status => 'closed') AS someAlias FROM DUAL;
    I'm getting the next Error:
    Error: ORA-00907: missing right parenthesis
    But the next works fine:
    SELECT mypack.getvalue(231,'closed') AS someAlias FROM DUAL;
    What I'm doing wrong?
    Is there a way to call a Function and return it's result as a single-row query?
    Thanks for any suggestions.

    Thanks for your answers.
    Just want to explain what I want to accomplish:
    I want to create PL/SQL statement which:
    1) Calls Function in named notation way;
    2) Returns a query which contains a single row - a Function result.
    I know in Transact-SQL I can accomplish this the next way:
    DECLARE @return_value INT
    EXEC[myproc]
    @id=2,
    @status='ok',
    @ret_param=@return_value OUTPUT
    SELECT @return_value AS my_return_value
    The last SELECT call returns a query with one row in it.
    How can I do the same in Oracle?
    Thanks a lot!

  • 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

  • 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

Maybe you are looking for