Upload / Download document to KM Content Server from WebDynpro Application

I have a requirement where I need to upload / download document into / from KM Content Server from my WebDynpro Application.
Is it technically possible and if Yes, can I get any Sample code for this.

Hi Tahzeeb,
first of all i would point you to the JavaDocs for KMC API.
https://media.sdn.sap.com/javadocs/NW04/SPS15/km/index.html
And here is a small example of reading and storing KM resources.
For reading:
     * Returns a resource as an InputStream from the KM repository
     * at the given path. The IUser is needed for authorization.
     * @param user      IUser for checking authorisation.
     * @param resPath   Path to the KM resource.
     * @return          Requested resource as a stream.
    private InputStream getKmResource(final IUser user, final String resPath)
        throws ResourceAccessException {
        try {
            final IResourceFactory factory = ResourceFactory.getInstance();
            final RID rid = RID.getRID(resPath);
            final IResource kmResource =
                factory.getResource(
                    rid,
                    new ResourceContext(getDeprecatedIUser(user)));
            if (kmResource == null) {
                throw new ResourceNotFoundException(
                    "KM resource not found: " + resPath,
                    resPath);
            return kmResource.getContent().getInputStream();
        catch (WcmException e) {
            throw new ResourceAccessException("Error accessing KM resource: " + resPath, e, resPath);
And for writing:
     * Stores a resource in the KM repository at the given path with the given name and mimetype.
     * Content is taken from the given inputstream.
     * @param user          IUser for checking authorisation.
     * @param resName   Name of the resource
     * @param resPath     Path to the resource
     * @param mimeType MimeType of the resource
     * @param inputStream  Resource content
     * @throws ResourceAccessException
    private void putKmResource(
        final IUser user,
        final String resName,
        final String resPath,
        final String mimeType,
        final InputStream inputStream)
        throws ResourceAccessException {
        try {
            final ResourceContext rContext = new ResourceContext(getDeprecatedIUser(user));
            final RID rid = RID.getRID(resPath);
            final ICollection kmCollection =
                (ICollection) ResourceFactory.getInstance().getResource(rid, rContext);
            if (kmCollection == null) {
                throw new ResourceNotFoundException(
                    "KM resource not found: " + resPath,
                    resPath);
            else {
                IContent kmContent = new Content(inputStream, mimeType, -1);
                IResource kmResource = kmCollection.createResource(resName, null, kmContent);
        catch (ResourceException e) {
            throw new ResourceAccessException("Error accessing KM resource: " + resPath, e, resPath);
        finally {
            try {
                inputStream.close();
            catch (IOException e1) {
                throw new ResourceAccessException("Error closing InputStream when accessing " + resPath, e1, resPath);
Hope that helps for a start.
Best regards,
  ok

Similar Messages

  • Upload documents to DMS content server from other tcodes like MIRO

    Hi Experts,
    How can I upload my document to DMS content server through transactions like MIRO.

    Hi Sunil,
    You can't uplaod from different t-code, you need to upload it thru CV01n only. One exception is there which is BDC t-code SHDB for batch uploading. But from other t-code you can't uplaod a document into SAP DMS content server.
    One another option is create a z-tcode for the same. i.e. for MIRO create ZMIRO.
    In statndard environment you can attache but it will not saved in content server. Only thru CV01n it can be done.
    I hope this will resolve the query.
    Regards,
    Ravindra

  • Open/edit documents on SAP Content Server from BW?

    Hi guys
    I have been asked to investigate whether this scenario is possible.
    Today we have a SAP Content Server where we save attachments to different kinds of objects. An example could be that we open appropriation request 'S-00123' from IMA11 and attach two different MS Word documents.
    In BW I have created several reports that contain these appropriation requests and we would like to be able to attach/edit the files on the content server from the BW report.
    Is this somehow possible using RRI or some other functionality?
    Might it even be possible by using GoTo --> Documents with the appropriate setup?
    BR
    Stefan

    Hello Friends,
    Any luck??
    Thank you,
    Nikee

  • Error on update of document stored in content server

    Error on update of document stored in content server
    On a regular basis (but not reproducible) we find that after updating a document, it is deleted from content server (or at least it cannot be retrieved).  These problems have only been experienced since we switched to using content server as our storage repository, as opposed to R/3.
    We create and maintain documents through a bespoke transaction, which calls standard SAP functions BDS_BUSINESSDOCUMENT_CREA_TAB and cl_bds_document_set=>update_with_table.
    Whilst the errored documents are listed in the BDS via transaction OAOR (business document navigator), an error is received when you try to display it (in our case an MS-Word error indicating file/pathname invalid). 
    We are satisfied that file/pathname are valid and find that this occurs occasionally when a document has been updated.  It appears that the document has been deleted. 
    This bespoke transaction has been running successfully for almost two years, and these problems have only been experienced after switching to content server as a storage repository (as opposed to R3 previously).  Has anyone else experienced these problems? 
    We are running :
    R/3 Enterprise 620,
    SAP HTTP Content Server Version 6.30 Patch 13
    SAPDB version 7.3.0.54

    Hi Sonny,
    To check the connectivity between your content server and Workstation and SAP Server.
    Pls goto the command prompt of your workstation
    give the command like this example.
    C:\>Ping 117.123.45.201
    you will get the reply from the server. here 117.123.45.201 is your content server IP.
    If you are getting the reply then it means that your contentserver and workstation are connected propely.
    Like that pls check the connectivity between your systems.
    Pls check the hosts file of your systems also.
    If the hosts file entry is not maintained, you can check-out file from content server but you cannot check-in the original.
    Pls let me know what kind of error Message you are getting?
    From where you are trying to check-in the Original? From the DIR screen or from CAD Desktop screen?
    Regards,
    MRK
    (reward points if useful)

  • Using MS-Sharepoint as a content server from ECC 6.0

    Hi, gurus.
    From the
    [SAP Content Server Installation Guide|https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/cfa73246-0a01-0010-71b4-bc21ccb45c99&overridelayout=true]
    ...you will find this information:
    You can find a description of the SAP Content Server Interface in the SAP Library (on the documentation CD or under www.//help.sap.com) under SAP Web Application Server u2192 Basis Services u2192 Knowledge Provider u2192 Content Management Service u2192 SAP Content Server HTTP Interface. If you want to integrate another content server into your network, the new content server must fulfil the requirements of the interface.
    My simple question is:
    Is it possible to use MS Sharepoint as a content server from ECC 6.0  ?
    Please advice.

    Hi Athol,
    Thanks very much, your answers are very helpful.
    To use SharePoint as SAP DMS for document management. We have depend on the 3rd party products like iNet.DM from ERP.Link or Duet Enterprise and separate licenses required for products?
    Without this 3rd party products, it is not possible to use SharePoint as SAP DMS?
    What is best and cost effective way of achieving this requirement?
    Thanks and Regards,
    Venky.

  • Redirecting documents to seperate Content Server

    Hi all,
    We have set up a seperate content server to store attachments to business activity documents. Currently our systen is set up to save the documents to the content server in the CRM box's web AS. How can I redirect the documents to the new server. How can I verify the documents are being saved to it. I have completed all the installation steps in the "Content Server for Win 6.30 Installation guide". I am using CRM 3.0

    Hello,
    Table SOFFCONT1 attachments are stored that are recorded in the database logic of sap. That is if the id of the document not find it in this table means that you are storing away in a content server.
    I've gotten crm attachments the content stored on a server.
    The first thing I have done is create a content server-class CRM. OAC0 in, then I created the category AOCT taking the content. CSADMIN and I found that the content is running.
    In transaction SKPR08 BDS_POC1 class I have assigned to the Z-server content that I created. and in all kinds of CRM type I have assigned the new Z category I created.
    After the transaction SBDSV2 I created a new record with BUS1006 in this case because it was a contact in CRM and I have given the document class Z BDS_ATTACH the category of content.
    The object (BUS) is obtained by a trace of the transaction and SWELS - SWEL (with some modification from the transaction in which I attach the document).
    In SBDSV1 I've got to bus1006 BDS_LOC1 class.
    And with that I have solved the problem.
    Edited by: chuso100 on Apr 28, 2010 1:28 PM
    Edited by: chuso100 on Apr 28, 2010 1:29 PM

  • How PLM Document save on content server

    Hi All,
    Please tell me the concept about given below scenario:
    Normally PLM documents are either saved in the Content Server or in the database.
    What if we have neither configured a database nor a content server. Where are they being stored then.
    what exactly Document serever , how the PLM document save on Content Server or in data base server.
    Thanks
    Narendra Vikram Vishwakarma

    Hi Vishwa,
             It depends on the storage area that you have maintained in the sap system for the documents. The customisation in the sap system is visible at IMG-->Cross Application Components -->Document Management --> General Data --> Settings for storage system. The storage area that you configure here will be linked to the DIR creation process.
    The SAP DMS is a file directory in the SAP server and a content server is a seperate Sap certified server usually maintained for handling files. However these topics are much more broader and you can have an overview by checking the following link www.verbellacmg.com/ulm211_v2.ppt
    Sojan

  • How to call an external server from Webdynpro program?

    Hi All,
    i have a requirement in which i have to call an external server from Webdynpro ABAP program.
    how to imp

    hi ,
    do u mean u need to call the external link from ur WD ABAP application ?
    if so , u either create
    1 a Link to URL ( LTU ) UI element  and call the external link using that
    2 if u wish to use some other fuctionality and thn wish to call the URL in ur application ,u write this piece of code in ur relevant on Action method :
    data:  lo_window_manager type ref to if_wd_window_manager.
    data:  lo_api_component  type ref to if_wd_component.
    data:  lo_window         type ref to if_wd_window.
    data:  ld_url type string.
    lo_api_component  = wd_comp_controller->wd_get_api( ).
    lo_window_manager = lo_api_component->get_window_manager( ).
    ld_url =  ''.  // ur external sever link here
    CALL METHOD lo_window_manager->CREATE_EXTERNAL_WINDOW     
    EXPORTING     URL                = ld_url           
    RECEIVING     WINDOW         = lo_window.
    lo_window->open( ).
    I hope u wud be able to create URL now .
    regards,
    amit
    Edited by: amit saini on Oct 13, 2009 11:25 AM

  • Access UME from Webdynpro Application

    Access UME from Webdynpro Application u2013 display the user attributes from Webdynpro iview
    How to go for this...??
    Edited by: saurav mago on Sep 1, 2008 6:45 PM

    Hello Saurav,
    Try this:
    import com.sap.security.api.IUser;
    import com.sap.security.api.IUserAccount;
    import com.sap.security.api.UMException;
    import com.sap.tc.webdynpro.services.sal.um.api.IWDClientUser;
    import com.sap.tc.webdynpro.services.sal.um.api.WDClientUser;
    import com.sap.tc.webdynpro.services.sal.um.api.WDUMException;
    try {
         IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
         IUser sapUser = wdClientUser.getSAPUser();
         if (sapUser != null) {
              java.util.Iterator parentGroups = sapUser.getParentGroups(false);
              while (parentGroups.hasNext()) {
                   String parentGroupName = (String) parentGroups.next();
                   if (parentGroupName.equals("GRUP.R3_ROLE_DS.Z:EP_XPTO123")) {
                        return true;
    catch (WDUMException e) {
         e.printStackTrace();
    OBS.: sapUser can be used to access a lot of info regarding the user.
    OBS.: you need to add a reference to "com.sap.security.api.sda", that is in the default SC SAP_JEE, if I well remember.
    Regards,
    Douglas Frankenberger

  • Email link to document in Content Server from SDV

    Experts,
    We would like to email links to documents stored on our Content Server while viewing them in the SAP Document Viewer.  These documents are ArchiveLinks to invoices.  When we use the 'Send object with note' button in SDV, the email sent contains a text file which has information about the invoice, not the document we are viewing.  Does anyone know if what we are try to do is possible?
    - Andrew

    Hello Andrew,
    You can right-click in open space to the right of the bottom row of icons to change the icons. Next select MORE TOOLS. In the File Toolbar, check the box for Email and this should solve the problem. Why SAP did not default this checkbox I will never know.
    Thanks,
    Tim

  • Using GOS to store business document on the content server

    Hello All,
    BACKGROUND
    We use content server to store business documents via ArchiveLink.  The process to store a business document is via Generic Object Services menu path "Create -> Store business document". 
    ISSUE
    When document is stored in such a way, the actual name of the document is not displayed in the "Attachment list" of the GOS menu nor is it stored on the content server.  What we see instead in the "Attachment list" is a description of the Archive object (TOASP-objecttext) for all documents that we store. 
    NEED HELP
    We need to have a document's name (i.e. name of the uploaded file) displayed in the "Attachment list" of GOS.  We also need to be able to retrieve this file name programmatically via a function call or a class method. 
    Any help is greatly appreciated.
    Gene.

    1. In GOS attachment list i can able to see the attachment name (without extension) may be you need to check your layout using change layout (its may hidden)
    2. For getting attachment name programatically try this way
      i_object-typeid = 'BUS2012'.
      i_object-catid  = 'BO'.               
      i_object-instid = yatthdr-docno.       " Document Number
      refresh : i_brel, i_link.
    * Get Attachment List
      append 'ATTA' to i_brel.
      if not i_brel is initial.
        select *
          from srgbtbrel
          appending corresponding fields of table i_link
          for all entries in i_brel
          where
            instid_a eq i_object-instid and
            typeid_a eq i_object-typeid and
            catid_a  eq i_object-catid and
            reltype  eq i_brel-reltype.
      endif.
      wa_filter-send_info = ' '.
      wa_filter-no_content = 'X'.
      loop at i_link into ls_link.
        clear : wa_doc_data.
        wa_fol_cont-doc_id = ls_link-instid_b.
        call function 'SO_DOCUMENT_READ_API1'
          exporting
            document_id                = wa_fol_cont-doc_id
            filter                     = wa_filter
          importing
            object_header              = wa_obj_hdr    
            document_data              = wa_doc_data
          exceptions
            document_id_not_exist      = 1
            operation_no_authorization = 2
            others                     = 3.
    You can find the File Name in the WA_OBJ_HDR

  • Upgrade Content Server from 6.10 to 6.40

    Hello folks
    our customer is planning to upgrade its SAP Content Server (for DMS) from version 6.10 to 6.40 ...what is the best way to do this upgrade ?
    Do we have to install the 6.40 first ? then relocate all documents ?
    (our customer has a high volume of original files and require that there is minimum disruption in availability of the Content Server)
    I have searched in documentation of Content Server but nothing said on the upgrade part
    Any help is most welcome
    thanks

    Hi Sooriya,
    As you know, the Content Server 6.30 and 6.40 are both a part of
    the NetWeaver 2004S SR1 package.
    The 6.4 release is available for download via:
    Download
    Installations and Upgrades
    SAP NetWeaver
    SAP NETWEAVER
    SAP NETWEAVER 2004S
    50078731_2 NW 2004s SR1 Presentation - SAP Content Server 6.40
    In my opinion, I don't think there is direct upgrade to 6.40 from 6.10, and it should be NOT recommended.
    I would suggest you to do a fresh installation via SAPinst installer.
    See this link
    http://service.sap.com/ContentServer
    >>Media Library
    >>>>Litrature
    Regards,
    Vincent

  • URL to content server from BI WAD not working

    Hello,
    I'm facing a problem using BI WAD in the portal ( Portal 7.0). When trying to jump from a BI WAD to display a scanned document hold in the content server( using signed URL generated by the function 'SCMS_URL_GENERATE'), a new window opens but the URL is cut.
    For example:
    Trying to reach :
    http://SUP-CS-60.admin.ulb.priv:1090/ContentServer/ContentServer.dll?get&pVe
    rsion=0046&contRep=DE&docId=E09738751CB99BF19B8B00155D483527&compId=data&acc
    essMode=r&authId=CN%3DB30&expiration=20110622150040&secKey=MIH4BgkqhkiG9w0BB
    wKggeowgecCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHATGBxzCBxAIBATAZMA4xDDAKBgNVB
    AMTA0IzMAIHIAkJCBgYMDAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcB
    gkqhkiG9w0BCQUxDxcNMTEwNjIyMTMwMDQwWjAjBgkqhkiG9w0BCQQxFgQU8P%2BvgmFvUZe%2Fk
    qyCi%2FGDeYl53BUwCQYHKoZIzjgEAwQvMC0CFC2S6mG8sd%2F5km%2BIL%2FpDL1IXt7KpAhUA0
    i5y3%2Fz5n%2F7E8FnSbpvbY5qxc6g%3D
    Shows a new window with :
    http://SUP-CS-60.admin.ulb.priv:1090/ContentServer/ContentServer.dll?
    But of course no document is shown. It seems like the parameters are gone from the URL.
    (The URL is not to be suspected as it is working from BEX Analyser. So it seems like the URL is well generated but cut when the portal is making the jump to the Content Server).
    Any idea of what could be done to resolve this?
    Thanks and best regards,
    Thomas

    Hello,
    I'm still stuck with this problem.
    A related question maybe easier:
    Is it possible from a WAD to open a document from the Content Server?
    Thanks,
    Thomas

  • Migration of Content Server from win2k3 to win2k8

    Hello,
    Now we have installed Conteny Server 6.40 on Windows 2008 server.
    URL check for the Contenet Server is also working.
    We wanted to migrate from Content Server windows 2003 server to Windows 2008 server.
    In the process we have successfully taken the Back up of Content Server on win2k3 server and restored it on win2k8 server.
    Maxdb is the database that we are using.
    Now,i wanted to know what are the steps to be follwoed after the successfull restore.
    How to create Respository and regarding of ContentServer.ini file and security folder settings ( they need to be copied and if yes when?).
    Please help with your suggestions or giving out some referenece documents.
    Thanks,
    deepak

    It depends largely on how you have installed Content Server but if you check the [Operating Manual for SAP Content Server|http://help.sap.com/erp2005_ehp_04/helpdata/EN/8c/e9ddbb5d9a524bbb7854d31b963248/frameset.htm] -> Special Procedures ...it should give enough info for your requirements.
    Nelis

  • DMS: Relocation of storage category/documents to another content server

    Our DMS content server was implemented with a 3-tier environment (dev-test-production).  There are several SAP instances storing documents to a shared storage category in the global DMS server.
    I found recently that one of the production instances on 4.6C was inadvertently configured to store documents on the DMS development server in this same storage category name.
    I have found programs to relocate documents from one storage category to another, which could be used if I configured a new storage category pointing to the production content server.  However, for business reasons the name of the storage category should not be changed.
    Note 445057 and document "Operational Guide - SAP Content Server" provide information on relocation of documents using programs RSCMSEX (export) and RSCSMIM (import).  I would like to use these reports to export the documents stored incorrectly on the development server, change the configuration of the content server to the production server address, and import the documents back into the existing storage category.
    The documentation does not state whether RSCMSIM will add the imported documents to existing content or will delete all other documents.  I would like to insure that I will not lose existing documents in the production server.
    I would appreciate advice or feedback from anyone familiar with these programs or relocating documents in DMS.
    Thank you,
    Kathie

    Hi Aby,
    if setting up a profile does not help, another proposal would be to use the BADI DOCUMENT_STORAGE01 with method BEFORE_LIST_STORAGECAT. Because here you will be able to influence which storage categories are displayed at "Check in to Kpro and Selecting the storage category". If only one category is handed back by the BADI method the pop-up should be avoided and the selected category should be choosen.
    Maybe this could be a solution.
    Best regards,
    Christoph

Maybe you are looking for