Updation of persistent object

Hi,
I'm using objects persistence. I've created a persistent class and using this for storing data in an index cluster table to use the stored data afterwards.
I've created methods for creating persistent object (using export to database), delete object and read object (using import to database).
But i'm not getting how to use update of existing stored object.
Any help would be appreciated.
Regards
Rajesh

Persistent objects were introduced in ABAP OO in order to replace physical data manipulation via open SQL statements by more abstract OO-typical GET and SET methods for a persistent data object. Has nothing to do with Dequeue/Enqueue.
I recommend reading chapter 3 of [Next Generation ABAP Development|http://www.sappress.com/product.cfm?account=&product=H1986] for the full story.
Greetings
Thomas

Similar Messages

  • Locking in persistent object

    Hi Experts,
    Does persistent object provide locking mechanism for updating data? If yes, How do I do it?
    Thanks!

    Sure - it's called the Transaction Service. [ABAP - Object Services|http://help.sap.com/saphelp_nw70/helpdata/en/ab/9d0a3ad259cd58e10000000a11402f/frameset.htm]
    Cheers
    Graham Robbo

  • PRO*C에서 OBJECT 예제 프로그램 (PERSISTENT OBJECT)

    제품 : PRECOMPILERS
    작성날짜 : 1998-11-25
    PRO*C에서 object 예제 프로그램 (Persistent object)
    ==================================================
    1. object type, object table를 생성하고, 데이타를 insert
    drop table use_person
    drop type person
    create type person as object (
    name varchar2(60),
    address varchar2(200),
    dob date,
    age number(3,0)
    create table use_person of person
    insert into use_person values (
    person('John Smith', '1 Somewhere', '10-jan-66', 32)
    insert into use_person values (
    person('Susan Jones', '2 Elsewhere', '16-may-72', 26)
    2. OTT를 수행할 source를 생성한다.
    (file명은 ojb_in.typ)
    type person
    3. OTT를 수행하여 person에 대응되는 c struct를 가지고 있는
    obj.h를 생성한다.
    ott intype=obj_in outtype=obj hfile=obj.h userid=scott/tiger
    code=c
    4. 예제 프로그램 <cache_obj.pc>
    #include <stdio.h>
    #include <string.h>
    #include "obj.h"
    /* VARCHAR 처리를 위한 macro. */
    #define TERM(X) ( X.arr[X.len] = '\0' )
    #define SLEN(X) ( X.len = strlen((char *)X.arr) )
    EXEC SQL INCLUDE SQLCA;
    EXEC SQL BEGIN DECLARE SECTION;
    VARCHAR oracleid[20];
    person person_ptr;        / pointer로 선언됨에 주의*/
    person_ind *person_ind_ptr;       
    person_ref *per_ref;
    VARCHAR address[201];
    VARCHAR birthday[21];
    VARCHAR name[61];
    int age;
    EXEC SQL END DECLARE SECTION;
    main()
    char action_str[30];
    EXEC SQL WHENEVER SQLERROR DO o_error(action_str);
    /* Database에 connect */
    strcpy( (char *)oracleid.arr, "scott/tiger" );
    SLEN( oracleid );
    strcpy( action_str, "connecting to d/b" );
    EXEC SQL CONNECT :oracleid;
    * client side object cache를 다루기 위해서는
    * REF를 fetch 하여, 이를 이용하면 된다.
    * REF를 할당하고, FETCH 하기
    strcpy( action_str, "allocating ref");
    EXEC SQL ALLOCATE :per_ref;
    EXEC SQL DECLARE C1 CURSOR FOR
    SELECT REF(p)
    FROM USE_PERSON p
    WHERE NAME = :name;
    strcpy( (char *)name.arr, "John Smith" );
    SLEN(name);
    strcpy( action_str, "opening cursor" );
    EXEC SQL OPEN C1;
    strcpy( action_str, "fetching cursor" );
    EXEC SQL FETCH C1 INTO :per_ref;
    * cache에 있는 object에 대해 DEREF를 수행하고,
    * FOR UPDATE문으로 해당 row에 대해 lock을 건다.
    strcpy( action_str, "fetching object" );
    EXEC SQL OBJECT DEREF :per_ref INTO :person_ptr:person_ind_ptr
    FOR UPDATE;
    /* address, dob 컬럼을 update하기. */
    strcpy( action_str, "getting attributes" );
    EXEC SQL OBJECT GET ADDRESS, DOB FROM :person_ptr:person_ind_ptr
    INTO :address, :birthday;
    TERM(address);
    TERM(birthday);
    printf("\nCurrent address is: %s", (char *)address.arr);
    printf("\nCurrent birthday is: %s", (char *)birthday.arr);
    strcat((char *)address.arr,", Nowhere Town");
    SLEN(address);
    strcpy((char *)birthday.arr,"12-jan-66");
    SLEN(birthday);
    strcpy( action_str, "setting attributes" );
    EXEC SQL OBJECT SET ADDRESS, DOB OF :person_ptr:person_ind_ptr
    TO :address, :birthday;
    /* 변경 내용을 서버에 반영 */
    strcpy( action_str, "marking object as updated" );
    EXEC SQL OBJECT UPDATE :person_ptr;
    strcpy( action_str, "writing update to database" );
    EXEC SQL OBJECT FLUSH :person_ptr;
    * object를 Release한다. 이때 unpin도 같이 수행된다.
    * indicator인 경우에는 unpin 개념이 없다.
    * object의 default DURATION은 transaction이기 때문에
    * commit 이나 rollback을 수행하면 자동으로 unpin 된다.
    * 만약 DURATION=SESSION으로 precompile을 했다면 오브젝트는
    * 프로그램이 끝나거나, RELEASE문을 수행할때까지
    * unpin되지 않는다.
    strcpy( action_str, "unpinning object" );
    EXEC SQL OBJECT RELEASE :person_ptr;
    * Free the REF.
    strcpy( action_str, "freeing ref" );
    EXEC SQL OBJECT FREE :per_ref;
    * commit하여 변경된 내용을 저장한다.
    strcpy( action_str, "committing" );
    EXEC SQL COMMIT;
    * 다음은 object를 만들어 테이블에 insert 하는 방법이다.
    * 즉, Cache에 object를 생성하여 이를 서버에 flush 시키는
    * 방법이다. object를 ref로 선언하는 경우 그 object를
    * return 하는데, persistent object로 선언하였기 때문에
    * (즉, DB에 저장된object table) 이 REF는 DB 의 실제 row와
    * 관련이 있다.
    * REF 할당하기.
    strcpy( action_str, "allocating ref");
    EXEC SQL ALLOCATE :per_ref;
    strcpy( action_str, "creating object" );
    EXEC SQL OBJECT CREATE :person_ptr:person_ind_ptr
    TABLE USE_PERSON
    RETURNING REF INTO :per_ref;
    * object indicator의 각 요소에 NOT NULL을 설정.
    person_ind_ptr->atomic = OCIIND_NOTNULL;
    * object와 indicator에 값을 설정하기
    strcpy( (char *)name.arr, "Richard Mountjoy" );
    SLEN(name);
    strcpy( (char *)address.arr, "7 The Butts, Silchester" );
    SLEN(address);
    strcpy( (char *)birthday.arr, "16-nov-73" );
    SLEN(birthday);
    age = 24;
    strcpy( action_str, "setting attributes" );
    EXEC SQL OBJECT SET NAME, ADDRESS, DOB, AGE
    OF :person_ptr:person_ind_ptr
    TO :name, :address, :birthday, :age;
    person_ind_ptr->NAME = OCI_IND_NOTNULL;
    person_ind_ptr->ADDRESS = OCI_IND_NOTNULL;
    person_ind_ptr->DOB = OCI_IND_NOTNULL;
    person_ind_ptr->AGE = OCI_IND_NOTNULL;
    * insert하기 위해 db에 object를 Flush하기
    strcpy( action_str, "writing object to database" );
    EXEC SQL OBJECT FLUSH :person_ptr;
    strcpy( action_str, "unpinning object" );
    EXEC SQL OBJECT RELEASE :person_ptr;
    strcpy( action_str, "commiting" );
    EXEC SQL COMMIT;
    * REF는 실제 메모리가 할당되는 것이기 때문에, commit
    * 된다 하더라도 메모리가 free되지 않는다. (DURATION이
    * transacetion이라고 하더라도)
    * object를 return한 REF는 DB에 저장되어 있는 object가
    * 유용한지를 보여주는 용도로 사용할 수 있다.
    * 어떤 값이 object에 copy되어 return되는 지는 version
    * precompile option에 의해 결정된다.
    * RECENT (default) : 현재 transaction에서 fetch했다면
    * cache로부터 object를 return 하고,
    * 아닌 경우는 db로 부터fetch를 하게
    * 된다.
    * ANY : 원래 어떤 값을 fetch했는 지에 관계없이 cache에
    * 있는 값을 return 의미
    * LATEST : DB로 부터 refetch
    * 이 sample에서는 object를 release한 상황에서, db로 부터
    * fetch했음을 보이기 위해 VERSION을 LATEST로 설정했다.
    EXEC ORACLE OPTION (VERSION=LATEST);
    strcpy( action_str, "fetching object" );
    EXEC SQL OBJECT DEREF :per_ref INTO :person_ptr:person_ind_ptr;
    * 초기화를 하면 indicator를 check할 필요가 없다.
    name.len = 0;
    address.len = 0;
    birthday.len = 0;
    age = -1;
    strcpy( action_str, "getting attributes" );
    EXEC SQL OBJECT GET NAME, ADDRESS, DOB, AGE
    FROM :person_ptr:person_ind_ptr
    INTO :name, :address, :birthday, :age;
    printf("\n\nAttributes of newly created object are:");
    TERM(name);
    TERM(address);
    TERM(birthday);
    printf("\nName: %s", name.arr);
    printf("\nAddress: %s", address.arr);
    printf("\nBirthday: %s", birthday.arr);
    printf("\nAge: %d", age);
    * Clear up.
    strcpy( action_str, "unpinning object" );
    EXEC SQL OBJECT RELEASE :person_ptr;
    strcpy( action_str, "freeing ref" );
    EXEC SQL OBJECT FREE :per_ref;
    EXEC SQL WHENEVER SQLERROR CONTINUE;
    EXEC SQL ROLLBACK WORK RELEASE;
    printf("\n");
    int o_error( action_str )
    char *action_str;
    int i;
    char error_str[150];
    EXEC SQL WHENEVER SQLERROR CONTINUE;
    for ( i = 0; i < sqlca.sqlerrm.sqlerrml; i++ )
    error_str[i] = sqlca.sqlerrm.sqlerrmc;
    error_str[i] = '\0';
    printf( "\nFailed with following Oracle error while %s:\n\n%s",
    action_str, error_str );
    EXEC SQL ROLLBACK WORK RELEASE;
    exit(1);
    5. 프로그램 수행 결과
    Current address is: 1 Somewhere
    Current birthday is: 10-JAN-66
    Attributes of newly created object are:
    Name: Richard Mountjoy
    Address: 7 The Butts, Silchester
    Birthday: 16-NOV-73
    Age: 24

    Thanks so much, Bob.
    My printer requires that I use the PDF/X-1a:2001 standard for PDF export, which means that it must be Acrobat 4 or later compatibility.
    Also: I don't see how to NOT flatten, when exporting PDF for print; the options for flattening are "low resolution," "medium resolution," or "high resolution"—but there is not an option to NOT flatten. Do you know a work-around for this?

  • Any ideas about creating persistant object during execution?

    As a newbie, I wrote a badly designed applet which is used to share different keys with different devices. Now I got a problem about if the number of devices increased, how to generate new key objects during the execution and store it as a persistant object. I would use a (short) variable to restrict the number of devices and I only know using JCSystem. Transaction to update a byte array. Does anyone has good ideas about this problem?

    Could you explain a little more detail about what you are trying to do? Are you allocating a certain amount of space for keys at install time and setting a limit to this or do you plan to allocate memory at runtime as new devices come along? Do you have some sample code to share that would clarify what you are trying to do?
    I would suggest creating all your data up front and tracking which keys are allocated.
    - Shane

  • Locking with Persistent Objects???

    Hi,
    while updating database with Persistent Objects? does persistent layer takes care of locking the records??
    i am not sure locking mechanism is there!!
    Please suggest

    From help.sap.com:
    If several programs use the Persistence Service to instantiate objects of the same class before one of these programs has changed the state using COMMIT WORK, all the objects will have the same initial state. At present, we have not implemented a Persistence Service lock concept, which would ensure that there was only one transient mapping for each persistent object. So ultimately, ABAP programmers are not really working with persistent objects as such; rather, the Persistence Service makes it appear as if they are.
    Regards
    Marcin

  • How to update ADF VO object to refresh the data in ADF Pivot table

    I need to know how to update the View object so that the date in pivot table is refreshed/updated/filtered.
    here are the steps I performed to create ADF pivot table application using VO at design time.
    1) created a collection in a Data Control (ViewObject in an ApplicationModule) that provides the values I wanted to use for row and column labels as well the cell values (Used the SQL query)
    2) Dragged this collection to the page in which wanted to create the pivot table
    3) In the pivot table data binding editor specified the characteristics of the rows (which attribute(s) should be displayed in header), the columns (likewise) and the cells.
    Now, I have a requirement to update/filter the data in pivot table on click of check box and my question is how to I update the View object so that the date in pivot table is refreshed/updated/filtered.
    I have got this solution from one of the contact in which a WHERE clause on an underlying VO is updated based upon input from a Slider control. In essence, the value of the control is sent to a backing bean, and then the backing bean uses this input to call the "filterVO" method on the corresponding AppModule:
    but, I'm getting "operationBinding" object as NULL in following code. Please let me know what's wrong.
    here is the code
    Our slider component will look like
    <af:selectBooleanCheckbox label="Unit" value="#{PivotTableBean.dataValue}"
    autoSubmit="true" />
    The setDataValue() method in the backing bean will get a handle to AM and will execute the "filterVO" method in that, which takes the NumberRange as the input parameter.
    public void setDataValue(boolean value) {
    DataValue = value;
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = (OperationBinding)bindings.getOperationBinding("filterVO");
    Object result = operationBinding.execute();
    The filterVO method in the AMImpl.java will get the true or false and set the where Clause for the VO query to show values.
    public void filterVO(boolean value) {
    if (value != null) {
    ViewObjectImpl ibVO = getVO1();
    ibVO.setWhereClause("PRODUCT_TOTAL_REVENUE(+) where rownum < 10");
    ibVO.executeQuery();
    }

    Did you define a filterVO action in your pagedef.xml file?
    You might want to read on how to access service method from a JSF Web Application in the ADF Developer Guide for 10.1.3 chapter 8.5

  • How can i get the unitOfWork or the persisting object in to my listener???.

    hi,
    i have a listener class which extends SessionEventAdapter ....as shown below
    public class MyLister extends SessionEventAdapter{
    public void postCommitUnitOfWork(SessionEvent event) {
    System.out.println("POST COMMIT OF WORK");
    // How can i get the unitOfWork or the persisting object in to my listener???
    Another class makes use of this listener by adding the listener into a getEventManager() of a session ....
    public final class AetbProcessStatusClient {
    public static final void main(String[] args)
    {  Project project =   
    XMLProjectReader.read("META- INF/AetbProcessStatus.xml",
    Thread.currentThread().getContextClassLoader());
    DatabaseSession session = project.createDatabaseSession();
    MyLister myListener = new MyLister();
    session.getEventManager().addListener(myListener);
    session.login();
    UnitOfWork uow = session.acquireUnitOfWork();
    uow = session.acquireUnitOfWork();
    Vector vec =
    (Vector)uow.executeQuery("SQFunctionIdProcessStatus", AetbProcessStatus.class);
    AetbProcessStatus processStatus = new AetbProcessStatus();
    processStatus = (AetbProcessStatus)vec.get(0);
    processStatus.setRunStat('E');
    processStatus.setProgramSeqNo(10);
    uow.commit();
    now my question --> How can i get the unitOfWork or the persisting object in to my listener???....
    ie the object "processStatus" into my listener

    The SessionEvent's session (getSession()), should be the UnitOfWork. You can access the UnitOfWork or UnitOfWorkImpl methods to access the objects in the unit of work. getUnitOfWorkChangeSet() will return the changes made in the UnitOfWork.
    -- James : http://www.eclipselink.org

  • Exit CL_HRASR00_POBJ_WF_EXIT triggered exeception for event STATE_CHG and (target) status READY- ERROR EVENT_RAISED - Error updating the process object

    Hi All
    I have set up a simple custom HCM process and Form regarding Infotype TO CREATE AND CHANGE POSITION. I have checked the process and form consistency and it seems fine. Now when I run the process from HRASR_DT it generates a process number but it also gives an error workflow could not start.I get following error (SWIA log - Step history)
    Executing flow work item - Transaction brackets of the workflow has been damaged
    Exception occurred - Error when starting work item 000000007031
    PROCESS_NODE - Error when processing node '0000000014' (ParForEach index 000000)
    CREATE - Error when creating a component of type 'Step'
    CREATE_WIM_HANDLE - Error when creating a work item
    CREATE_VIA_WFM - Exit CL_HRASR00_POBJ_WF_EXIT triggered exeception for event CREATED and (target) status
    EVENT_RAISED - Error updating the process object
    Executing flow work item - Exit CL_HRASR00_POBJ_WF_EXIT triggered exeception for event STATE_CHG and (target) status READY->ERROR
    EVENT_RAISED - Error updating the process object
    Executing flow work item - Transaction brackets of the workflow has been damaged
    Executing flow work item - Work item 000000007031: Object FLOWITEM method EXECUTE cannot be executed
    Executing flow work item - Error when processing node '0000000014' (ParForEach index 000000)
    Points to be noted:
    1) I have searched few SAP notes such as 1384961(Notes for 6.0.4) but our system is in higher level patch 6.0.5
    2) WF-BATCH have SAP_NEW and SAP_ALL authorization.
    Appreciate your valuable suggestions.
    Thanks
    Ragav

    Hi Ragav
    did you try to debug this? maybe something is missing in config of P&F?
    Since you are on 605, the following note would be there in your system....use it to debug:
    1422496 - Debugging background workflow tasks in HCM P&F
    This will help you find the root cause.
    regards,
    modak

  • Switch between transient and persistent objects?

    Hi Folks,
    I'm Re: transient object to persistent to ask this type of question, but couldn't find an answer.
    Using persistent classes, does anyone know an elegant way to convert a transient object to a persistent one and vice versa? There is no standard functionality provided that I can see, and cloning the object results in clashing keys.
    What am I trying to accomplish?
    I need an object instance which <i>may</i> exist in the DB and if not, it <i>may</i> need to be saved for future use. I'm using a table with key fields K1 and K2 and the app will ask for an object instance using the full key K1+K2.
    If the object doesn't find a DB record for K1K2 then it should instantiate itself with values for K1blank. Here is where I'm considering transient in order to provide the app with default functionality defined in record K1+blank.
    If a write access occurs to a transient object then is should become persistent and the K1+K2 record be created.
    Any ideas appreciated.
    Cheers,
    Mike

    Hi Mike,
    I written something similar working on Persistent Objects.
    The only point of attention is that you cannot create a new persistent while a transient is resident in memory.
    This is checked by the OS system during the creation of a new persistent:
    in method CREATE_PERSISTENT of Basis Class, there is a check on the existing object:
    * Precondition   : No object exists with the given business key, neither
    *                  in memory nor on database.
    So, you can create a new transient, fill it with the values you need and then pass this values to the agent to create a new persistent, but only after releasing the existing transient (because they will have the same key).
    I've solved the problem like this:
    METHOD flush.
    "IMPORTING value(im_transient) TYPE REF TO zcl_liquidate_daily_bo
    "IMPORTING value(im_commit) TYPE xfeld
    "IMPORTING value(im_agent) TYPE REF TO zca_liquidate_daily_bo
    "RETURNING value(re_persistent) TYPE REF TO zcl_liquidate_daily_bo
    "--> raised by event PERNR_PROCESSED
      DATA: s_dip_liq TYPE zhr_tm_dip_liq.
      s_dip_liq-zpernr    = im_transient->get_employee_no( ).
      s_dip_liq-zsocmat   = im_transient->get_matricola_legale( ).
      s_dip_liq-zdataev   = im_transient->get_event_date( ).
      s_dip_liq-zcodev    = im_transient->get_event_type( ).
      s_dip_liq-zdescev   = im_transient->get_event_descr( ).
      s_dip_liq-zmotev    = im_transient->get_event_reasn( ).
      s_dip_liq-zmeseall  = im_transient->get_mese_allineamento( ).
      s_dip_liq-zannoall  = im_transient->get_anno_allineamento( ).
    * // Invalidate the transient before create the persistent!
      im_agent->if_os_factory~release( im_transient ).
      CLEAR im_transient.
      IF im_commit EQ abap_true.
        TRY.
    re_persistent =
    im_agent->create_persistent( EXPORTING i_anno_allineamento = s_dip_liq-zannoall
                                                   i_mese_allineamento = s_dip_liq-zmeseall
                                                   i_employee_no       = s_dip_liq-zpernr
                                                   i_event_date        = s_dip_liq-zdataev
                                                   i_event_type        = s_dip_liq-zcodev
                                                   i_event_descr       = s_dip_liq-zdescev
                                                   i_event_reasn       = s_dip_liq-zmotev
                                                   i_matricola_legale  = s_dip_liq-zsocmat ).
          CATCH cx_os_object_existing.
        ENDTRY.
        COMMIT WORK AND WAIT.
      ENDIF.
    ENDMETHOD.
    This method is called inside a loop on a table that containes references to transient objects.
    For each object I perform some tasks, and if all it's ok I raise the event PERNR_PROCESSED, which automatically calls this method FLUSH, transferring the transient to the persistent.
    Return Object is the new persistent, which will be passed back to the internal table, changing the content from the transient to the new persistent.
    Hope this helps,
    Roby.

  • Problem with Persistent Object as Reference Attribute of Persistent Object

    Hello All,
    I have a problem with a persistent class that contains a reference attribute to another persistent class.  I can write the reference object attribute to the DB but when I read the reference attribute back from the DB the object is null.  Allow me to explain...
    I have two tables; one is a data table with one key field of type OS_GUID, the second is a mapping table with several business key fields and two further fields; an instance GUID and a class identifier GUID.  The data table is used to contain all the data for an object.  The mapping table is used to hold a relationship between the GUID assigned in the data table and the business key.  The mapping table has been structured in this way by following the help here:
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/df/e785a9e87111d4b2eb0050dadfb92b/frameset.htm
    and the field mapping in persistent class for the mapping table has been mapped following the help here:
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/06/f23c33638d11d4966d00a0c94260a5/frameset.htm
    The code I use to create entries in the data and mapping table is:
    <-snip->
      DATA:
        gv_blank_data_guid TYPE REF TO zcl_ps_data,
        gv_data_guid       TYPE        os_guid,
        go_data_ps         TYPE REF TO zcl_ps_data,
        go_data_agent      TYPE REF TO zca_ps_data,
        go_data_map_ps     TYPE REF TO zcl_ps_data_map,
        go_data_map_agent  TYPE REF TO zca_ps_data_map,
        go_exc             TYPE REF TO cx_root.
      go_data_agent = zca_ps_data=>agent.
      go_data_map_agent = zca_ps_data_map=>agent.
      TRY.
    Check if there's already data with the business key on the DB
          go_data_map_ps = go_data_map_agent->get_persistent(
                             i_data_ref     = iv_data_ref
                             i_action       = iv_action ).
    ... if there is then exit.
          EXIT.
        CATCH cx_root INTO go_exc.
      ENDTRY.
      TRY.
    Create the data...
          go_data_ps = go_data_agent->create_persistent(
                           i_root_guid = gv_blank_data_guid
                           i_req_date  = iv_req_date ).
          TRY.
    ... finally, write the new data to the data business key map table
              go_data_map_ps = go_data_map_agent->create_persistent(
                                 i_data_ref     = iv_data_ref
                                 i_action       = iv_action
                                 i_data_guid    = go_data_ps ).    "note1
            CATCH cx_root INTO go_exc.
          ENDTRY.
        CATCH cx_os_object_not_found.
      ENDTRY.
      COMMIT WORK.
    <-snip->
    The fact that it is possible to pass the object GO_DATA_PS in the call to GO_DATA_MAP_AGENT (the line that I've put the comment "note1" on) indicates to me that the reference to the data persistent object can be written to the DB by the mapping persistent object.  After executing the above code the mapping table object and class identifier fields are populated.  Also, if multiple entries are written to the tables then the class identifier field in the mapping table is always the same and the object ID is different as expected.
    However, the problem I have is if I read an object from the DB using the business key with the following code:
    <-snip->
      DATA:
        gv_req_date        type        datum,
        gv_data_guid       TYPE        os_guid,
        go_data_ps         TYPE REF TO zcl_ps_data,
        go_data_agent      TYPE REF TO zca_ps_data,
        go_data_map_ps     TYPE REF TO zcl_ps_data_map,
        go_data_map_agent  TYPE REF TO zca_ps_data_map,
        go_exc             TYPE REF TO cx_root.
      go_data_agent = zca_ps_data=>agent.
      go_data_map_agent = zca_ps_data_map=>agent.
      TRY.
    Read data mapping with the business key
          go_data_map_ps = go_data_map_agent->get_persistent(
                             i_data_ref     = iv_data_ref
                             i_action       = iv_action ).
    ... then read the data.
          TRY.
              CALL METHOD go_data_map_ps->get_data_guid
                RECEIVING
                  result = go_data_ps.
            CATCH cx_os_object_not_found.
          ENDTRY.
        CATCH cx_root INTO go_exc.
      ENDTRY.
    <-snip->
    At no point during this code are the attributes of the object of the persistent class for the data table populated with the contents of the fields of the data table referenced as the attribute of the mapping table.  To clarify, when viewing the object in the debugger all the attributes of the mapping object that are simple table fields are populated with the values of the fields of in the mapping table, however, the attributes of the object that represents the persistent class for the data table are not populated with the fields of the data table.  I had hoped that by reading the mapping table object the data object would automatically be populated.  Is there another step I need to perform to populate the data object?
    I'm sorry if the above is hard to follow.  Without being able to provide screenshots it's difficult to explain.
    If someone has managed to store references to persistent objects in a table and then read the references back could you list the steps you went through to create the persistent classes and include the code that reads the objects please?  The code I have almost works, I must be just missing some subtle point...
    Thanks in advance,
    Steve.

    Hi Andrea,
    The iObject being replicated at item level for Service Complaints is the SAP standard behaviour.
    Generally we raise complaint refering to some sales or service issues. In your scenario you are trying to create a complaint based on an iObject, then you have to mention the corresponding product details. I dont see any business requirement not to copy the iObject product at the item level.
    If you want it then I think only you have to write a Z program for it.
    Hope this helps!
    Regards,
    Chethan

  • How to update a ScriptUIGraphics object?

    Hello,
    I've been able to use ScriptUIGraphics, but as far as I've seen there's no way to update / change any object, nor it seems possible to call the onDraw() handler but once if it contains either fillPath() or strokePath() - which usually does.
    For instance, the following test script pops up a panel with a red square in it. Fine. When you click the "Try" button, the onDraw() is fired again and should draw a smaller square, but stops with a very informative "cannot execute" error at some point within the onDraw():
    // ScriptUI graphics update issue
    // resource string
    var winRes = "dialog {  \
        text: 'ScriptUI Graphics test',  \
        margins: 15, \
        alignChildren: 'row', \
        canvas: Panel {  \
            preferredSize: [200, 200], \
            properties: {borderStyle: 'black'} , \
        buttonsGroup: Group{ \
            cancelButton: Button { text: 'Cancel', properties:{name:'cancel'} }, \
            tryButton: Button { text: 'Try', properties:{name:'try'},size: [40,24], alignment:['right', 'center'] }, \
    // Window
    var win = new Window(winRes);
    // define the graphic property
    canvasGraphics = win.canvas.graphics
    // do the drawing
    win.canvas.onDraw = function() {
              // creates a red filled square
              canvasGraphics.newPath()
              canvasGraphics.rectPath(10, 10, 200, 200)
              canvasGraphics.fillPath(canvasGraphics.newBrush(canvasGraphics.BrushType.SOLID_COLOR, [1,0,0,1], 1)) // HERE
    win.buttonsGroup.tryButton.onClick = function() {
              win.canvas.onDraw.call()
    win.show()
    When you run it, it works as expected; if you click the Try button, an error is fired when the script gets to the line ("HERE" in the code), that is: when it comes to fill the path.
    Strangely enough! Because it doesn't seem to be a problem with the onDraw second call (apparently the second square path is constructed, but can't be filled).
    Am I doing something wrong here? Should I first delete the original square (how?!), or somehow initialize it again? Are ScriptUIGraphics immutable somehow?
    --- Update ---
    Further experiments led me to understand that onDraw() (so the whole drawing) seem to be called just once - when the Window is shown. I've tried to remove and rebuild the canvas Panel altogether, but its own new onDraw() is never called - nor an explicit call works. Apparently you can't invoke win.show() again, nor hide and show it. Ouch!
    Thanks in advance for any suggestion
    Davide

    Sorry, I do not understand what do you really want (because of my bad english)
    Try to change the bg color of the panel in the dialog box by clicking on button? Something like this?
    // ScriptUI graphics update issue
    // resource string
    var winRes = "dialog {  \
        text: 'ScriptUI Graphics test',  \
        margins: 15, \
        alignChildren: 'row', \
        canvas: Panel {  \
            preferredSize: [200, 200], \
            properties: {borderStyle: 'black'} , \
        buttonsGroup: Group{ \
            cancelButton: Button { text: 'Cancel', properties:{name:'cancel'} }, \
            tryButton: Button { text: 'Try', properties:{name:'try'},size: [40,24], alignment:['right', 'center'] }, \
    // Window
    var win = new Window(winRes);
    // define the graphic property
    win.canvas.graphics.backgroundColor = win.canvas.graphics.newBrush (win.canvas.graphics.BrushType.SOLID_COLOR, [1,0,0],1);
    win.buttonsGroup.tryButton.onClick = function() { // change the graphic background property by click on Button [try]
    win.canvas.graphics.backgroundColor = win.canvas.graphics.newBrush (win.canvas.graphics.BrushType.SOLID_COLOR, [0,0,1],1);
    win.show()

  • Cloning persistent objects

    Does anyone know if ABAP Persistent Objects support cloning?
    I can clone the object using a SYSTEM-CALL (though I'd rather not), however that would still mean breaking the rules to set the object key to a new value.
    At the moment the only solution appears to be creating a new persistent or transient object via the agent and manually assigning the attributes.

    Thanks Uwe. I knew about the SYSTEM-CALL but in this case it does not help.
    My problem is that the object key of a persistent object does not appear to be easily modified even from within the object. I want to clone the object and then modify the key to avoid insert collisions.
    So far as I can see there is no simple way of modifying the business key of a persistent object.
    For now I've implemented IF_OS_CLONE~CLONE in a public method of my persistent object, created a new persistent object and manually assigned the attributes. Unfortunately the code will have to be modified whenever a new attribute is added.

  • Equality between primitive and persistent objects

    Folks,
    I have discovered by chance that the KODO Query implementation allows me
    to test for equality between an Integer and a persistent object. This is
    actually phenomenally useful because it allows me to easily work around
    some really inefficient auto-generated SQL (see below).
    I couldn't find anything about this feature in the JDO specs. Is it
    accidental? Is it supported, or likely to disappear in future versions?
    Dave Syer.
    # 'bean' is an object already loaded from the persistence store
    javax.jdo.JDOHelper.getObjectId(bean)Bean-101
    # it has one mutable property, which is persistence capable
    # and also a read-only property which is the database id
    # (Integer) of the property:
    javax.jdo.JDOHelper.getObjectId(bean.getProperty())Property-371
    bean.getPropertyId()371
    # get an extent for querying (pm is the PersistenceManager)
    ex=pm.getExtent(Bean,0)# First do a query on property...
    qu=pm.newQuery(ex);
    qu.declareParameters("Property id1");
    qu.setFilter("property == id1")# ...generates SQL with additional unnecessary(?) Cartesian join
    # to PROPERTY table:
    res=qu.execute(bean.getProperty())# resulting SQL:
    # SELECT t0.PROPERTY_ID, t0.PROPERTY_ID FROM BEAN t0, PROPERTY t1
    # WHERE (t0.PROPERTY_ID = 371 AND t0.PROPERTY_ID =
    # t1.PROPERTY_ID)
    # Now do a query on propertyId (Integer)...
    qu=pm.newQuery(ex);
    qu.declareParameters("java.lang.Integer id1");
    qu.setFilter("propertyId == id1")# ...but parameter value is allowed to be a Property -- magically
    # turned into an integer when the SQL is generated:
    res=qu.execute(bean.getProperty())# resulting SQL:
    # SELECT t0.PROPERTY_ID, t0.PROPERTY_ID FROM BEAN t0 WHERE
    # t0.PROPERTY_ID = 371

    It is accidental and unsupported.Is there any other way to get round the 'unnecessary join' issue that I
    mentioned briefly in my original posting? In a real world example, I was
    able to improve performance of a single query by a factor of 100 (and my
    DB experts tell me there was no way to optimise indexes or anything at the
    RDBMS level and achieve the same result).
    DAve.

  • Hashtable with persistent object as key and collection as value

    I am trying to use a Hastable with a persistent object as the key and a
    collection as the value. A long time ago, Abe White said:
    "Kodo currently does not support a map in which the keys are persistent
    objects and the values are collections. I think your best bet would be
    to create an intermediate class that has a 1-1 relation to the "key" and
    a collection of persistent objects for the "value". Then keep a
    collection of these intermediate objects. You could use jdoPostLoad and
    jdoPreStore to hash/unhash the collection of intermediate objects to/from
    a Map if you need to."
    So I made an intermediate class, which gave me a Hashtable with a persistent
    object as the key and another for the value. Then the one for the value
    contains the collection. This works but I'm wondering about the
    performance, would this method be slower?
    Also it was said that version 3.0 would support this. I'm curious if this
    is available in 2.5 or if it's still planned for 3.0.
    Thanks
    Michael

    I'm observing massive performance problems but I didn't think it could be
    caused by this intermediary object but maybe that is the problem. For
    example if I start a transaction to delete everything (with 3,000 records
    which in turn has 3,000 records which in turn has 2 lists each) theprogram
    crashes before it can finish the transaction. I then put in some loops to
    delete 100 records at a time and this runs but it took over an hour to
    delete the 3,000 records.
    Do you have any other ideas of how to improve the performance? Are there
    any alternatives?I solved the performance problem. I was storing web page content (all the
    HTML) in a String which by default is in the default-fetch-group. I had
    been thinking this was using lazy-loading but it wasn't. So I put
    default-fetch-group=false for this property and now the performance is
    great. It makes sense because it was retrieving approximately 5k of text
    for each record! When deleting 3,000 records this comes out to be 14 megs.
    Moral of the story: Use the default-fetch-group wisely!!

  • Persistent objects - base table syntax error

    I've created a persistent object for a ztable, then the customer has asked me to change the counter field from numc 3 to numc 5, and also remove a field  I've done this, and activated and adjusted the table in SE14.
    Now, in SE24, I've gone in and adjusted the persistence mapping.  When I activate the persistent class, I now get a syntax error in the base class, because it's still referring to components of the old table structure.
    When we change the structure of the underlying table, do we have to delete and recreate the persistence classes?  Is there a "repair" option?
    ( It seems it would be useful to have a tool that would generate a basic persistent class directly from a table ).
    matt

    Hi Matt,
    There is no repair option.  As far as I'm aware the persistence class builder function doesn't recognise changes to data types unfortunately.  In similar circumstances I've solved the problem by deleting and recreating the class.  It's not ideal but at least it's a quick process.
    Regards,
    Steve.

Maybe you are looking for

  • How do I convert a PDF (made in Indesign) back into an editable InDesign format?

    My hope is to edit just one line, and then we can send to print.Thanks for your help!

  • How to cancel an edit to an iCal event with attendees

    I keep running into this-- - Open an existing event with attendees - Make an edit of some kind - Change your mind - Forget what changes you made and/or not wish to let everyone already invited know that iCal is sometimes as crappy as Outlook. - Only

  • Raw vs jpg?

    my photos were shot in raw and open as jpgs in camera raw and photoshop cs6. can anyone help? camera is a canon eos rebel xsi Message was edited by: camerashygirltx

  • ChaRM : Execute action in Task Plan regarding of current phase

    Hello all, In the Task Plan of a maintenance project, I would like to change the phase in which some actions (e.g. import to a production system) can be executed. I tried to do this using the customizing "Make Settings for Change Transaction Types",

  • Buffering

    hi to all abap gurus my querry is as  follows  what is buffer ? and when do we buffer the table ? how do we  decide wether the table has tio be buffered or not ? we know that all bufeering types 1 full buffering , 2. single record buffering .3.generi