Bulk Metadata Update using RIDC API!!

Hi,
In my program I have to update bulk content's metadata value. For example I would like to update 'xComments' filed through my RIDC api call in java for 40K contents. In the last run the program was taking huge amount of time(in hours) to update the contents.
Could you please advise me any performence fine tuning or alternate operation to reduce the metadata update time. The java program runs in a single thread. Find the RIDC doc_update code below.
Code:
import oracle.stellent.ridc.*;
import oracle.stellent.ridc.model.*;
import oracle.stellent.ridc.protocol.*;
public class UpdateMetadata {
     private static IdcContext userContext = null;
     static public void main(String args[]) throws Exception {
          System.out.println("RIDC - tests");
          IdcClient idcClient = null;
          try {
               // Create the Manager
          IdcClientManager manager = new IdcClientManager();
               idcClient = manager.createClient("idc://<IPADDRESS>:4444");
               IdcContext userContext = new IdcContext("sysadmin");
               DataBinder binder = idcClient.createBinder();
               binder.putLocal("IdcService", "UPDATE_DOCINFO");
          for(int i=0;i<Resultset.size();i++)
               binder.putLocal("dID", resultset.did);
               binder.putLocal("dDocName", resultset.ContentID[i]);
               binder.putLocal("xComments","****True****");
               ServiceResponse response = idcClient.sendRequest(userContext,binder);
               System.out.println("Processed");
               DataResultSet resultSet = binders.getResultSet ("SearchResults");
               // loop over the results
               for (DataObject dataObject : resultSet.getRows ()) {
                    System.out.println ("Title is: " + dataObject.get ("dDocTitle"));
                    System.out.println ("Author is: " + dataObject.get ("dDocAuthor"));
          } catch (IdcClientException ie) {
               System.out.println("Exception while creating the client" + ie);

The code seems to be incomplete:
- there are some variables like Resultset, resultset that are not initialized in the code (but probably are somewhere else)
- there is a line }*/, but no starting /* (could be corrupted by the editor)
Anyway, if you write that
In the last run the program was taking huge amount of time(in hours) to update the contents. I'd focus first for a question: what has changed? Btw. what is the expected (experienced?) result?
As for the code, it looks OK to me. You could probably throw away everything behind ServiceResponse response = idcClient.sendRequest(userContext,binder); but it seems the second loop is commented out anyway.
To reach better performance, you can certainly try to run the program in several threads - it will require some fine tuning to find out how many threads are optimal. For CHECKIN_NEW, we had the best performance with 3 threads in parallel, but it operated with 100-500kB files, so I'm not sure if these results are relevant also for UPDATE_INFO. I doubt, however, that improvements achieved with parallelism can be higher than let's say 2-3x faster.

Similar Messages

  • Updating KM Metadata properties using KM API

    Hi All,
    We are tring to update the custom Metadata properties using KM API from the Abstract Portal Component.
    We have written the below code for updating the metadata.
    We have checkbox called "Region" which has multiple option values like "Asia,America,Europe". I was able to update this property with single value. But when i try to update with multiple value it is not working. I tried with comma seperated but it didn't work.
    Can somebody through light on this. How to update multiple values?
    Code snippet
    IUserManagementService service=(IUserManagementService)PortalRuntime.getRuntimeResources().getService(IUserManagementService.KEY);
              com.sapportals.portal.security.usermanagement.IUser user =null;
                   user= service.getDefaultFactory().getEP5User(request.getUser());
    IResourceContext context = new ResourceContext(user);
    RID path = RID.getRID("/documents/src/ex1.doc");
                        IResource res = ResourceFactory.getInstance().getResource(path,context);
                        IPropertyName propName = new PropertyName("http://ars.com/xmlns/cm","Region");
                        IMutablePropertyMap map = new MutablePropertyMap();
                        IProperty property = new Property(propName,"Asia");//How to pass multiple Values?
                        map.put(property);
                        res.setProperty(property);
    Helpful answer would be appreciated and Rewarded....
    Regards,
    Birla.

    Hi Birla,
    try this:
    IResource res = ResourceFactory.getInstance().getResource(path,context);
    IPropertyName propName = new PropertyName("http://ars.com/xmlns/cm","Region");
    java.util.List values = new List();
    values.add("Asia");
    values.add("America");
    values.add("Muenster, Germany");
    IProperty property = new Property(propName, PropertyType.STRING, values);
    res.setProperty(property);
    Best regards,
    Michael

  • Due date update using GP APIs?

    Hi all
    I am working on the Due date update using GP APIs, I have done it at the "process" level. However I dont know how to trigger it at an activity level using GP APIs.
    Please tell me how to gain access to the Activity (Action) instance of the next processor from the current one? I have set the Due date statically at the process and activity level. Now I wish to allow the user to change the due date dynamically using GP APIs at the <b>activity</b> level.
    Ideas pls......
    regards
    LNV

    An other one!! I have set the due date manually in the process yet I dont see it in the UWL. Any thoughts on this? Thanks again.

  • How to retreive resultset of WCM_PLACEHOLDER service using ridc api

    Hi,
       I am trying to call WCM_PLACEHOLDER  service using ridc api. I was able to set dataFileDocName and templateID, but was unable to retreive the result set, since I am not sure with which name should I have to search in the result set. AS like GETSEARCHRESULTS i tried with "SearchResults" but not success. Sample code below I tried.
    DataBinder dataBinder = serviceResponse.getDataBinder();
    dataBinder.getResultSet("SearchResults"); ----> This is the line that is not working as looks like I need to replace "SearchResults" with something else.
    I tried googling this for, but couldn't find useful information any where.
    Appreciate your help here.
    Thanks,
    Kesava.

    Pl do not post duplicates - https://forums.oracle.com/thread/2562089

  • The notifications aren't update using the API of universal work list

    We use in the portal home a development iview  that works with de API of Universal Work List. This iview shows the number of notifications and tasks. While the number of tasks are updated correctly, the number of notifications are not refreshed. The only way to update the number of notifications is going and refreshing the Universal Work List iView provided by SAP.
    The API that we are using not support this case? Any suggestion?
    We haven’t found information about this.
    Our system version is 7.00 SP14
    We attachment the call that we‘ve used.
          try {
            notificaciones = tareas = 0;
            IUWLService uwlService =
              (IUWLService)PortalRuntime.getRuntimeResources().getService(
                IUWLService.ALIAS_KEY);
            UWLContext uwlContext = new UWLContext();
            IUser user = componentRequest.getUser();
            uwlContext.setUser(user);
            uwlContext.setAllowBackEndConnections(true);
            uwlService.beginSession(uwlContext, -1);
            IUWLItemManager itemManager = uwlService.getItemManager(uwlContext);
            QueryResult result =
              itemManager.refreshCacheAndGetItems(uwlContext, null, null, null);
            ItemCollection collection = result.getItems();
            for (int i = 0; i < collection.size(); i++) {
              Item item = collection.get(i);
              if ((item.isUnRead() || item.isNew())
                && item.getItemType().startsWith("uwl.notification")) {
                notificaciones++;
              } else if (
                (item.isUnRead() || item.isNew())
                  && item.getItemType().startsWith("uwl.task")) {
                tareas++;
            uwlService.endSession(uwlContext);
          } catch (UWLException e) {
            e.printStackTrace();
    Regards

    Thank you very much for your quick answer...
    But I think that you don't understand me. We can read notifications number but not in real time because they are not updated until we go to the UWL and we force there an update. We want to show in real time the number of notifications that a user has.
    Does anybody how to update/refresh this using the API?
    Thanks for your suggestions

  • How to update information fields of a profile in Oracle UCM using RIDC

    Hi All
    I have a requirement in which i need to modify/update the metadata/information fields of a Profile in Oracle Webcenter Content(UCM).
    I found out that this can be achieved using RIDC api, but i have little knowledge about the same.
    If someone could suggest about how to retrieve and update the fields in UCM using RIDC or some other approach would be of great help.
    It's really important.Kindly help
    Regards
    ACM

    user13069455 wrote:
    Hi Jiri
    Even i have thought about the same as one of the approaches, but i was a bit apprehensive about using this one.
    I have few stupid queries regarding this:
    1)Will it expose the production database(connection details) to the environment?Yes. If you don't like the idea of giving connection to the database to a "third-party" program, you could go from the other side - create a UCM component (some kind of scheduled job), which will be a part of UCM, but do the same. It will be a bit more complicated, but might be considered more secure.
    2)Will it have any performance impact?I don't think there will be much impact - most of time, tables will be accessed in read-only mode (pulling the data out), so except few per cent of CPU and some memory it should not consume anything. Besides, you should be able to schedule upload to "quiet hours", if there are some
    3)Will it still be an integration with the UCM?Well, yes. It will be integration at the database level. But honestly, as long as it works, do you care how is it called?
    >
    Thanks
    ACM

  • How to get full url using UCM RIDC api

    Hi,
    I am using RIDC api to get the full url of the document (including protocol, host, port info). I tried using DOC_INFO
    and GET_SEARCH_RESULTS api. The GET_SEARCH_RESULTS api returns the path but no protocol, host, port info.
    DOC_INFO does not contain any uri. Is there a way to get full url? I only have access to the idc socket connection
    configuration to connect to the server.
    E.g. I know the idc connection url is idc://hostname:4444
    The user supplies document name as "myDoc.txt" and dId = 2000.
    I used GET_SEARCH_RESULTS for myDoc.txt and DOC_INFO for dId=2000.
    I need to return absolute url to the user that user can copy paste in the browser and download the doc.
    Thanks,
    --dhiraj                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    You can ge the docUrl using doc info services DOC_INFO or DOC_INFO_BY_NAME.
    dataBinder.putLocal("IdcService", "DOC_INFO");
    dataBinder.putLocal("dID", docId);
    ServiceResponse response = idcClient.sendRequest (idcContext, dataBinder);
    DataBinder respBinder = response.getResponseAsBinder();
    System.out.println("DocUrl"+ respBinder.getLocal("DocUrl"));

  • How to use RIDC to query WebCenter Content Tables

    Hi all
    Can we use RIDC API to query WebCenter Content 11g Tables.if yes then How can I achieve this?
    i am newbie

    always find in oracle doc
    http://docs.oracle.com/cd/E21764_01/doc.1111/e11011/c05_core.htm#BABBABBF
    and this too
    http://jonathanhult.com/blog/2012/07/ridc-versus-cis/

  • How to use RIDC to query WebCenter Content Tables/Views

    Hi,
    Can I use RIDC API to query WebCenter Content 11g Tables/Views, if so, How can I achieve this?
    Regards,

    Yes, you can.
    Call one of the Schema services (such as GET_SCHEMA_VIEW_VALUES) and you will get back a ResultSet which you can iterate over.
    http://docs.oracle.com/cd/E21764_01/doc.1111/e11011/c05_core.htm#BABBABBF
    Some links to RIDC code examples can be found here: http://jonathanhult.com/blog/2012/07/ridc-versus-cis/
    Jonathan
    http://jonathanhult.com

  • How to get the resultset of WCM_PLACEHOLDER service using ridc

    Hi,
       I am trying to call WCM_PLACEHOLDER  service using ridc api. I was able to set dataFileDocName and templateID, but was unable to retreive the result set, since I am not sure with which name should I have to search in the result set. AS like GETSEARCHRESULTS i tried with "SearchResults" but not success. Sample code below I tried.
    DataBinder dataBinder = serviceResponse.getDataBinder();
    dataBinder.getResultSet("SearchResults"); ----> This is the line that is not working as looks like I need to replace "SearchResults" with something else.
    I tried googling this for, but couldn't find useful information any where.
    Appreciate your help here.
    Thanks,
    Kesava.

    Hi Kesava ,
    WCM_PLACEHOLDER - http://docs.oracle.com/cd/E28280_01/doc.1111/e10615/c11_ss_services.htm#SSTRF503
    This is not a search service but it is used to evaluates a placeholder, allowing the contents of the placeholder to be retrieved directly from anywhere the Oracle Content Server can be seen from.
    Code snippet to retrieve the details using RIDC is as follows :
    // Databinder for  placeholder request
                DataBinder dataBinder = idcClient.createBinder();
                dataBinder.putLocal("IdcService", "WCM_PLACEHOLDER");
                dataBinder.putLocal ("dataFileDocName","<content id of Contributor Data File>");
                dataBinder.putLocal("templateID" ,"<Content id of Region Template>");
    // Write the data binder for the request to stdout
                serializer.serializeBinder (System.out, dataBinder);
    // Send the request to Content Server
                ServiceResponse response = idcClient.sendRequest(userContext,dataBinder);
    // Get the data binder for the response from Content Server
                DataBinder responseData = response.getResponseAsBinder();
    // Write the response data binder to stdout
                serializer.serializeBinder (System.out, responseData);
    //Retrieve the data file text from LocalData Section :
                DataObject localData = responseData.getLocalData();
    //Printing the value which is required to be displayed
                System.out.println ("Placeholder Content / text is    : " + responseData.getLocal("placeholderContent"));
    // Retrieve the SearchResults ResultSet from the response
                DataResultSet resultSet = responseData.getResultSet("DOC_INFO");
    // Iterate over the ResultSet, retrieve properties from the content items
                for (DataObject dataObject : resultSet.getRows ()) {
                    System.out.println ("Title is: " + dataObject.get ("dDocTitle"));
                    System.out.println ("ContentID is : " + dataObject.get ("dDocName"));
                    System.out.println ("######");
    Hope this helps.
    Thanks,
    Srinath

  • RIDC metadata update issue!!

    Hi,
    The content metadata is updated using the RIDC API from the program. I am passing DID,DDOCNAME as variables for the UPDATE_DOCINFO service. In the content server log the following error is thrown for most of the contents.
    Error:
    The revision with internal ID 1234 of content item Test123 is supposedly the latest revision but is marked as an old revision. This error is a report only and will not modify behavior. An inconsistency was discovered while looking at the possibility of doing workflow action META_UPDATE performed by user sysadmin. Exception type is 'java.lang.Throwable'.
    Could you please help me to resolve this issue.

    Hi Jonathan,
    Please find the error trace below.
    Log Trace:
    The revision with internal ID 1234 of content item Test123 is supposedly the latest revision but is marked as an old revision. This error is a report only and will not modify behavior. An inconsistency was discovered while looking at the possibility of doing workflow action META_UPDATE performed by user sysadmin. Exception type is 'java.lang.Throwable'.
    An error has occurred. The stack trace below shows more information.
    !$linux123: !csWorkflowLatestRevMarkedAsOldRev,Test123,1234!csWorkflowConsistencyIssueWhenDoingActionByUser,META_UPDATE,sysadmin!syExceptionType,java.lang.Throwable
    java.lang.Throwable
         at intradoc.common.IdcLogWriter.doMessageAppend(IdcLogWriter.java:80)
         at intradoc.common.Log.addMessage(Log.java:270)
         at intradoc.common.Log.errorEx2(Log.java:218)
         at intradoc.common.LoggingUtils.logMessage(LoggingUtils.java:99)
         at intradoc.common.SystemUtils.reportErrorEx(SystemUtils.java:555)
         at intradoc.common.SystemUtils.errEx(SystemUtils.java:640)
         at intradoc.common.SystemUtils.err(SystemUtils.java:631)
         at intradoc.server.workflow.WorkflowStates.handleSpecialOldRevisionState(WorkflowStates.java:812)
         at intradoc.server.workflow.WorkflowStates.advanceDocumentStateImplement(WorkflowStates.java:577)
         at intradoc.server.workflow.WorkflowStates.advanceDocumentState(WorkflowStates.java:518)
         at intradoc.server.DocStateTransition.advanceDocumentState(DocStateTransition.java:74)
         at intradoc.server.DocServiceHandler.advanceDocumentStateSimple(DocServiceHandler.java:4234)
         at intradoc.server.DocServiceHandler.advanceDocumentState(DocServiceHandler.java:4209)
         at sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at intradoc.common.IdcMethodHolder.invokeMethod(ClassHelperUtils.java:617)
         at intradoc.common.ClassHelperUtils.executeMethodReportStatus(ClassHelperUtils.java:293)
         at intradoc.server.ServiceHandler.executeAction(ServiceHandler.java:79)
         at intradoc.server.Service.doCodeEx(Service.java:490)
         at intradoc.server.Service.doCode(Service.java:472)
         at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1360)
         at intradoc.server.Service.doAction(Service.java:452)
         at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1201)
         at intradoc.server.Service.doActions(Service.java:447)
         at intradoc.server.ServiceRequestImplementor.executeSubServiceCode(ServiceRequestImplementor.java:1071)
         at intradoc.server.Service.executeSubServiceCode(Service.java:3497)
         at intradoc.server.ServiceRequestImplementor.executeServiceEx(ServiceRequestImplementor.java:942)
         at intradoc.server.Service.executeServiceEx(Service.java:3492)
         at intradoc.server.Service.executeService(Service.java:3476)
         at intradoc.server.DocServiceHandler.doSubserviceIfMetafile(DocServiceHandler.java:4614)
         at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at intradoc.common.IdcMethodHolder.invokeMethod(ClassHelperUtils.java:617)
         at intradoc.common.ClassHelperUtils.executeMethodReportStatus(ClassHelperUtils.java:293)
         at intradoc.server.ServiceHandler.executeAction(ServiceHandler.java:79)
         at intradoc.server.Service.doCodeEx(Service.java:490)
         at intradoc.server.Service.doCode(Service.java:472)
         at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1360)
         at intradoc.server.Service.doAction(Service.java:452)
         at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1201)
         at intradoc.server.Service.doActions(Service.java:447)
         at intradoc.server.ServiceRequestImplementor.executeSubServiceCode(ServiceRequestImplementor.java:1071)
         at intradoc.server.Service.executeSubServiceCode(Service.java:3497)
         at helper.HelperService.executeSubServiceCode(HelperService.java:1812)
         at helper.HelperService.executeSubservice(HelperService.java:1648)
         at helper.HelperService.superService(HelperService.java:1553)
         at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at intradoc.common.IdcMethodHolder.invokeMethod(ClassHelperUtils.java:617)
         at intradoc.common.ClassHelperUtils.executeMethodEx(ClassHelperUtils.java:279)
         at intradoc.common.ClassHelperUtils.executeMethod(ClassHelperUtils.java:264)
         at intradoc.server.Service.doCodeEx(Service.java:507)
         at intradoc.server.Service.doCode(Service.java:472)
         at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1360)
         at intradoc.server.Service.doAction(Service.java:452)
         at helper.HelperService.doAction(HelperService.java:757)
         at helper.HelperService.doActions10g(HelperService.java:383)
         at helper.HelperService.doActions(HelperService.java:119)
         at intradoc.server.ServiceRequestImplementor.executeSubServiceCode(ServiceRequestImplementor.java:1071)
         at intradoc.server.Service.executeSubServiceCode(Service.java:3497)
         at intradoc.server.ServiceRequestImplementor.executeServiceEx(ServiceRequestImplementor.java:942)
         at intradoc.server.Service.executeServiceEx(Service.java:3492)
         at intradoc.server.Service.executeService(Service.java:3476)
         at intradoc.server.Service.doSubService(Service.java:3465)
         at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at intradoc.common.IdcMethodHolder.invokeMethod(ClassHelperUtils.java:617)
         at intradoc.common.ClassHelperUtils.executeMethodEx(ClassHelperUtils.java:279)
         at intradoc.common.ClassHelperUtils.executeMethod(ClassHelperUtils.java:264)
         at intradoc.server.Service.doCodeEx(Service.java:507)
         at intradoc.server.Service.doCode(Service.java:472)
         at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1360)
         at intradoc.server.Service.doAction(Service.java:452)
         at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1201)
         at intradoc.server.Service.doActions(Service.java:447)
         at intradoc.server.ServiceRequestImplementor.executeActions(ServiceRequestImplementor.java:1121)
         at intradoc.server.Service.executeActions(Service.java:433)
         at intradoc.server.ServiceRequestImplementor.doRequest(ServiceRequestImplementor.java:635)
         at intradoc.server.Service.doRequest(Service.java:1707)
         at intradoc.server.ServiceManager.processCommand(ServiceManager.java:359)
         at intradoc.server.IdcServerThread.run(IdcServerThread.java:197)
    Please help me to resolve this issue.

  • How to update 500 list items using Rest API

    Hi All,
    i have requirement that is "required to update 500 list items using rest Api".
    how can i do it,please share your thoughts with me.
    Thanks,
    Madhu.

    Didn't get you correctly, if you asking reference for REST API to update list items please refer below links
    http://msdn.microsoft.com/en-us/library/office/jj164022(v=office.15).aspx
    Destin -MCPD: SharePoint Developer 2010, MCTS:SharePoint 2007 Application Development

  • Use of APIs to update Absence info in Oracle HR/SSHR 11i

    Dear all,
    Use of APIs and Absences
    1. Can you please let me know which are the relevant APIs to update Absences Information into Oracle Human Resources Application?
    2. Where can I find relevant documentation on how to deploy these APIs?
    Thanking you in advance for your feedback
    Best regards
    Elena

    Hi Elena,
    You may find a list of the APIs in HRMS on Metalink. Just query for "APIs in HRMS". For absences you may use the following APIs: hr_absence_type_api, hr_person_absence_api
    You may create a PL/SQL program to use these APIs or alternatively use web ADI to create upload integrators. You may have to write a custom wrapper before calling these APIs if required.
    - Vikram

  • Updating a record using pay element using the API (Almost Done)

    Hi Everyone,
    I have a question about updating a record using the PAY_ELEMENT_ENTRY_API.update_element_entry
    I have process that doesn't error out, but its doesn't seem to update the record. So my question is, is the query below the correct way to get the element name and object version number when using this API? If not, what do I need to do?
    BEGIN
    SELECT MAX(pee.element_entry_id)
    INTO x_element_id_mgr
    FROM pay_element_types_f pet,
    pay_element_links_f pel,
    pay_element_entries_f pee,
    per_all_assignments_f paaf,
    per_all_people_f papf
    WHERE pee.element_link_id = pel.element_link_id
    AND pel.element_type_id = pet.element_type_id
    AND paaf.assignment_id = pee.assignment_id
    AND papf.person_id = paaf.person_id
    AND pet.element_name = 'Mgr Rec Pct'
    AND sysdate BETWEEN pee.effective_start_date AND pee.effective_end_date
    AND sysdate BETWEEN pel.effective_start_date AND pel.effective_end_date
    AND sysdate BETWEEN pet.effective_start_date AND pet.effective_end_date
    AND sysdate BETWEEN paaf.effective_start_date AND paaf.effective_end_date
    AND sysdate BETWEEN papf.effective_start_date AND papf.effective_end_date
    AND paaf.assignment_id = c_staging.assignment_id
    AND papf.person_id = c_staging.person_id;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    --ROLLBACK TO s1;
    v_error_message := 'For employee number '||c_staging.employee_number||' No data found for element name Mgr Rec Pct' || SUBSTR(sqlerrm, 1, 200);
    DBMS_OUTPUT.PUT_LINE('Error occurred : ' || v_error_message);
    WHEN OTHERS THEN
    --ROLLBACK TO s1;
    v_error_message := 'For employee number '||c_staging.employee_number||' Error found for element name Mgr Rec Pct' || SUBSTR(sqlerrm, 1, 200);
    DBMS_OUTPUT.PUT_LINE('Error occurred : ' || v_error_message);
    END;
    --- Get OVN
    BEGIN
    SELECT MAX(Object_version_number)
    INTO x_ele_object_version_number
    FROM pay_element_entries_f
    WHERE element_entry_id = x_element_id_mgr;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    v_error_message := 'For employee number '||c_staging.employee_number||' Error in getting the OVN for Mgr Rec Pct ' || SUBSTR(sqlerrm, 1, 200);
    DBMS_OUTPUT.PUT_LINE('Error occurred : ' || v_error_message);
    WHEN OTHERS THEN
    v_error_message := 'For employee number '||c_staging.employee_number||' Error in getting the OVN for Mgr Rec Pct' || SUBSTR(sqlerrm, 1, 200);
    DBMS_OUTPUT.PUT_LINE('Error occurred : ' || v_error_message);
    END;

    Your SQL isn't bad, although you're including loads of tables you don't need to so it's probably not as fast as it could be. I'm not sure you know what element entry to update so let's look at an example:
    -- | Element Entry Id | OVN | Start Date | End Date    | Pay Value |
    -- +------------------+-----+------------+-------------+-----------+
    -- | 123                2    1-Jan-2009   31-Jan-2011   USD 400
    -- | 123                1    1-Feb-2009   18-Jun-2011   USD 500
    -- | 123                1    19-Jun-2011  25-Jun-2011   USD 600
    -- | 123                5    26-Jun-2011  31-Dec-4712   USD 700Here the one element entry (Id 123) has 4 effective rows. The employee gets $400 in Jan 2009, $500 from Feb 2009 to mid-June 2011, $600 for a few days later in June 2011 and then $700 from 26th June 2011 onwards.
    So your question to the forum is which one do I update. Well, that depends which one you want to update. If you want to update the 1st Jan 2009 to 31st Jan 2011 you'd pass element_entry_id => 123, ovn => 2, effective_date => to_date('1-Jan-2009', 'DD-MON-YYYY') and datetrack_mode => 'CORRECTION'.
    If you wanted to update the $700 row you'd pass OVN 5 and an effective date of 26th June 2011. And so-on.
    Now in your SQL you're filtering based on sysdate, which means you'd be updating the $500 row (ovn=1). Is that what you want?
    I have simplified your SQL as follows:
    SELECT pee.element_entry_id
          ,pee.object_version_number
    INTO   x_element_id_mgr
          ,x_ele_object_version_number
    FROM   pay_element_entries_f pee
          ,pay_element_types_f pet
    WHERE  pee.assignment_id = c_staging.assignment_id
    AND    pee.element_type_id = pet.element_type_id
    AND    pet.element_name = 'Mgr Rec Pct'
    AND    trunc(sysdate) BETWEEN
           pee.effective_start_date AND pee.effective_end_date
    AND    trunc(sysdate) BETWEEN
           pet.effective_start_date AND pet.effective_end_date;This selects both the entry Id and OVN in one go; there's no need to have 2 SQL statements. If multiple entries are allowed, this SQL could return more than one row so just watch out for that. If you don't want the row as of sysdate change the two sysdate joins accordingly.
    I hope that helps.

  • Can you update Approval Status in Sales order using DI API using SDK

    Hi experts,
    Can we actually update the Approval Status(WddStatus) in Sales order From approved to pending using DI API.
    Thanks,
    John

    Hi John,
    When the sales order is originally created, and at that point pending approval, it is stored as a draft. Once approved, a sales order is created based on the draft.
    In other words, the pending document and the approved document are two entirely separate objects in the database (they use different tables), and in the SDK.
    That means that you can certainly realize your requirement, but you will have to look at it from another perspective. In quasi code:
    Intercept the update event
    Check if any changes were made that warrant another approval round
    If so, duplicate the (adjusted) order, and submit the new order to trigger the new approval round.
    Close or cancel the original order.
    Admittedly this seems a bit silly, but unfortunately the approval process in B1 is still not perfect. As such I recommend that you (also) log on to the SAP Business One Idea Place, (it is free, like the SCN) and vote for any ideas that pertain to your requirement, and/or create an idea of your own.
    Another approach all together could be to instruct users not to make changes to orders, and to use the stored procedure to prevent updates. And allowing users to only submit a new order altogether (they can use the duplicate functionality).
    Regards,
    Johan

Maybe you are looking for

  • Restriction of Time-dependent data (Cost Center) according to a specific role

    Dear experts, Has some one of you implemented a functionality to restrict Time-dependent data (for example, Cost Center) edition, according to a specific role assigned to an End user? I imagine it is possible, but we should develop an User-exit in or

  • ITunes won't open, have tried everything!

    Running Windows 7, iTunes used to work fine but now I click on the icon and it just won't open: no error message or explanation, it's just as though it's ignoring my request to open it. Have looked on the Internet for possible solutions and tried del

  • Importing all images without duplicates - LR3, LR4, LR5

    Howdy. I've been using Lightroom 3 for a couple years. Recently, a friend passed away. I went to look for photos of him and realized that many were missing. I've since found a few of them on Facebook, and suspect that some are lurking in old backups

  • Mac book pro tracking pad not working any thoughts please

    On my mac book pro one year old the track pad has stopped working  cursor moves around the screen but unless I press pretty hard of the bottom left hand corner nothing is selected .... Any thought please.   Cheers.  

  • Cisco UCCX VOIP Monitoring Issue

    Hi there, We got a customer with Cisco CUCM 8.5 and UCCX 8.5. We have configured SPAN Port VOIP Monitoring for Agent/Supervisor. When Agent is talking, the Supervisor can click on button to hear the conversation. It takes 5 or 6 seconds till we hear