How to get the version no of a document created/updated in KM

Hi All,
We are currently working on SAP 7.0 SP16.
We have used the KM API to store our documents into the KM repositories.
The problem we are facing here is related to the version no of the documents created.
I will explain this with an example :
I have created a document "test.txt" --> default version no is 1
I updated the same twice now there are 3 version for this document 1, 2 & 3.
Now if I delete the version no 1 then there are only 2 document versions remaining in the system, but the Portal still displays them as 2 and 3.
Now when I want to read the version history of this document I get an IResource object for each version but I am not able to find any means through which I can retrieve the version no of the IResource object which is currently being read.
Can someone please help me the information regarding how to retrieve the version no from the IResource object returned whenever a document is read using KM API.
Thanks in advance!
Regards,
Manish

Hi,
try something like this:
String strRevisionID = null;
if (resource.isVersioned())  {
  IVersionHistory versions = resource.getVersionHistory();
  if (versions != null) {
    IResource version = versions.get(i);
    strRevisionID = actResource.getRevisionID();
hope this helps,
Romano

Similar Messages

  • How to get the Version History of a stored document?

    Hi,
    I am trying to store and retrieve the content using Content Services features of ADEP 10.0.
    I am able to store and retrieve content where as I am not able to get the version of the document. I am trying to store same or different document, but I donot get the version history or version label. Please guide me how I can get  the version of a stored document.
    Also, please advise me if there are simple alternative to do the same in ADEP10.
    Please see below my sample code below:
    package test.sample;
    import java.io.File;
    import java.util.*;
    import com.adobe.idp.Document;
    import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
    import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;
    import com.adobe.livecycle.contentservices.client.CRCResult;
    import com.adobe.livecycle.contentservices.client.impl.DocumentManagementServiceClientImpl;
    import com.adobe.livecycle.contentservices.client.impl.UpdateVersionType;
    public class AddContent {
        public static void main(String[] args) {
            try{
                //Set connection properties required to invoke Document Services in EJB mode                                
                Properties connectionProps = new Properties();
                connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "jnp://localhost:1099");
                connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,Service ClientFactoryProperties.DSC_EJB_PROTOCOL);          
                connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
                connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
                connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");
                //Create a ServiceClientFactory object
                ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);
                //Create a DocumentManagementServiceClientImpl object
                DocumentManagementServiceClientImpl    docManager = new DocumentManagementServiceClientImpl(myFactory);
                //Specify the store and node name
                String storeName ="SpacesStore"; 
                String nodeName = "/Company Home/Test Directory";
                //Retrieve the document to store in /Company Home/Test Directory
                Document contentA =  new Document(new File("C://Adobe/New files/Data-A.pdf"), false);
                Document contentB =  new Document(new File("C://Adobe/New files/Data-B.txt"), false);
                Document contentC =  new Document(new File("C://Adobe/New files/Data-C.xlsx"), false);
                //Create a MAP instance to store attributes
                Map<String,Object> inputs = new HashMap<String,Object>();
                //Specify attributes that belong to the new content
                String creator = "{http://www.alfresco.org/model/content/1.0}creator";
                String description = "{http://www.alfresco.org/model/content/1.0}description"; 
                inputs.put(creator,"Veeraganteppa Sajjan");
                inputs.put(description,"A sample application form");
                //Store MortgageForm.pdf in /Company Home/Test Directory
                CRCResult resultA = docManager.storeContent(storeName, 
                         nodeName,
                        "dataA.pdf",
                        "{http://www.alfresco.org/model/content/1.0}content", 
                        contentA,
                        "UTF-8",
                        UpdateVersionType.INCREMENT_MAJOR_VERSION,
                        null,
                        inputs); 
                CRCResult resultB = docManager.storeContent(storeName, 
                        nodeName,
                       "dataB.pdf",
                       "{http://www.alfresco.org/model/content/1.0}content", 
                       contentB,
                       "UTF-8",
                       UpdateVersionType.INCREMENT_MAJOR_VERSION,
                       null,
                       inputs);
                CRCResult resultC = docManager.storeContent(storeName, 
                        nodeName,
                       "dataC",
                       "{http://www.alfresco.org/model/content/1.0}content", 
                       contentC,
                       "UTF-8",
                       UpdateVersionType.INCREMENT_MAJOR_VERSION,
                       null,
                       inputs);
                //Get the identifier value of the new resource
                String idA = resultA.getNodeUuid();
                String idB = resultB.getNodeUuid();
                String idC = resultC.getNodeUuid();
                System.out.println("A -The identifier value of the new content is "+idA);
                System.out.println("B - The identifier value of the new content is "+idB);
                System.out.println("C - The identifier value of the new content is "+idC);
               System.out.println("A - The Browse Link is "+resultA.getBrowseLink());
                System.out.println("B - The Browse Link is "+resultB.getBrowseLink());
                System.out.println("C - The Browse Link is "+resultC.getBrowseLink());
              System.out.println("A-The Version Label is "+resultA.getVersionLabel());
              System.out.println("B-The Version Label is "+resultB.getVersionLabel());
              System.out.println("C-The Version Label is "+resultC.getVersionLabel());
              System.out.println("The Version History is "+docManager.getVersionHistory(storeName,nodeName, true));
        }catch(Exception e)
            e.printStackTrace();
    Message was edited by: V B Sajjan

    Sorry I did not attach the output and errors. Please find the same below.
    A -The identifier value of the new content is f5427f5b-c7c1-4c3c-b959-cb84e4e49a13
    B - The identifier value of the new content is b237d22c-5ff5-4628-a83a-23f5e49ae48e
    C - The identifier value of the new content is 34a9992c-3705-4488-bb55-6dd7ddfa0517
    A - The Browse Link is http://localhost:8080/contentspace/wcs/api/node/content/workspace/SpacesStore/f5427f5b-c7c 1-4c3c-b959-cb84e4e49a13/dataA.pdf
    B - The Browse Link is http://localhost:8080/contentspace/wcs/api/node/content/workspace/SpacesStore/b237d22c-5ff 5-4628-a83a-23f5e49ae48e/dataB.pdf
    C - The Browse Link is http://localhost:8080/contentspace/wcs/api/node/content/workspace/SpacesStore/34a9992c-370 5-4488-bb55-6dd7ddfa0517/dataC
    A-The Version Label is null
    B-The Version Label is null
    C-The Version Label is null
    ALC-CSV-30015-000: com.adobe.livecycle.contentservices.client.exceptions.CSInvocationException: ALC-CSV-030-015-The node [/Company Home/Test Directory] is not versioned.
    at com.adobe.contentservices.webscripts.impl.AbstractContentManager.doGetVersionHistory(Abst ractContentManager.java:1362)
    at com.adobe.contentservices.webscripts.impl.ContentManagerImpl.executeParams(ContentManager Impl.java:198)
    at com.adobe.contentservices.webscripts.impl.CSRetryingTransactionCallback.execute(CSRetryin gTransactionCallback.java:45)
    at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransacti onHelper.java:326)
    at com.adobe.contentservices.webscripts.impl.ContentManagerImpl.execute(ContentManagerImpl.j ava:114)
    at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:333)
    at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransacti onHelper.java:326)
    at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContaine r.java:386)
    at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContai ner.java:404)
    at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java: 246)
    at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:294)
    at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:172)
    at org.alfresco.web.scripts.servlet.WebScriptServlet.service(WebScriptServlet.java:122)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.adobe.idp.um.auth.filter.CSRFFilter.doFilter(CSRFFilter.java:86)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.ja va:183)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEs tablishmentValve.java:126)
    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEst ablishmentValve.java:70)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java: 158)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.ja va:598)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)
    at java.lang.Thread.run(Thread.java:662)

  • How to get the version no. for service po?

    Hi,
    How to get the version no. for service po?For material po we are getting the version from EKKO-REVNO but for service po Ekko-revno is blank.
    Regards,
    Rachel.

    Hiee,
    It is not like service PO does not have revision.
    REVNO will only exists for any document if amendment is made after releasing it. If in EKKO for all service PO revision number is blank then test if version management is active for document type
    MM->Purchasing->Version management -> External documents
    Here check for your doc type and purchase org version management is active.
    Regs,
    Appie

  • Hello, I was wondering how to get a version of a PDF document? My Adobe shot down and I have not had time to save my document with the notes had been taken. When I reopened there were no notes on my paper. I have a mac book pro. Thx.

    Hello, I was wondering how to get a version of a PDF document? My Adobe shot down and I have not had time to save my document with the notes had been taken. When I reopened there were no notes on my paper. I have a macbook pro. Thx.

    Hi Erika1987,
    If you have not saved the document and Acrobat closed then it's not possible to retrieve the lost data on the pdf file.
    Regards,
    Rave

  • How to get the link of already archived document

    Dear all,
    How to get the link of already archivied document. for example i have a sales order for which subsequent documents have been archived. now i want to get the link of subsequent document.
    please give some solution
    Thanks in advance
    Thanks,
    Hemachandran.

    Hemachandran,
                The archiving object for sales order is SD_VBAK. If you run the program S3VBAKAU by transaction se38 and search based on the document numbers ( as you mentioned it is the preceeding document numbers to the current document), you will be able to retrieve the information regarding the previous sales orders.
    More information on the sales order archiving object can be found at,
    http://help.sap.com/saphelp_45b/helpdata/en/a9/55c7b690a111d1a5510000e82deaaa/content.htm
    Sojan
    <<text removed by moderator>>
    Edited by: Matt on Nov 16, 2008 5:08 PM - Do not request points

  • How to get the search option when we are creating new view

    Hi,
    How to get the search functionality when we are creating new view.
    Ex:- if we see the standard component BT112S_SC. Under this
    AdvancedSP  is the view,
    same kind of view if i want to create new view with same bol entity in my new component. I am unable to get that search functionality.
    for search functionality,,i think view should inherit the super class CL_BTSRV_ADVS_CNTRL, but in my new view controller class, i am unable to find this class.
    Can anybody give me some inputs on this.
    Thanks,
    neelam

    In case you are still not able to proceed please refer the following blog.
    http://blogs.moovar.com/sap/sap-crm-web-ic-create-a-new-search-view-and-result-view
    Regards,
    Harshit

  • How to get the latest procured value of a spare updated in material master

    How to get the latest procured value of a spare updated in material master

    J S S PRASAD
    See table MBEW via transaction SE16.
    However, you may need to look at the last PO created for that material.
    PeteA

  • How to get the version changes programatically in ItemCheckedin event

    Hi,
    I am creating a custom version history page.
    I have a requirement were I have to capture the changes after file check-in and display it in the custom page.
    Is there anyway to get the version changes programatically after the file has been checked-in?
    Is is possible to get the current version and previous version in ItemCheckedin event
    and get the version changes?
    Thanks in advance,
    dhijit

    Hi,
    As Dimitri said, we can use ItemCheckingIn event to achieve it.
    The following code snippet for your reference:
    public override void ItemCheckingIn(SPItemEventProperties properties)
    base.ItemCheckingIn(properties);
    int beforeLevel = (int)properties.BeforeProperties["vti_level"];
    int afterLevel= (int)properties.AfterProperties ["vti_level"];
    if((beforeLevel==255) && (afterLevel==1))
    // This is a major version that is being checked in . . .
    int majorVer= properties.ListItem.File.MajorVersion+1;
    Best Regards
    Dennis Guo
    TechNet Community Support

  • How to get the View for a particular Document position?

    Hi there,
    Does anyone know how to get the "deepest" View that is responsible for rendering a particular Document offset?
    I tried looking at modelToView() and some other methods, but I am lost.
    Can anyone please help me?
    Thanks,
    Swati

    Bart--
    To find the table cell of the insertion point, you could use something like:
    InterfacePtr<ITextStoryThread> storythreadp(txtModel->QueryStoryThread(startPos + 1));
    InterfacePtr<ICellContent> cellcontentp(storythreadp, UseDefaultIID());
    if (! cellcontentp) {
      // Not a table cell, so see if it's the primary thread (kTextStoryBoss/ITextModel).
      InterfacePtr<ITextModel> threadmodelp(storythreadp, UseDefaultIID());
      if (threadmodelp) {
        // It's the primary thread...
      else {
        // It's something else with an ITextStoryThread (note, footnote, etc.).
    else {
      // The insertion point's in a table cell (kTextCellContentBoss).
      InterfacePtr<ITableModel> tableModel(cellcontentp->GetTableModel(), UseDefaultIID());
      GridID gridID(cellcontentp->GetGridID());
      GridAddress gridLoc(cellcontentp->GetGridAddress());
      // ...and so on.
    Hope this helps get you where you want to go.
    Chris Roueche / Freelance Developer

  • How to get the custom integrator in Manage Document Links

    Hi All,
    My requirement is "Creating Word Documents Using Web ADI", I am following the document
    Oracle® Human Resources Management Systems
    Configuring, Reporting, and System Administration Guide
    Release 12.1
    Part No. E13509-02
    From page no. 194.In that section, No.8. Use the Manage Layout Document Links page to create a link between the
    integrator and layout and the Word template.
    See: Creating Links between Template Letters and Layouts, page 2-33
    2-33>>
    Select Manage Document Links from the Web ADI menu.
    But when I click on the "Manage Document Links", I couldn't see my custom integrator to associate my word document with my integrator.
    I could see only the standard integrators.
    How to get my custom integrator in "Manage Document Links". I could see my custom integrator in define layout but not in this page.
    Thanks.
    With Regards,
    Kali.

    Hussein,
    Thanks for your reply.
    I followed the
    Note 360105.1 -Understanding and Using Web ADI in Oracle HRMS, and the section "Letters",
    I could follow all the steps, except the following,
    The reason is, when I click on Manage Documents Links, I am not getting my newly created integrator.
    If I link a standard integrator "HR People Details" to my document, that is opening properly.
    But I am not able to link my document with my integrator(which is based on my view).
    c.  Now link the template letter to the Letter Integrator and Layout.
    If not already done so, Add the function WebADI Manage Document Links to your Web ADI menu, and give it a prompt of Link Document.
    Select Link Document option , and Web ADI Mail Merge page displays. Choose your Letter Integrator. Link it to the Layout, and a list of template documents uploaded to the database is displayed. Select the template letter to be linked with the layout.
    Thanks.
    With Regards,
    Kali.

  • [CS3][JS] How to get the file type of current document

    Hi,
    How to get the file type of current opening document (e.g., tif, jpeg, png) using JavaScript with Photoshop CS3.
    I am using file object the open the files one by one in the folder (the files sometimes don't have the extensions).
    If the current document is in tiff format then I need to convert to 8-bit, if its an Jpg image then needs to ignore the file.
    Regards,
    Karthik

    Do you really need to know the file type? What about just checking the bit depth?
    var doc = activeDocument;
    if (doc.bitsPerChannel != BitsPerChannelType.EIGHT) {//Not 8 bit
    doc.bitsPerChannel = BitsPerChannelType.EIGHT;
    //do your save etc
    }else{
        //Ignore

  • How to get the art handle of a newly created art.

    Hi all,
    Is there any way through which we can get the art handle of a newly created art, just after its creation on the document?
    Thanks.

    Unfortunately, there is nothing to really do this. I asked for years, and eventually gave up. The best I came up with -- and it sucks -- is to watch for kArtPropertiesChangedNotifier and when that triggers, you look at the selected art and assume that was what was 'created' or 'edited'. Of course, telling the difference between the two is a problem

  • How To Get The Version Of Music Player Back?

    Welcome,,
    i have Nokia N8 and i install an update for music player and it is too bad and  not easy as the past version
    so is there a way to get past version back?
    Thanks,,

    there is no way to downgrade firmware, sorry.

  • How to get the Version of the Solution Manager

    Hi Experts,
    The Solution Manager is Already Insatlled on our Machine.
    How to Find out the Version of the Solution Manager???
    How to Disply the Solution Manager Key????
    Please give me the Proper Solution on this.
    Regards
    Khanna

    Hi,
    Check this link
    http://www30.sap.com/korea//services/pdf/Solman_4.0_Maintenance_Optimizer_Setup_Guide.pdf
    you might have to use t-code  SPRO
    Regards,
    Ramesh P
    Message was edited by:
            Ramesh Parashivamurthy

  • How to get the version of the Document opened.

    Hello all,
    When a document is opened I want to know in which Indesign version this document was created.
    Depending on the version I need to route to different functions in my code.
    Is there a way to know this.
    Thank you
    Madhu

    Hi Madhu,
    have a look at iDataBase->GetVersionNumber
    Best,
    Peter

Maybe you are looking for