Getting total on the basis of non-primary key.

Hi Experts,
Iam having an internal table it_ekpo which is having material group(matkl),plant(werks) and net order value(netwr).
My requrement is to get the total sum of NETWR against a particular plant which may have duplicates.
I need to get the plant and total of net order value(netwr) into a internal table to display.
please help me out.

Hi,
Yes it wont give you any output as in AT NEW, AT END etc. the fields values to the right of the key field(means the first field in the intrenal table ,which is also used for sorting) are not accisisble, so to access the values of all the fields to the right of the WERKS should be outside the AT----endat loop.
Moreover SUM functionality wont work on 'netwr' because of the above reason only,so i guess i have given you the code snnipet try to use it , I hope this might help you out.
One correction: rather thna taking the 4rth variable for sum you can print the local variable containing the sum in AT-end -endat loop,rather than appending in the internal table.
PS: WERKS should be the first field in the intrenla table, to sort the table on the basis of werks and to be used in AT-endat. loop.
AT END OF WERKS.
SUM.
ULINE.
WRITE: / 'Sum',
WA_EKPO1-NETWR UNDER WA_EKPO1-NETWR. "value of netwr is not accesible in this
SKIP.
ENDAT.
Pooja

Similar Messages

  • Is there any restriction on the length of all Primary keys in a table

    Hi all,
    Is there any restriction on the length of all Primary keys in a data base table?
    i have some 10 fields as primary key in a DB table and length exceeds 120 and getting a warning.
    Please let me know will there be any problems in future with respect to the same?
    With regards,
    Sumanth

    Well actually there are constraints like
    Total of internal lengths of all primary key columns        1024 Bytes
    Number of primary key columns per table                     512
    For other information about SAP database please refer to http://sapdb.org/sap_db_features.htm  
    Thanks & Regards,
    Vivek Gaur
    Alwayz in high spirits

  • Partition key on non primary key column

    I have scenario where the table has defined non primary key column as "partition key".
    I was wondering how it will affect the purge/archive process if the index and table are using different column (they are not aligned)?
    What should be the solution to this scenario?
    Can I use the non primary key column as partition key? Is this affect purging/archiving or switching -IN or OUT partitions?
    Here is the article which Im following but didn't get the precise answer:
    "When the indexes and the table use the same partitioning function and columns in the same order, the table and index
    are aligned." 
    https://msdn.microsoft.com/en-US/library/ms345146%28v=SQL.90%29.aspx?f=255&MSPPError=-2147217396#sql2k5parti_topic9
    Look at "Index
    Partitioning" and "Defining
    the Partitioning Key" section.
    ZK

    If it non aligned, you cannot do switching in or out.  to switch, you should have aligned partitons.
    Hope it Helps!!

  • Selection criteria based on non-primary key columns in Custom-SQL

    Hi all,
    Could anybody please tell me how to perform a search using non-primary key columns, The query is written in Workbench under Custom Sql --> Read Object. The Query goes something like this
    select * from Employee where firstName like #name
    where firstName is a Non-primary key column.
    The Java Code goes like this
    Employee empm = new Employee();
    empm.setFirstName("John");
    Employee employees = (Employee) session.readObject(empm);
    This does not fetch me any values . I dont want the queries to be written in any java class. Is there Any other way to do it ??

    Hi all,
    Could anybody please tell me how to perform a
    search using non-primary key columns, The query is
    written in Workbench under Custom Sql --> Read
    Object. The Query goes something like this
    select * from Employee where firstName like #name
    where firstName is a Non-primary key column.
    The Java Code goes like this
    Employee empm = new Employee();
    empm.setFirstName("John");
    Employee employees = (Employee)
    session.readObject(empm);
    This does not fetch me any values . I dont want the
    queries to be written in any java class. Is there Any
    other way to do it ??I dont think you have set it up the right way to do what you want to do. You need to click on "Queries" on the Employee Descriptor and then Named Queries and then give a name for a named query and then choose ReadObjectQuery under type and then choose SQL under Format. Enter the custom SQL and then export the project xml file.
    Then in your application logic you have to call this named query the usual way.
    Employee employee = (Employee)session.executeQuery("findEmployeeByName,Employee.class,args);
    where args is a vector containing the name of the Employee.

  • How to make a form using a wizard when the table has no primary key ?

    Hi,
    I want to make a form to update, delete a table. The table has no primary key. The problem is that the Wizard ask for a primary key.
    How to avoid using a primary key ? i mean I don't want to create a primary key if is is possible.
    I would like to use the wizard; is it possible ?
    Thank you for your kind answers.
    Christian

    I believe the key is choosing 'Interactive' as opposed to 'Classic' in the implementation and then you can choose 'Existing Trigger' for the primary key source and it should work to use an existing column as your proimary key.

  • How to get the auto increment integer primary key value of a new record

    I have a DB table that has a auto increment integer primary key, if I insert a new record into it by SQL statement "INSERT INTO...", how can I get the integer primary key value of that newly created record?

    Well maybe someone knows a better method, but one workaround would be to add a dummy field to your table. When a new record is inserted this dummy field will be null. Then you can select your record with SELECT keyField FROM yourTable WHERE dummyField IS NULL. Once you've got the key number, you then update the record with a non-null value in the dummyField. Bit of a bodge, but it should work...
    Another alternative is, instead of using an Autonumbered key field, you could assign your own number by getting the MAX value of the existing keys (with SELECT MAX(keyField) FROM yourTable) and using that number + 1 for your new key. Might be a problem if you have lots of records and frequent deletions though.

  • Get Asset on the basis of PO NO.

    Hi Experts ,
                   Request you to help me out . I have  a Purchase Order Number (PO) .on the the basis of this  PO i want to get a corresponding                        Asset and Sub              Asset Number .
                    Please help me to solve this issue.
                    Regards
                  Om Prakash .

    Hi Vel Muruga      ..
                   Really ! helped me .  ...
                 Thank you very much ...

  • How to get total number of result count for particular key on cluster

    Hi-
    My application requirement is client side require only limited number of data for 'Search Key' form total records found in cluster. Also i need 'total number of result count' for that key present on the custer.
    To get subset of record i'm using IndexAwarefilter and returning only limited set each individual node. though i get total number of records present on the individual node, it is not possible to return this count to client form IndexAwarefilter (filter return only Binary set).
    Is there anyway i can get this number (total result size) on client side without returning whole chunk of data?
    Thanks in advance.
    Prashant

    user11100190 wrote:
    Hi,
    Thanks for suggesting a soultion, it works well.
    But apart from the count (cardinality), the client also expects the actual results. In this case, it seems that the filter will be executed twice (once for counting, then once again for generating actual resultset)
    Actually, we need to perform the paging. In order to achieve paging in efficient manner we need that filter returns only the PAGESIZE records and it also returns the total 'count' that meets the criteria.
    If you want to do paging, you can use the LimitFilter class.
    If you want to have paging AND total number of results, then at the moment you have to use two passes if you want to use out-of-the-box features because LimitFilter does not return the total number of results (which by the way may change between two page retrieval).
    What we currently do is, the filter puts the total count in a static variable and but returns only the first N records. The aggregator then clubs these info into a single list and returns to the client. (The List returned by aggregator contains a special entry representing the count).
    This is not really a good idea because if you have more than one user doing this operation then you will have problems storing more than one values in a single static variable and you used a cache service with a thread-pool (thread-count set to larger than one).
    We assume that the aggregator will execute immediately after the filter on the same node, this way aggregator will always read the count set by the filter.
    You can't assume this if you have multiple client threads doing the same kind of filtering operation and you have a thread-pool configured for the cache service.
    Please tell us if our approach will always work, and whether it will be efficient as compared to using Count class which requires executing filter twice.
    No it won't if you used a thread-pool. Also, it might happen that Coherence will execute the filtering and the aggregation from the same client thread multiple times on the same node if some partitions were newly moved to the node which already executed the filtering+aggregation once. I don't know anything which would even prevent this being executed on a separate thread concurrently.
    The following solution may be working, but I can't fully recommend it as it may leak memory depending on how exactly the filtering and aggregation is implemented (if it is possible that a filtering pass is done but the corresponding aggregation is not executed on the node because of some partitions moved away).
    At sending the cache.aggregate(Filter, EntryAggregator) call you should specify a unique key for each such filtering operation to both the filter and the aggregator.
    On the storage node you should have a static HashMap.
    The filter should do the following two steps while being synchronized on the HashMap.
    1. Ensure that a ConcurrentLinkedQueue object exists in a HashMap keyed by that unique key, and
    2. Enqueue the total number count you want to pass to the aggregator into that queue.
    The parallel aggregator should do the following two steps while being synchronized on the HashMap.
    1. Dequeue a single element from the queue, and return it as a partial total count.
    2. If the queue is now empty, then remove it from the HashMap.
    The parallel aggregator should return the popped number as a partial total count as part of the partial result.
    The client side of the parallel aware aggregator should sum the total counts in the partial result.
    Since the enqueueing and dequeueing may be interleaved from multiple threads, it may be possible that the partial total count returned in a result does not correspond to the data in the partial result, so you should not base anything on that assumption.
    Once again, that approach may leak memory based on how Coherence is internally implemented, so I can't recommend this approach but it may work.
    Another thought is that since returning entire cached values from an aggregation is more expensive than filtering (you have to deserialize and reserialize objects), you may still be better off by running a separate count and filter pass from the client, since for that you may not need to deserialize entries at all, so the cost on the server may be lower.
    Best regards,
    Robert

  • Getting ADFv: Rowkey does not have any primary key attributes

    Hi
    I am using 11.1.1.5.0 version of JDeveloper.
    The ViewObject has DistaccountId,OperatingUnit,PricingCategoryId,PartyId as Primary Key and
    the EntityObject also has DistaccountId,OperatingUnit,PricingCategoryId,PartyId as Primary Key
    and my Table also has the same set of attributes(DistaccountId,OperatingUnit,PricingCategoryId,PartyId) as Primary Key .
    I am getting the following error on Create,Update Operation -
    "<CurrencyRowKeySet> <_computeCurrentRowKey> ADFv: Rowkey does not have any primary key attributes. Rowkey: oracle.jbo.Key[], table: oracle.jbo.server.ViewObjectImpl@6c41af."
    Also,when i choose a row for Update operation,the pop-up that opens up holds the values for some other record.
    Please suggest.

    I'm not too sure but can you check if you have the following text in your page source ?
    selectedRowKeys="#{bindings.<TreeBindingName>.collectionModel.selectedRow}"
    selectionListener="#{bindings.<TreeBindingName>.collectionModel.makeCurrent}"

  • How to see wether the index is a primary key index or not

    hi,
    can anybody let me know how to get wether the index is made on the primary key (i.e primary key index)
    can we do by querying the user_constriants table.
    plz let me know..

    Maran.Viswarayar wrote:
    Vijay,
    Was that different from Anurag's reply?Yes it was. Anurag didn't include the index_name in his query.
    It is possible for the index name to be different from the constraint_name, so if you listed just the primary key constraint names you might decide that a given index was not a "primary key" index because you couldn't find a constraint with the matching name.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.
    "Science is more than a body of knowledge; it is a way of thinking"
    Carl Sagan                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Changing the index type of primary key

    Hi everyone,
    We have a table, which has one clustered index and one non clustered in index(primary). I want to drop the existing clustered index and make the primary key as clustered. Is there any easy way to do that. Will Drop_Existing help on this matter?
    Thanks
    A.G

    1. Drop index that is a clustered
    2. Drop PK consraint
    3. Create PK constraint on the col and make it clusteted
    4. create NCI index on the col which was a clustered before
    DROP INDEX IX_t1 ON dbo.t1
    GO
    ALTER TABLE dbo.t1
    DROP CONSTRAINT PK_t1
    GO
    ALTER TABLE dbo.t1 ADD CONSTRAINT
    PK_t1 PRIMARY KEY CLUSTERED 
    c
    ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    CREATE NONCLUSTERED INDEX IX_t1 ON dbo.t1
    c2
    ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Determining the row id or primary key columns and values genericaly

    Hi There
    Does anyone perhaps know how to determine the rowid of the
    currently selected row in a form, or alternatively the primary
    key values/columns?
    Regards
    Herman

    Hi Tranen,
    you can view the constraints and respective columns by setting the
    Table Shape Properties in the Property Inspector.
    Select (all) the tables on the Diagram you want
    In the Property Inspector,under Constraints -Set the 'Show Constraint Columns' to 'True',
    Set 'Show Constraints' to 'True' .
    Constraints (PK,UK,FK,Check)
    Also Set the 'Show Columns' option to 'False' .This will be under display options in the Property inspector.
    This should modify the Table shape in the diagram as follows:
    <Table name>
    <PK> PKName:Column1,Column2
    <UK>UKName:Column3
    <FK>FKname:Column1
    are you looking for the same?
    Thanks.

  • Insert values in multiple tables. One of the tables has complex primary key.

    Hello, I am using Jdeveloper version 11.1.2.3.0
    I have a table FORM_TYPE and another table Str. The Str table is used to translate strings from the table name which are read from another program from the database and used to generate forms..
    The FORM_TYPE  table has a relation to the STR table via formtype.title_str_id = str.str_id.
    The STR table has a primary key that is depending on mf_language and str_id columns. I generated entity for the STR table but can't insert from the application module new values for some reason... It says the record invalidates its own entity..
    I am trying to create a table that will be editable and will have the columns Description, Name, Str in English, Str in French etc...
    Want to create a Form_Type and in the same time to insert new values for each language... But can't make the inserts of the new STR work..
    Also the    FormType.TITLE_STR_ID has many values null already in the database.
    SELECT FormType.DESCRIPTION,
           FormType.FORM_TYPE_ID,       
           FormType.NAME,
           FormType.PAPER_REPORT_FORMAT,
           FormType.PAPER_REPORT_NAME,
           FormType.TITLE_STR_ID,
           en.str en_str,
           en.str_id,
           en.object_name en_object_name,
           fr.str,
           fr.str_id,
           fr.object_name,
           du.str,
           du.str_id,
           du.object_name,
           bg.str,
           bg.str_id,
           bg.object_name      
    FROM FORM_TYPE FormType,
    (select str.str_id, str.mf_language_id, str.str, str.object_name
    from mf_language ml,  str
    where ml.mf_language_id = str.mf_language_id
    and ml.code ='en') en
      , (select str.str_id, str.str, str.object_name
    from mf_language ml,  str
    where ml.mf_language_id = str.mf_language_id
    and ml.code ='fr') fr,
      (select  str.str_id,   str.str, str.object_name
    from mf_language ml,  str
    where ml.mf_language_id = str.mf_language_id
    and ml.code ='du') du,
      (select  str.str_id,  str.str, str.object_name
    from mf_language ml,  str
    where ml.mf_language_id = str.mf_language_id
    and ml.code ='bg') bg
    WHERE
    formtype.title_str_id = en.str_id and
    formtype.title_str_id = fr.str_id and
    formtype.title_str_id = du.str_id and
    formtype.title_str_id = bg.str_id  

    Tried that I made view links and associations but still can't insert in both tables at once... Could be because the tables aren't having relationship between them or because the STR table has a (STR_ID, MF_LANGUAGE_ID) primary key...

  • Fast Refresh using two non-primary key tables

    Hi,
    I have a materialized view based on two tables with an outer join clause. Both the tables do not have a primary key so I had created materialized view log with row-id on each of them but still I am not able to bring out the fast refresh option for the materialized view. My question is can I have a fast refresh option for materialized view built from two tables without primary keys and having an outer join clause????. If possible please send me some sample scripts for quicker understanding.
    Thanks and Regards,
    Sudhakar

    I was able to create a fast-refreshable MV, on tables without any PK. Unfortunately, I can't complete all the steps since my setup is a multi-master advanced replication (which ABSOLUTELY requires the tables to have PK's). Here are anyway the steps I took. Note that ORA102 is my (definition) master site, and MVDB is my MV site. The tables were created under user HR, and my master group is called "hr_repg". Here are my steps:
    HR on ora102 >create table countries_no_pk as select * from countries;
    Table created.
    HR on ora102 >create table regions_no_pk as select * from regions;
    Table created.
    HR on ora102 >create materialized view log on countries_no_pk with rowid;
    Materialized view log created.
    HR on ora102 >create materialized view log on regions_no_pk with rowid;
    Materialized view log created.
    REPADMIN on ora102 >exec dbms_repcat.suspend_master_activity('hr_repg')
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:02.68
    REPADMIN on ora102 >BEGIN
    2 DBMS_REPCAT.CREATE_MASTER_REPOBJECT (
    3 gname => 'hr_repg',
    4 type => 'TABLE',
    5 oname => 'countries_no_pk',
    6 sname => 'hr',
    7 use_existing_object => TRUE,
    8 copy_rows => FALSE);
    9 END;
    10 /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:05.19
    REPADMIN on ora102 >set timing off
    REPADMIN on ora102 >BEGIN
    2 DBMS_REPCAT.CREATE_MASTER_REPOBJECT (
    3 gname => 'hr_repg',
    4 type => 'TABLE',
    5 oname => 'regions_no_pk',
    6 sname => 'hr',
    7 use_existing_object => TRUE,
    8 copy_rows => FALSE);
    9 END;
    10 /
    PL/SQL procedure successfully completed.
    (note that you ABSOLUTELY need the rowid's in your select statement for an MV with joins):
    MVIEWADMIN on mvdb >CREATE MATERIALIZED VIEW hr.complex_mv refresh fast as
    2 select c.rowid "C_ROW_ID", r.rowid "R_ROW_ID", c.COUNTRY_ID, c.COUNTRY_NAME,
    3 c.REGION_ID, r.REGION_NAME from hr.regions_no_pk@ora102 r, hr.countries_no_pk@ora102 c
    4 where c.region_id = r.region_id (+);
    Materialized view created.
    MVIEWADMIN on mvdb >BEGIN
    2 DBMS_REPCAT.CREATE_MVIEW_REPOBJECT (
    3 gname => 'hr_repg',
    4 sname => 'hr',
    5 oname => 'complex_mv',
    6 type => 'SNAPSHOT',
    7 min_communication => TRUE);
    8 END;
    9 /
    PL/SQL procedure successfully completed.
    REPADMIN on ora102 >BEGIN
    2 DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT (
    3 sname => 'hr',
    4 oname => 'countries_no_pk',
    5 type => 'TABLE',
    6 min_communication => TRUE);
    7 END;
    8 /
    PL/SQL procedure successfully completed.
    (wait when the entries in DBA_REPCATLOG is empty)
    REPADMIN on ora102 >exec dbms_repcat.resume_master_activity('hr_repg')
    Hope that can help you. If that doesn't work, tell us where it bombs.
    Daniel

  • Update Rule routine to get Totals of the key figure

    Hey BW folks....
    i have  a requiremnt in the report wherein I have to get the total salary of all the employees in the cost center. As cost center has many employees I want to calculate total salary of the those employees in tht cost center only.So  basically total salary will be depending the no.of employees in tht cost center.I tried  doing it in query not working. So Wht abap code I will have to write in the update rules to achieve this
    eg:
    |        salary(kf) |  total salary
    cc1           |e1   |   $5000    |  
    |e2   |   $3000    |
    |e3   |  $2000     |
    |-- |--$10,000(for tht cost center only)
    cc2   so on and so forth
    Suggestions will be reciprocated with lots of points
    Nick

    You should try doing it in query; update rule will not guarantee you correct results.
    What is this other KF that you are using to multiply, is it a KF in the cube?
    Try defining a CKF with 'constant selection' on Cost-center, this should give you the total value per cost center for each row (I think). You can then use this in your formula
    sal_kf * other_KF / CKF

Maybe you are looking for