Entity remove triggering select stmts on private owned relationships

Hi All,
When ever we do an entityManager.remove on an entity and commit, the eclipse link is doing a realAllQuery.execute (Select stmt) on each of the privateOwned entities of the given entity(irrespective of whether they are present or not) before actually deleting them .
This is very much redundant especially if there are large number of entities to delete/cascade delete and each has multiple number of private owned rels - Lots of SELECT SQls , and time taken for these select sqls is very much higher than actual delete stmts. Is there a way to remove the private owned rels without selecting them.
We are using the ecliselink 2.3.1 version.
BTW
This readAllQuery.execute on private owned entitites is triggered during CollectionMapping.recordPrivateOwnedRemovals method of eclipse link during commit.
Any Input or suggestion greatly appreciated.
Thanks,
Sriram

EclipseLink needs to load an object's private owned relationship to delete the objects, otherwise it does not know which objects to delete.
The private owned objects can have their own private owned objects and dependent relationships that need to be deleted as well.
EclipseLink does perform a delete-all optimization for a privately owned OneToMany where the target does not have any dependent relationships (or inheritance/multiple tables/ locking).
This will occur for a simple OneToMany but most have relationships of their own that prevents the optimization.
This optimization can also be configured using the @DeleteAll annotation.
EclipseLink also supports delete cascading on the database, if you have created your foreign key constraint to cascade on delete, or are using EclipseLink to create your schema.
If you use @CascadeOnDelete, then the related objects should not be loaded.
If you still think you have more SQL than you think is correct, please include your object model code, and the SQL log for the delete.

Similar Messages

  • Need advice regarding the use of Private Owned

    Hello,
    We have the following JPA entity objects:
    @Entity
    public class Claim {
    @PrivateOwned
    @OneToMany(mappedBy = "claim", cascade = CascadeType.ALL)
    private List<ClaimLine> claimLineList;
    @Entity
    public class Bill {
    @OneToMany(mappedBy = "bill", cascade = CascadeType.ALL)
    private List<ClaimLine> claimLineList;
    @Entity
    public class ClaimLine {
    @ManyToOne
    @JoinColumn(name = "CLAI_ID", nullable = false)
    private Claim claim;
    @ManyToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "BILL_ID")
    private Bill bill;
    Both Claim and Bill have many-to-one references to ClaimLine. The ClaimLine is Privately Owned by the Claim.
    Note that when a Claim is removed, the entire object graph is discarded, i.e. the Bill and ClaimLine objects are also removed. The Bill can be removed without removing the ClaimLine objects.
    The EclipseLink documentation [ http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_%28ELUG%29#How_to_Use_the_.40PrivateOwned_Annotation ] specifies that:
    "+An object should not be the target in more than one relationship if it is the target in a privately owned relationship.+"
    Question: are we running a risk having the ClaimLine object as target in more than one relationship?
    Thanks.
    Best regards,
    -Sjoerd

    Hello,
    When you remove a Claim entity, you will need to clean up all references other entities might have back to the claim item. Because Claim has a privately owned relationship to ClaimLine, all references to the ClaimLines that are to be deleted also need to be cleaned up, or Bill will be inadvertently left referencing a deleted ClaimLine in the cache. If Bill is removed, references to it must be nulled out - specifically in the ClaimLine, but you have to do this in the application or get a constraint violation on the database anyway.
    The risk with privately owned objects is that they are deleted outside the normal constraint checking rules. That is, if ClaimLine is not marked for deletion but its owning Claim is, ClaimLine will not get deleted until the delete for Claim is processed. That means depending on delete ordering, if Bill is marked for delete, it could get processed first, and so deleted deleted before the Claim + ClaimLine, causing a dependency violation. As long as you are setting the ClaimLine->Bill relation to null you won't get a problem. If you are not, and bills are getting deleted first, you can order the dependencies manually so that Claim is always processed for deletes first using addConstraintDependencies on the Claim descriptor described at: http://wiki.eclipse.org/Using_Advanced_Unit_of_Work_API_%28ELUG%29#How_to_Use_the_addConstraintDependencies_Method_of_the_Descriptor
    Best Regards,
    Chris

  • Remove privately owned object: SQLException: cannot update ... to NULL

    I have a toplink descriptor called ToplinkRelationshipInfo which has a one-to-many mapping to a descriptor called ToplinkRelationshipAttribute. The mapping is privately owned and uses a foreign key from ToplinkRelationshipAttribute.info_id -> ToplinkRelationshipInfo.id. The ToplinkRelationshipAttribute has a one-to-one mapping back to the ToplinkRelationshipInfo.
    The toplink generated Java source for ToplinkRelationshipInfo has a removeFromAttributes method:
    public void removeFromAttributes(ToplinkRelationshipAttribute aToplinkRelationshipAttribute) {
         this.attributes.remove(aToplinkRelationshipAttribute);
         aToplinkRelationshipAttribute.setRelationshipInfo(null);
    }When deleting/removing one of these attributes, if I simply call the above method and then call commit on the unit of work I get a SQLException:
    Internal Exception: java.sql.SQLException: ORA-01407: cannot update ("WC"."WP_RELATIONSHIP_INFO_ATT"."RELATIONSHIP_INFO_ID") to NULL
    I understand that the reason for this is because the removeFromAttributes method is setting the attribute relationshipInfo member to null, which is causing an UPDATE on the attribute record with null on the required relationshipInfoId.
    As suggested in another thread I removed the line that sets the relationshipInfo member to null and I no longer get the exception.
    For maintenance reasons I'd prefer to modify as little generated toplink code as necessary, so I'd rather not have to modify the remove method; otherwise I'll have to go through and modify all these types of methods anytime I generate new Java source.
    So, how come toplink is generating the code that nulls these member variables if they have to be taken out later?
    Is there a way to configure the workbench project so that it does not generate this code, or is it necessary to modify these methods each time I generate the Java source?
    Thanks.

    In a 1-m mapping the relationship is stored in the database by the foreign key of the 1-1 (m-1) back reference. In a typical 1-m relationship if you just remove the object from the collection it will not update the database unless you also set the 1-1 back to null, (as it will still be referencing the old source and the relationship will be out of synch).
    In your case because the 1-m is privately owned and the target will be deleted, it does not need to have the 1-1 updated, so you are correct in removing the code.
    In have logged an enhancement request internally with the MW to have this code improved for private-owned 1-m relationships.
    In general the source code generation of the TopLink Mapping Workbench (or JDeveloper) is meant as a one-time generation for rapid prototyping, it is not required, and not two-way. Typically the object model will be used to provide application specific behavior, so will be maintained by hand after the initial prototype.

  • Remove private owned object

    I have counted a problem to remove a private owned object from database. The object is removed from toplink cache successfully but the database row still exists.
    OfferResult object contains multiple OfferDailyResult objects.
    The attribute in OfferResult:
    mktgElementTkey: String (primary key)
    offerDailyResults: ArrayList
    The attributes in OfferDailyResult:
    mktgElementTkey: String (primary key)
    resultDate: Timestamp (primary key)
    resultValue: String
    I am able to remove any OfferDailyResult object from offerDailyResults collection in application server. But the database row is still sitting in Offer_Daily_Result table.
    Is that because I have a Timestamp attribute in the primary key? How can I solve it?
    I'm using weblogic 9.2 and toplink 10.1.3. Since our application was migrated from lower version toplink to toplink 10.1.3, the old way to turn on sql log doesn't work. Could you also tell me how to turn on the sql log?
    Thanks,

    Here is the peseudo-code of removing OfferDailyResult
    object. I have trouble to turn on the Toplink SQL log
    in version 10.1.3. Could you tell me how to turn on
    it?
    public class OfferResult extends MktgElement {
    String mktgElementTkey;
    ArrayList lnk_TelemktgOfferDailyResult;
    public void removeDailyResult(String
    resultDateStr) {
    TelemktgOfferDailyResult dailyResult =
    this.getTelemktgOfferDailyResult(resultDateStr);
    dailyResult.getResultDate().setNanos(0);
    this.lnk_TelemktgOfferDailyResult.remove(this.getTele
    ktgOfferDailyResult(resultDateStr));
    Thanks,This code doesnt show how you are registering the object and then deleting it. Can you include the transaction code as well-the part where you acquire a unit of work, register the object you want to delete as well ?

  • Reg different kinds of select stmts

    Hi All,
    Hope all are doing gud,
    cud any tell me different kinds of select stmts ????
    regards,
    abc xyz

    hi,
    SELECT
    Basic form
    SELECT result [target] FROM source [where] [GROUP BY fields] [ORDER BY order].
    Effect
    Retrieves an extract and/or a set of data from a database table or view (see Relational database ). SELECT belongs to the OPEN SQL command set.
    Each SELECT command consists of a series of clauses specifying different tasks:
    The SELECT result clause specifies
    whether the result of the selection is a table or a single record,
    which columns the result is meant to have and
    whether the result is allowed to include identical lines.
    The INTO target clause specifies the target area into which the selected data is to be read. If the target area is an internal table, the INTO clause specifies
    whether the selected data is to overwrite the contents of the internal table or
    whether the selected data is to be appended to the contents and
    whether the selected data is to be placed in the internal table all at once or in several packets.
    The INTO clause can also follow the FROM clause.
    You can omit the INTO clause. The system then makes the data available in the table work area (see TABLES ) dbtab . If the SELECT clause includes a "*", the command is processed like the identical SELECT * INTO dbtab FROM dbtab statement. If the SELECT clause contains a list a1 ... an , the command is executed like SELECT a1 ... an INTO CORRESPONDING FIELDS OF dbtab FROM dbtab .
    If the result of the selection is meant to be a table, the data is usually (for further information, see INTO -Klausel ) read line by line within a processing loop introduced by SELECT and concluded by ENDSELECT . For each line read, the processing passes through the loop once. If the result of the selection is meant to be a single record, the closing ENDSELECT is omitted.
    The FROM source clause the source (database table or view ) from which the data is to be selected. It also determines
    the type of client handling,
    the behavior for buffered tables and
    the maximum number of lines to be read.
    The WHERE where clause specifies the conditions which the result of the selection must satisfy. It thus determines the lines of the result table. Normally - i.e. unless a client field is specified in the WHERE clause - only data of the current client is selected. If you want to select across other clients, the FROM clause must include the addition ... CLIENT SPECIFIED .
    The GROUP-BY fields clause combines groups of lines together into single lines. A group is a set of lines which contain the same value for every database field in the GROUP BY clause.
    The ORDER-BY order clause stipulates how the lines of the result table are to be ordered.
    Each time the SELECT statement is executed, the system field SY-DBCNT contains the number of lines read so far. After ENDSELECT , SY-DBCNT contains the total number of lines read.
    The return code value is set as follows:
    SY-SUBRC = 0 At least one line was read.
    SY_SUBRC = 4 No lines were read.
    SY-SUBRC = 8 The search key was not fully qualified.
    (nur bei SELECT SINGLE ). The returned single record is any line of the solution set.
    Example
    Output the passenger list for the Lufthansa flight 0400 on 28.02.1995:
    TABLES SBOOK.
    SELECT * FROM SBOOK
      WHERE
        CARRID   = 'LH '      AND
        CONNID   = '0400'     AND
        FLDATE   = '19950228'
      ORDER BY PRIMARY KEY.
      WRITE: / SBOOK-BOOKID, SBOOK-CUSTOMID,   SBOOK-CUSTTYPE,
               SBOOK-SMOKER, SBOOK-LUGGWEIGHT, SBOOK-WUNIT,
               SBOOK-INVOICE.
    ENDSELECT.
    Performance
    In client/server environments, storing database tables in local buffers (see SAP buffering ) can save considerable amounts of time because the time required to make an access via the network is much more than that needed to access a locally buffered table.
    Notes
    A SELECT command on a table for which SAP buffering is defined in the ABAP/4 Dictionary is normally satisfied from the SAP buffer by bypassing the database. This does not apply with
    - <b>SELECT SINGLE FOR UPDATE
    - SELECT DISTINCT in the SELECT clause ,
    - BYPASSING BUFFER in the FROM clause ,
    - ORDER BY f1 ... fn in the ORDER-BY clause ,
    - aggregate functions in the SELECT clause ,
    - when using IS [NOT] NULL WHERE condition ,</b>
    or if the generic key part is not qualified in the WHERE-Bedingung for a generically buffered table.
    Authorization checks are not supported by the SELECT statement, so you must program these yourself.
    In dialog systems, the database system locking mechanism cannot always guarantee to synchronize the simultaneous access of several users to the same dataset. In many cases, it is therefore advisable to use the SAP locking mechanism .
    Changes to data in a database are only finalized after a database commit (see LUW ). Prior to this, any database update can be reversed by a database rollback (see Programming transactions ). At the lowest isolation level (see the section on the "uncommitted read" under Locking mechanism ), this can result in the dataset selected by the SELECT command not really being written to the database. While a program is selecting data, a second program can add, change or delete lines at the same time. Then, the changes made by the second program are reversed by rolling back the database system. The selection of the first program thus reflects only a very temporary state of the database. If such "phantom data" is not acceptable for a program, you must either use the SAP locking mechanism or at least set the isolation level of the database system to "committed read" (see Locking mechanism ).
    In a SELECT-ENDSELECT loop, the CONTINUE statement terminates the current loop pass prematurely and starts the next.
    If one of the statements in a SELECT ... ENDSELECT loop results in a database commit, the cursor belonging to the SELECT ... ENDSELECT loop is lost and the processing terminates with a runtime error. Since each screen change automatically generates a database commit, statements such as CALL SCREEN , CALL DIALOG , CALL TRANSACTION or MESSAGE are not allowed within a SELECT ... ENDSELECT loop.
    Related OPEN CURSOR , FETCH und CLOSE CURSOR
    SELECT clause
    Variants
    1. <b>SELECT [SINGLE [FOR UPDATE] | DISTINCT] *
    2. SELECT [SINGLE [FOR UPDATE] | DISTINCT] s1 ... sn
    3. SELECT [SINGLE [FOR UPDATE] | DISTINCT] (itab)</b> Effect
    The result of a SELECT statement is itself a table . The SELECT clause describes which columns this table is supposed to have.
    In addition, you can use the optional addition SINGLE or DISTINCT if you want only certain lines of the solution set to be visible for the calling program:
    SINGLE The result of the selection is a single record . If this record cannot be uniquely identified, the first line of the solution set is selected. The addition FOR UPDATE protects the selected record against parallel changes by other transactions until the next database commit occurs (see LUW and Database locking ). If the database system detects a deadlock, the result is a runtime error.
    DISTINCT Any lines which occur more than once are automatically removed from the selected dataset.
    Note
    To ensure that a record is uniquely determined, you can fully qualify all fields of the primary key by linking them together with AND in the WHERE condition.
    Note
    Performance
    The additions SINGLE FOR UPDATE and DISTINCT exclude the use of SAP buffering .
    The addition DISTINCT requires sorting on the database server and should therefore only be specified if duplicates are likely to occur.
    Variant 1
    SELECT [SINGLE [FOR UPDATE] | DISTINCT] *
    Effect
    In the result set, the columns correspond exactly in terms of order, ABAP/4 Dictionary type and length to the fields of the database table (or view ) specified in the FROM clause .
    Example
    Output all flight connections from Frankfurt to New York:
    TABLES SPFLI.
    SELECT * FROM SPFLI
             WHERE
               CITYFROM = 'FRANKFURT' AND
               CITYTO   = 'NEW YORK'.
      WRITE: / SPFLI-CARRID, SPFLI-CONNID.
    ENDSELECT.
    Example
    Output all free seats on the Lufthansa flight 0400 on 28.02.1995:
    TABLES SFLIGHT.
    DATA   SEATSFREE TYPE I.
    SELECT SINGLE * FROM SFLIGHT
                    WHERE
                      CARRID   = 'LH '      AND
                      CONNID   = '0400'     AND
                      FLDATE   = '19950228'.
    SEATSFREE = SFLIGHT-SEATSMAX - SFLIGHT-SEATSOCC.
    WRITE: / SFLIGHT-CARRID, SFLIGHT-CONNID,
             SFLIGHT-FLDATE, SEATSFREE.
    Variant 2
    SELECT [SINGLE [FOR UPDATE] | DISTINCT] s1 ... sn
    Effect
    The order, ABAP/4 Dictionary type and length of the columns of the result set are explicitly defined by the list s1 ... sn . Each si has the form
    ai or ai AS bi .
    Here, ai stands either for
    a field f of the database table or
    a aggregate print.
    bi is an alternative name for the i-th column of the result set.
    When using INTO CORRESPONDING FIELDS OF wa in the INTO clause , you can specify an alternative column name to assign a column of the result set uniquely to a column of the target area.
    An aggregate print uses an aggregate function to group together data from one or all columns of the database table. Aggregate prints consist of three or four components:
    An aggregate function immediately followed by an opening parenthesis DISTINCT (optional) The database field f A closing parenthesis
    All components of a print must be separated by at least one blank.
    The following aggregate functions are available:
    MAX Returns the greatest value in the column determined by the database field f for the selected lines. Specifying DISTINCT does not change the result. NULL values are ignored unless all values in a column are NULL values. In this case, the result is NULL .
    MIN Returns the smallest value in the column determined by the database field f for the selected lines. Specifying DISTINCT does not change the result. NULL values are ignored unless all values in a column are NULL values. In this case, the result is NULL .
    AVG Returns the average value in the column determined by the database field f for the selected lines. AVG can only apply to a numeric field. NULL values are ignored unless all values in a column are NULL values. In this case, the result is NULL .
    SUM Returns the sum of all values in the column determined by the database field f for the selected lines. SUM can only apply to a numeric field. NULL values are ignored unless all values in a column are NULL values. In this case, the result is NULL .
    COUNT Returns the number of different values in the column determined by the database field f for the selected lines. Specifying DISTINCT is obligatory here. NULL values are ignored unless all values in a column are NULL values. In this case, the result is 0
    COUNT( * ) Returns the number of selected lines. If the SELECT command contains a GROUP BY clause , it returns the number of lines for each group. The form COUNT(*) is also allowed.
    If ai is a field f , MAX( f ) , MIN( f ) or SUM( f ) , the corresponding column of the result set has the same ABAP/4 Dictionary format as f . With COUNT( f ) or COUNT( * ) , the column has the type INT4 , with AVG( f ) the type FLTP .
    If you specify aggregate functions together with one or more database fields in a SELECT clause, all database fields not used in one of the aggregate functions must be listed in the GROUP-BY clause . Here, the result of the selection is a table.
    If only aggregate functions occur in the SELECT clause, the result of the selection is a single record. Here, the SELECT command is not followed later by an ENDSELECT .
    Notes
    This variant is not available for pooled tables and cluster tables .
    If the SELECT clause contains a database field of type LCHAR or LRAW , you must specify the appropriate length field immediately before.
    Notes
    Performance
    Specifying aggregate functions excludes the use of SAP buffering .
    Since many database systems do not manage the number of table lines and therefore have to retrieve this at some cost, the function COUNT( * ) is not suitable for checking whether a table contains a line or not. To do this, it is best to use SELECT SINGLE f ... for any table field f .
    If you only want to select certain columns of a database table, you are recommended to specify a list of fields in the SELECT clause or to use a View .
    Examples
    Output all flight destinations for Lufthansa flights from Frankfurt:
    TABLES SPFLI.
    DATA   TARGET LIKE SPFLI-CITYTO.
    SELECT DISTINCT CITYTO
           INTO TARGET FROM SPFLI
           WHERE
             CARRID   = 'LH '       AND
             CITYFROM = 'FRANKFURT'.
      WRITE: / TARGET.
    ENDSELECT.
    Output the number of airline carriers which fly to New York:
    TABLES SPFLI.
    DATA   COUNT TYPE I.
    SELECT COUNT( DISTINCT CARRID )
           INTO COUNT FROM SPFLI
           WHERE
             CITYTO = 'NEW YORK'.
    WRITE: / COUNT.
    Output the number of passengers, the total weight and the average weight of luggage for all Lufthansa flights on 28.02.1995:
    TABLES SBOOK.
    DATA:  COUNT TYPE I, SUM TYPE P DECIMALS 2, AVG TYPE F.
    DATA:  CONNID LIKE SBOOK-CONNID.
    SELECT CONNID COUNT( * ) SUM( LUGGWEIGHT ) AVG( LUGGWEIGHT )
           INTO (CONNID, COUNT, SUM, AVG)
           FROM SBOOK
           WHERE
             CARRID   = 'LH '      AND
             FLDATE   = '19950228'
           GROUP BY CONNID.
      WRITE: / CONNID, COUNT, SUM, AVG.
    ENDSELECT.
    Variant 3
    SELECT [SINGLE [FOR UPDATE] | DISTINCT] (itab)
    Effect
    Works like SELECT [SINGLE [FOR UPDATE] | DISTINCT] s1 ... sn if the internal table itab contains the list s1 ... sn as ABAP/4 source code, and like SELECT [SINGLE [FOR UPDATE] | DISTINCT] * , if itab is empty. The internal table itab can only have one field which must be of type C and cannot be more than 72 characters long. itab must appear in parentheses and there should be no blanks between the parentheses and the table name.
    Note
    With this variant, the same restrictions apply as for SELECT [SINGLE [FOR UPDATE] | DISTINCT] s1 ... sn .
    Example
    Output all Lufthansa flight routes:
    TABLES: SPFLI.
    DATA:   FTAB(72) OCCURS 5 WITH HEADER LINE.
    REFRESH FTAB.
    FTAB = 'CITYFROM'. APPEND FTAB.
    FTAB = 'CITYTO'.   APPEND FTAB.
    SELECT DISTINCT (FTAB)
           INTO CORRESPONDING FIELDS OF SPFLI
           FROM SPFLI
           WHERE
             CARRID   = 'LH'.
      WRITE: / SPFLI-CITYFROM, SPFLI-CITYTO.
    ENDSELECT.
    check this one:
    http://www.sts.tu-burg.de/teaching/sap_r3/ABAP4/select.htm

  • How to convert update,delete statement into select stmt

    Hi all,
         I have a field called dml_stmt, i am getting the dml statement has input from the user.
         My requirement is, if user is giving "update set col_name = 'xyz' from table_name where codition = 'aa'", before updating the table, i need to get old values from the table and put it in the audit table
         For that,i need to convert those update statement into select stmt and need to execute the query to get the data and then i will put it in the audit table..
         can anyone guide how to convert the update or delete stmt into select(need to write in pl/sql)
    Please do needfull things ......
    Regards,
    Jame

    Maybe I'm missing something, but why would auditing help here? It sounds like the user wants to know the prior values of the data, not the SQL UPDATE statement that was issued. Auditing would tell you that a table was updated, fine-grained auditing would tell you what the UPDATE statement was, but you'd need something else to capture the state of the data prior to the update.
    Depending on why putting triggers on every table was discounted, you may also want to take a look at using Workspace Manager or Total Recall (in 11g) to track a history of data changes. But triggers would be the common solution to this sort of problem.
    Justin

  • Privately Owned and Cascade Delete in DB

    HI,
    What is the relationship between setting privately owned in Toplink vs creating a cascade delete in Oracle DB? If I've the cascade delete in DB then what is the advantage of setting the privately owned flag in toplink?
    Thanks

    If you only set the cascade delete option in the database, then TopLink will have no knowledge that the private object was deleted (or that it is private in general). This would mean that TopLink would not remove the private object from the cache or process it as have being deleted. In general this may not cause your app any direct issues if you never read the private object directly as it will eventually garbage collect from the cache.
    Making the relationship privately own in TopLink will also ensure the following:
    - If you replace the private object with another, or set it to null, TopLink will delete the old object on the update of the source. Cascade delete only works on deletion.
    - If the relationship is a 1-m and you remove an object from the collection it will be removed.
    - If you refresh the parent object, by default the child will also be refreshed.
    - If you merge the parent object, by default the child will also be merged.

  • Private owned delete not working

    Hi
    I am stumped by a problem trying to delete a child object from a parent's collection.
    I have set Private Owned on for the 1-many mapping, but when I remove the privately owned child from the parent and commit, no DELETE SQL is produced. The only difference from classes that I can delete by removing from the parent is that my child class does not specify direct-mapped primary keys, but rather references to the parent objects:
    public class ServiceAsset extends ServiceAssetValue implements Ownable {
         private Service service;
         private AssetType assetType;
    Here are the steps I use to remove the child:
    public void delete(AssetType assetTypeProto, Service serviceProto) throws PersistenceException {
         Service service = (Service)TopLinkSession.getServerSessionInstance().acquireClientSession().readObject(serviceProto);
         AssetType assetType = (AssetType)TopLinkSession.getServerSessionInstance().acquireClientSession().readObject(assetTypeProto);
         this.getWriteSession().logMessages();
         ServiceAsset serviceAsset = new ServiceAsset();
         serviceAsset.setService(service);
         serviceAsset.setAssetType(assetType);
         serviceAsset = (ServiceAsset)TopLinkSession.getServerSessionInstance().acquireClientSession().readObject(serviceAsset);
         ServiceAsset workingCopyServiceAsset = (ServiceAsset)getUnitOfWork().registerExistingObject(serviceAsset);
         Service workingCopyService = (Service)getUnitOfWork().registerExistingObject(service);
         workingCopyService.getServiceAssets().remove(workingCopyServiceAsset);
         this.getUnitOfWork().printRegisteredObjects();
         commit();
    Here is the mapping specification in the parent descriptor:
    <database-mapping>
    <attribute-name>serviceAssets</attribute-name>
    <read-only>false</read-only>
    <reference-class>com.xxxx.ServiceAsset</reference-class>
    <is-private-owned>true</is-private-owned>
    <uses-batch-reading>false</uses-batch-reading>
    <indirection-policy>
    <mapping-indirection-policy>
    <type>oracle.toplink.internal.indirection.TransparentIndirectionPolicy</type>
    </mapping-indirection-policy>
    </indirection-policy>
    <container-policy>
    <mapping-container-policy>
    <container-class>oracle.toplink.indirection.IndirectList</container-class>
    <type>oracle.toplink.internal.queryframework.ListContainerPolicy</type>
    </mapping-container-policy>
    </container-policy>
    <source-key-fields>
    <field>SERVICES.SERVICEID</field>
    </source-key-fields>
    <target-foreign-key-fields>
    <field>SERVICEASSETS.SERVICEID</field>
    </target-foreign-key-fields>
    <type>oracle.toplink.mappings.OneToManyMapping</type>
    </database-mapping>
    Is there an obvious mistake I am making?
    James
    p.s. The debug output from Toplink is
    ServerSession(9727266)--client acquired
    ClientSession(26675936)--Execute query ReadObjectQuery(com.xxx.ServiceAsset)
    ClientSession(23126121)--acquire unit of work: 21690871
    UnitOfWork(21690871)--Register the existing object com.xxx.ServiceAsset@12d26d2
    UnitOfWork(21690871)--Register the existing object com.xxx.AssetType@43487e
    UnitOfWork(21690871)--Register the existing object com.xxx.Service@4a96a
    UnitOfWork(21690871)--Register the existing object com.xxx.ServiceProvider@974600
    UnitOfWork(21690871)--Register the existing object com.xxx.Application@c3e967
    UnitOfWork(21690871)--Register the existing object com.xxx.Domain@1b963c4
    UnitOfWork(21690871)--Register the existing object com.xxx.Service@4a96a
    UnitOfWork(21690871)--Register the existing object com.xxx.DomainUrl@1ef3ccd
    UnitOfWork(21690871)--Register the existing object com.xxx.Domain@1b963c4
    UnitOfWork(21690871)--Register the existing object com.xxx.StatusType@166aab6
    UnitOfWork(21690871)--Register the existing object com.xxx.Service@4a96a
    UnitOfWork(21690871)--Register the existing object com.xxx.ServiceAsset@12d26d2
    UnitOfWork(21690871)--Register the existing object com.xxx.ServiceAsset@f77511
    UnitOfWork(21690871)--Register the existing object com.xxx.AssetType@2eef15
    UnitOfWork(21690871)--Register the existing object com.xxx.Service@4a96a
    UnitOfWork(21690871)--Register the existing object com.xxx.ServiceAsset@a974c7
    UnitOfWork(21690871)--Register the existing object com.xxx.AssetType@3526cf
    UnitOfWork(21690871)--Register the existing object com.xxx.Service@4a96a
    UnitOfWork(21690871)--Register the existing object com.xxx.ServiceAsset@150f0a7
    UnitOfWork identity hashcode: 21690871
    Deleted Objects:
    All Registered Clones:
    Key: [111] Identity Hash Code:4521906 Object: com.xxx.Domain@44ffb2
    Key: [2] Identity Hash Code:22185277 Object: com.xxx.AssetType@152853d
    Key: [1] Identity Hash Code:24431393 Object: com.xxx.ServiceProvider@174cb21
    Key: [1 11] Identity Hash Code:22007194 Object: com.xxx.ServiceAsset@14fcd9a
    Key: [653] Identity Hash Code:25228613 Object: com.xxx.DomainUrl@180f545
    Key: [1] Identity Hash Code:21789336 Object: com.xxx.AssetType@14c7a98
    Key: [0] Identity Hash Code:1079807 Object: com.xxx.Application@1079ff
    Key: [R] Identity Hash Code:22129680 Object: com.xxx.StatusType@151ac10
    Key: [11] Identity Hash Code:954895 Object: com.xxx.Service@e920f
    Key: [2 11] Identity Hash Code:2547660 Object: com.xxx.ServiceAsset@26dfcc
    Key: [5] Identity Hash Code:25619834 Object: com.xxx.AssetType@186ed7a
    Key: [5 11] Identity Hash Code:20050612 Object: com.xxx.ServiceAsset@131f2b4
    New Objects:
    UnitOfWork(21690871)--begin unit of work commit
    ServerSession(9727266)--Connection(9256290)--TopLink, version: OracleAS TopLink
    - 10g (9.0.4.2) (Build 040311)
    ServerSession(9727266)--Connection(9256290)--connecting session: Default
    ServerSession(9727266)--Connection(9256290)--connecting(DatabaseLogin(
    platform=>Oracle9Platform
    user name=> "xxx"
    datasource URL=> "jdbc:oracle:thin:@kfir.xxx.com:1521:ORTD"
    ClientSession(30940873)--client released
    ClientSession(30227927)--client released
    ClientSession(26675936)--client released
    ServerSession(9727266)--Connection(9256290)--Connected: jdbc:oracle:thin:@kfir.xxxxx.com:1521:ORTD
    User: xxxxxx
    Database: Oracle Version: Oracle9i Release 9.2.0.1.0 - Production
    JServer Release 9.2.0.1.0 - Production
    Driver: Oracle JDBC driver Version: 9.2.0.1.0
    ClientSession(23126121)--Connection(9256290)--begin transaction
    UnitOfWork(21690871)--Execute query WriteObjectQuery(com.xxx.Application@1079ff)
    UnitOfWork(21690871)--Execute query WriteObjectQuery(com.xxx.AssetType@152853d)
    UnitOfWork(21690871)--Execute query WriteObjectQuery(com.xxx.AssetType@14c7a98)
    UnitOfWork(21690871)--Execute query WriteObjectQuery(com.xxx.AssetType@186ed7a)
    UnitOfWork(21690871)--Execute query WriteObjectQuery(com.xxx.ServiceProvider@174cb21)
    UnitOfWork(21690871)--Execute query WriteObjectQuery(com.xxx.StatusType@151ac10)
    UnitOfWork(21690871)--Execute query WriteObjectQuery(com.xxx.Service@e920f)
    UnitOfWork(21690871)--Execute query WriteObjectQuery(com.xxx.DomainUrl@180f545)
    UnitOfWork(21690871)--Execute query WriteObjectQuery(com.xxx.Domain@44ffb2)
    UnitOfWork(21690871)--Execute query WriteObjectQuery(com.xxx.ServiceAsset@131f2b4)
    UnitOfWork(21690871)--Execute query WriteObjectQuery(com.xxx.ServiceAsset@26dfcc)
    UnitOfWork(21690871)--Execute query WriteObjectQuery(com.xxx.ServiceAsset@14fcd9a)
    ClientSession(23126121)--Connection(9256290)--commit transaction
    ServerSession(9727266)--Connection(9256290)--disconnect
    UnitOfWork(21690871)--end unit of work commit
    UnitOfWork(21690871)--release unit of work

    James
    I have revised the code to show that the ServiceAsset is included in the cache Service object's collection, the Service working copy's collection acquired through the UOW before the remove() call, and still exists after the remove() call. I also show that at all times the ServiceAsset's service is never set to null, by accessing the Service's collection via the ServiceAsset.
    What is the remove() method actually doing, if Service specifies serviceAssets as java.util.Collection, serviceAssets get instantiated as new java.util.ArrayList, and MW specifies IndirectList for indirection?
    The wierd thing is that the cached Service object's serviceAsset collection actually grows after the remove() is called on the working copy.
    Thanks if you can offer any further ideas.
    James
    public void delete(AssetType assetTypeProto, Service serviceProto) throws PersistenceException {
         ServerSession ss = (ServerSession)SessionManager.getManager().getSession("Default");
         ClientSession cs = ss.acquireClientSession();
         UnitOfWork uow = cs.acquireUnitOfWork();
         Service service = (Service)cs.readObject(serviceProto);
         for (Iterator it =service.getServiceAssets().iterator(); it.hasNext(); ) {
              ServiceAsset sa = (ServiceAsset)it.next();
              System.out.println(sa.getService().getServiceId() + " | " + sa.getAssetType().getAssetTypeId());
         AssetType assetType = (AssetType)cs.readObject(assetTypeProto);
         uow.logMessages();
         ServiceAsset serviceAsset = new ServiceAsset();
         serviceAsset.setService(service);
         serviceAsset.setAssetType(assetType);
         serviceAsset = (ServiceAsset)cs.readObject(serviceAsset);
         System.out.println("ServiceAsset to delete: serviceId: " + serviceAsset.getService().getServiceId() + " and assetTypeId: " + serviceAsset.getAssetType().getAssetTypeId());
         System.out.println("Does ServiceAsset to delete exist in Service collection? " + serviceAsset.getService().getServiceAssets().contains(serviceAsset));
         System.out.println("Does ServiceAsset to delete exist in Service collection again? " + service.getServiceAssets().contains(serviceAsset));
         ServiceAsset workingCopyServiceAsset = (ServiceAsset)uow.registerExistingObject(serviceAsset);
         Service workingCopyService = (Service)uow.registerExistingObject(service);
         System.out.println("ServiceAsset Working Copy to delete: serviceId: " + workingCopyServiceAsset.getService().getServiceId() + " and assetTypeId: " + workingCopyServiceAsset.getAssetType().getAssetTypeId());
         System.out.println("Does ServiceAsset Working Copy to delete exist in Service Working Copy collection? " + workingCopyServiceAsset.getService().getServiceAssets().contains(workingCopyServiceAsset));
         System.out.println("Does ServiceAsset Working Copy to delete exist in Service Working Copy collection again? " + workingCopyService.getServiceAssets().contains(workingCopyServiceAsset));
         workingCopyService.getServiceAssets().remove(workingCopyServiceAsset);
         System.out.println("Does ServiceAsset Working Copy to delete exist in Service Working Copy collection? " + workingCopyServiceAsset.getService().getServiceAssets().contains(workingCopyServiceAsset));
         System.out.println("Does ServiceAsset Working Copy to delete exist in Service Working Copy collection again? " + workingCopyService.getServiceAssets().contains(workingCopyServiceAsset));
         uow.commit();
         service = (Service)cs.readObject(serviceProto);
         for (Iterator it =service.getServiceAssets().iterator(); it.hasNext(); ) {
              ServiceAsset sa = (ServiceAsset)it.next();
              System.out.println(sa.getService().getServiceId() + " | " + sa.getAssetType().getAssetTypeId());
    ServerSession(9089012)--client acquired
    ClientSession(11633812)--acquire unit of work: 22482780
    ClientSession(11633812)--Execute query ReadObjectQuery(com.xxx.ce
    ntral.Service)
    11 | 1
    11 | 2
    11 | 5
    ClientSession(11633812)--Execute query ReadObjectQuery(com.xxx.ce
    ntral.AssetType)
    ClientSession(11633812)--Execute query ReadObjectQuery(com.xxx.ce
    ntral.ServiceAsset)
    ServiceAsset to delete: serviceId: 11 and assetTypeId: 5
    Does ServiceAsset to delete exist in Service collection? true
    Does ServiceAsset to delete exist in Service collection again? true
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.ServiceAsset@773d03
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.AssetType@da5bc0
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.Service@6f19d5
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.ServiceProvider@4a0ac5
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.Application@12cd8d4
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.Domain@15da7d
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.Service@6f19d5
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.DomainUrl@34f445
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.Domain@15da7d
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.StatusType@d8c3ee
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.Service@6f19d5
    ServiceAsset Working Copy to delete: serviceId: 11 and assetTypeId: 5
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.ServiceAsset@c707c1
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.AssetType@19ccb73
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.Service@6f19d5
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.ServiceAsset@15b6aad
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.AssetType@12e7cb6
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.Service@6f19d5
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.ServiceAsset@773d03
    UnitOfWork(22482780)--Register the existing object com.xxx.centra
    l.ServiceAsset@1f1e666
    Does ServiceAsset Working Copy to delete exist in Service Working Copy collectio
    n? true
    Does ServiceAsset Working Copy to delete exist in Service Working Copy collectio
    n again? true
    Does ServiceAsset Working Copy to delete exist in Service Working Copy collectio
    n? true
    Does ServiceAsset Working Copy to delete exist in Service Working Copy collectio
    n again? true
    UnitOfWork(22482780)--begin unit of work commit
    ServerSession(9089012)--Connection(12832866)--TopLink, version: OracleAS TopLink
    - 10g (9.0.4.2) (Build 040311)
    ServerSession(9089012)--Connection(12832866)--connecting session: Default
    ServerSession(9089012)--Connection(12832866)--connecting(DatabaseLogin(
    platform=>Oracle9Platform
    user name=> "skynetdev"
    datasource URL=> "jdbc:oracle:thin:@kfir.xxx.com:1521:ORTD"
    ServerSession(9089012)--Connection(12832866)--Connected: jdbc:oracle:thin:@kfir.
    surfkitchen.com:1521:ORTD
    User: SKYNETDEV
    Database: Oracle Version: Oracle9i Release 9.2.0.1.0 - Production
    JServer Release 9.2.0.1.0 - Production
    Driver: Oracle JDBC driver Version: 9.2.0.1.0
    ClientSession(11633812)--Connection(12832866)--begin transaction
    UnitOfWork(22482780)--Execute query WriteObjectQuery(com.xxx.cent
    ral.Application@14f5021)
    UnitOfWork(22482780)--Execute query WriteObjectQuery(com.xxx.cent
    ral.AssetType@fd9b97)
    UnitOfWork(22482780)--Execute query WriteObjectQuery(com.xxx.cent
    ral.AssetType@f12b72)
    UnitOfWork(22482780)--Execute query WriteObjectQuery(com.xxx.cent
    ral.AssetType@1bdbf9d)
    UnitOfWork(22482780)--Execute query WriteObjectQuery(com.xxx.cent
    ral.ServiceProvider@1092447)
    UnitOfWork(22482780)--Execute query WriteObjectQuery(com.xxx.cent
    ral.StatusType@1277a30)
    UnitOfWork(22482780)--Execute query WriteObjectQuery(com.xxx.cent
    ral.Service@91520)
    UnitOfWork(22482780)--Execute query WriteObjectQuery(com.xxx.cent
    ral.DomainUrl@90ed81)
    UnitOfWork(22482780)--Execute query WriteObjectQuery(com.xxx.cent
    ral.Domain@bb6255)
    UnitOfWork(22482780)--Execute query WriteObjectQuery(com.xxx.cent
    ral.ServiceAsset@b890dc)
    UnitOfWork(22482780)--Execute query WriteObjectQuery(com.xxx.cent
    ral.ServiceAsset@46a09b)
    UnitOfWork(22482780)--Execute query WriteObjectQuery(com.xxx.cent
    ral.ServiceAsset@ce3b62)
    ClientSession(11633812)--Connection(12832866)--commit transaction
    ServerSession(9089012)--Connection(12832866)--disconnect
    UnitOfWork(22482780)--end unit of work commit
    UnitOfWork(22482780)--release unit of work
    ClientSession(11633812)--Execute query ReadObjectQuery(com.xxx.ce
    ntral.Service)
    11 | 1
    11 | 2
    11 | 5
    11 | 5
    ServerSession(9089012)--client acquired
    ClientSession(4496124)--Execute query ReadObjectQuery(com.xxx.cen
    tral.Service)
    10-Jun-2004 14:59:17 org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnN
    ull=true
    ClientSession(11633812)--client released
    ClientSession(4496124)--client released

  • Deploying iworks suite when ipad will become privately owned in future

    I have a mix of privately owned and school owned ipads that are supervised by my MDM.
    The school owned ipads will become privately owned ipads in several years.
    As part of the supervision users can't install their own apps, can not remove apps.
    They can sign into iTunes.
    Apps are deployed from the MDM.
    Is there a way I can deploy iworks using tokens to the school owned ipads which will still allow the ipads to have iworks installed by the owners of the ipads when they are no longer school owned. To clarify, I want users in several years time when the MDM no longer has control of the ipads to be able to install iworks, but until then I want to control the installation.
    With the privately owned ipads can I send deploy iworks but allow the users to activate the account using there own iTunes accounts?
    Is this also the way forward for the school owned ipads.

    @To the OP:
    I own a X-Fi Elite Pro for the past 8 years now.
    Since there, this card has faithfullly seen me through 3 major PC upgrades.
    I'm currently at a point where, very sadly, much of what you've described is also weighing on my decision to not go for a Z line.
    @Creative:
    I do hope you're listening and can come up with a solution to a simply design feature - namely a fully working Stereo Surround, like the one that was available in the X-Fi line of cards via CMSS-3D.
    Regards,

  • How to improve select stmt performance without going for secondary index

    Hi friends,
    I have a select statement which does not contains key fields(Primary index) in where condition. And I have to improve that select stmt performance without going for the secondary indexes.
    Can you plese suggest the alternative way for this?.
    Thanks in advance,
    Ramesh.

    Hi,
    If , possible create a secondary index opf your own But if you have restriction on this, try to arrange the fields in where clause in the same order as they appear in the very table.
    This will help the performance a bit.
    Another issue, If your table doesn't contain any critical data or data in them are not updated frequently, you may go for Bufferring . it is a good alternate of Indexing with above limitations.
    For details in bufferring , check, and all the sublinks.
    [concept of buffering|http://help.sap.com/saphelp_nw04/helpdata/en/cf/21f244446011d189700000e8322d00/content.htm]
    Regards,
    Anirban

  • Private Owned, Conform Results in Unit Of Work, ...

    I'd like to have some precision on Private Owned, Conform Results in Unit Of Work, Use joining, Use Batch Reading, ...
    Thank in advance

    Think of Private Owned as "if I delete the source, should I delete the target". So if you have a 1-1 between Customer and Address, if you delete a customer, should you delete their associated address automatically? If so, then it's private owned.
    If you have a 1-M, say a Manager has 1-M to ManagedEmployees, if you remove a ManagedEmployee from a manager, should it be deleted from the database? Probably not, you may simply be assigning them to another Manager... So, it's probably not private owned.
    Don't use the Conform Results in Unit Of Work in the mapping work bench, that sets up a default behavior for queries on that class, and I prefer to set it as needed, not globally. Conforming a query is unit of work related. Imagine you have a UnitOfWork and then query for all Customers from "Ottawa". Imagine you get back 5 from the database. Then in the unit of work you change one of the customers from "Ottawa" to "Kanata". Then you query the unit of work again (before committing) to find all customers in "Ottawa". The default behavior of TopLink would be to return the customer that has moved to "Kanata", because as far as the database is concerned you haven't committed the change, so he's still technically in Ottawa. If you turned on conforming for that class, or for the specific query, then you would NOT get the customer that moved (at a performance cost, of course).
    The docs on Join/Batch reading are pretty good, see 6-6 of the Using TopLink manual in the optimization section. The option in the mapping workbench lets you setup defaults for the relationship, but again, my preference has always been to set it on a per query basis... This gives you a way to centralize the default behavior for batching and joining for certain relationships.
    - Don

  • Use of Select stmts with Update stmts

    Hi,
    I want to execute the following update stmt...
    UPDATE Test1_tab a
    SET a.invpln_seq_no = (SELECT b.seq_no
    FROM Test2_tab b
    WHERE b.contract_id = a.contract_id
    AND b.date_from = a.period_from_date)
    WHERE a.invpln_seq_no != (SELECT b.seq_no
    FROM Test2_tab b
    WHERE b.contract_id = a.contract_id
    AND b.date_from = a.period_from_date)
    Here the problem is I have used 'SELECT b.seq_no FROM Test2_tab b WHERE b.contract_id = a.contract_id AND b.date_from = a.period_from_date' twice, one in the SET clause and the other one in WHERE clause...But it is the same SELECT stmt...So this same Select stmt runs twice when I run the whole update stmt I guess. Is there a way to do the above update, where it runs the SELECT stmt only once...
    Any input is highly appreciated...
    Thanks And Best Regards,
    /Dinesh...

    Then you can use Merge statement instead.
    try this
    merge into test1_tab t1
    using
    (SELECT a.rowid,b.seq_no SEQ_DEST
    FROM test1_tab a,test2_tab b
    WHERE b.contract_id = a.contract_id
    AND  b.date_from = a.period_from_date
    AND a.invpln_seq_no != b.seq_no) t2
    ON (t1.rowid=t2.rowid)
    WHEN MATCHED THEN
    UPDATE SET t1.invpln_seq_no=t2.seq_destor if you are sure that sno is a unique key with out any duplicates and if you are going to perform one time manual update then you can use an undocumented hint /*+ bypass_ujvc */ to do this.
    *DO NOT include this code if you are about to add it in a production procedure or a function
    UPDATE /*+ bypass_ujvc */ (SELECT a.invpln_seq_no SEQ_SRC,b.seq_no SEQ_DEST FROM test1_tab a,test2_tab  b
    WHERE b.contract_id = a.contract_id
    AND  b.date_from = a.period_from_date
    AND a.invpln_seq_no != b.seq_no)
    SET SEQ_SRC = SEQ_DESTRegards,
    Prazy

  • Remove ":" from select option label(description)

    Hello All
    I have a requirement to remove the select option description (which SAP displays by default from the field label maintained in the data element),
    I thought the best way to achieve that requirement is by passing "space" to the parameter  'I_DESCRIPTION' to the method IF_WD_SELECT_OPTIONS->ADD_SELECTION_FIELD, however, it turned out that SAP still displays the label from the data element inspite of passing space(blank) to the parameter 'I_DESCRIPTION', to overcome this limitation I have created a data element without maintaining any labels this approach worked expect that SAP still displays ":"(colon) as the label, is there any way to get rid of this ":" too?
    As shown above, ":" is still displayed as the label of the date select option. I'm also looking for a way to reduce the distance between the last radio button and the select option, any pointers would be appreciated.
    Thanks for looking into this.
    -Vikram.

    You could use the below methods to recursively scan all elements of the view and set the design of all labels to light.
    method adjust_view .
    * IO_VIEW Importing RefTo IF_WD_VIEW
      data lo_container type ref to cl_wd_uielement_container.
      check io_view is bound.
      lo_container ?= io_view->get_root_element( ).
      process_elements( io_container = lo_container ).
    endmethod.
    method PROCESS_ELEMENTS .
    * IO_CONTAINER Importing RefTo CL_WD_UIELEMENT_CONTAINER
      data lo_container type ref to cl_wd_uielement_container.
      data lt_elements  type        cl_wd_uielement=>tt_uielement.
      data ls_elements  type ref to cl_wd_uielement.
      data lo_lbl       type ref to cl_wd_label.
      lt_elements = io_container->get_children( ).
      loop at lt_elements into ls_elements.
        try.
            lo_container ?= ls_elements.
            process_elements( io_container = lo_container ).
          catch cx_sy_move_cast_error .
            if ls_elements->_definition_name eq 'LABEL'.
              lo_lbl ?= ls_elements.
              lo_lbl->set_design( value = '01' ).
            endif.
        endtry.
      endloop.
    endmethod.

  • Problem in Select stmt in loop

    Hi all,
    Pls provide your suggestions for the following code.
    LOOP at ITAB.
    select * from zxyz into corresponding fields of table ITAB_FINAL
    where fromdate eq date1
              todate eq date2
              MATNR eq ITAB-matnr.
    ENDLOOP.
    My question is that for a particular entry in itab , select stmt is executed and some 5 to 6 line item is selected into itab_final. Now in second loop , again select stmt is executed and again some line item will be selected , BUT will this selection will replace the earlier entry in ITAB_FINAL OR the entry in SUCCESSIVE loop will be APPENDED ?
    Please suggest your valuable suggestion on this problem
    Thanks in advance,
    Regards,
    Vivek

    Hi,
    There is no need to loop if you are using FOR ALL ENTRIES
    select * from zxyz into corresponding fields of table ITAB_FINAL
    for all entries in itab
    where matnr eq itab-matnr
    and fromdate eq date1
    and todate eq date2.

  • Select stmt taking long time.

    Hi,
    This select stmt is taking very long time to execute. Can you please guide me to improve it.
    SELECT LIKPVBELN LIKPLFDAT LIKPKUNNR LIKPKNKLI VBAK~NETWR
              FROM LIKP
              INNER JOIN LIPS ON LIKPVBELN = LIPSVBELN
              INNER JOIN VBAK ON LIPSVGBEL = VBAKVBELN
              INTO CORRESPONDING FIELDS OF TABLE IT_OUTPUT
              WHERE LIKP~LFDAT IN S_LFDAT
                    AND LIKP~KUNNR IN S_KUNNR
                    AND LIKP~LIFSK = P_LIFSK.
    Thanks
    Veni.

    >> SELECT LIKPVBELN LIKPLFDAT LIKPKUNNR LIKPKNKLI VBAK~NETWR
    >> FROM LIKP
    >> INNER JOIN LIPS ON LIKPVBELN = LIPSVBELN
    >> INNER JOIN VBAK ON LIPSVGBEL = VBAKVBELN
    >> INTO CORRESPONDING FIELDS OF TABLE IT_OUTPUT
    >> WHERE LIKP~LFDAT IN S_LFDAT
    >> AND LIKP~KUNNR IN S_KUNNR
    >> AND LIKP~LIFSK = P_LIFSK.
    Based on the select that you have in your post, this is what I see.
    As output, you only need fields from LIKP and only one field from VBAK.
    All your fields on the WHERE clause is on LIKP data.
    You only need LIPS for the Sales document number.
    Can you please make a copy of your program and try this below code?
    It would be interesting to see if the extra vgbel sort would help.
    TYPES:
      BEGIN OF TY_LIKP,
        VBELN TYPE LIKP-VBELN,
        LFDAT TYPE LIKP-LFDAT,
        KUNNR TYPE LIKP-KUNNR,
        KNKLI TYPE LIKP-KNKLI,
        NETWR TYPE VBAK-NETWR,
        VGBEL TYPE LIPS-VGBEL,
      END OF TY_LIKP.
    DATA:
      I_LIKP TYPE STANDARD TABLE OF TY_LIKP
        INITIAL SIZE 0
        WITH HEADER LINE,
      BEGIN OF I_VGBEL OCCURS 0,
        VGBEL TYPE LIPS-VGBEL,
      END OF I_VGBEL,
      BEGIN OF I_VBAK OCCURS 0,
        VBELN TYPE VBAK-VBELN,
        NETWR TYPE VBAK-NETWR,
      END OF I_VBAK.
    FIELD-SYMBOLS:
      <FS_LIKP> TYPE TY_LIKP.
    SELECT LIKP~VBELN LIKP~LFDAT LIKP~KUNNR LIKP~KNKLI LIPS~VGBEL
      INTO CORRESPONDING FIELDS OF TABLE I_LIKP
      FROM LIKP
      JOIN LIPS ON LIPS~VBELN EQ LIKP~VBELN
      WHERE LIKP~LFDAT IN S_LFDAT
      AND   LIKP~KUNNR IN S_KUNNR
      AND   LIKP~LIFSK EQ P_LIFSK.
    IF I_LIKP[] IS NOT INITIAL.
      LOOP AT I_LIKP ASSIGNING <FS_LIKP>.
        CLEAR I_VGBEL.
        I_VGBEL-VGBEL = <FS_LIKP>-VGBEL.
        APPEND I_VGBEL.
      ENDLOOP.
      SORT I_VGBEL.
      DELETE ADJACENT DUPLICATES FROM I_VGBEL.
      IF I_VGBEL[] IS NOT INITIAL.
        SELECT VBELN NETWR INTO TABLE I_VBAK
          FROM VBAK
          FOR ALL ENTRIES IN I_VGBEL
          WHERE VBELN EQ I_VGBEL-VGBEL.
        SORT I_VBAK BY VBELN.
        FREE I_VGBEL.
        LOOP AT I_LIKP ASSIGNING <FS_LIKP>.
            CLEAR I_VBAK.
            READ TABLE I_VBAK WITH KEY VBELN = <FS_LIKP>-VGBEL
                                       BINARY SEARCH.
            IF SY-SUBRC EQ 0.
              <FS_LIKP>-NETWR = I_VBAK-NETWR.
    * Note that you don't need to do the Modify statement here
    * because of the field symbol
            ENDIF.
          ENDIF.
        ENDLOOP.
    * Just ignore I_LIKP-VGBEL from all your reporting needs
      ENDIF.
    ENDIF.

Maybe you are looking for

  • Query on IDOC Ack (STATUS) config in XI for a specific partner comm.

    Hi Experts, Is it possible to configure the IDOC Ack (STATUS.SYSTAT01 message) in XI for a specific partner communication? We want to configure our system like ALEAUD but the message type should be STATUS.SYSTAT01 and the acknowledgment should be sen

  • Kodo 4.0.0EA3 Available

    All, Kodo 4.0.0 EA 3 is now available. Kodo 4 implements the JDO 2 and EJB 3 Persistence specifications. Feel free to download it at: http://www.solarmetric.com/Software/beta/4.0.0EA/ You can find the release notes at: http://solarmetric.com/Software

  • You tube videos continually stick since Flash 11.8 update

    Hi, Since updating to latest version 11.8 I cannot watch You tube videos because they continually stick / freeze. Prior to the update I had no problem. I have Windows 7, 64 bit windows, 32 bit browser, Internet Explorer 10. I have disabled hardware a

  • TS4479 unable to use air stream with Apple TV

    I am unable to play music from my ipad2 on my Apple TV. I am on same wireless network.

  • Intra interface

    Hi Bet no one can solve this one I have a cisco ASA and 2 877 The outside interface is connected to the internet, nothing on the inside The 2 877 are also connected to the internet. I have 2 VPN's that connect to the outside of the ASA. Both tunnels