Skip to Content
author's profile photo Former Member
Former Member

Issue with document retrieval using BAPI_DOCUMENT_CHECKOUTVIEW2

I am having an issue to get the document from DMS using BAPI_DOCUMENT_CHECKOUTVIEW2.

When I executed the BAPI from SE37 I see that the file is created in my local machine C:/temp folder.

However when I execute the BAPI from MII using JCo action block, I dont see the file neither in local machine nor in MII sever.

These are the parameters I am passing:

DocumentNumber - with leading zeros



GetStructure - "1"

Getcomponents - "X"

GetHeader - "X"




I see that the BAPI executes successfully and returns the doc file path as C:/Temp/xyz

however I dont see this document anywhere.

where can I expect the file to be created, is it in my local machine or MII Server?

Note: I now have SAP GUI installed on MII Sever, still document is not created.

Please advice.

Edited by: Srinivas Kumar on Nov 19, 2011 1:36 AM

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Nov 21, 2011 at 01:17 PM

    It should be created on the MII Server. I would check the destinations and see if you can point the destination to one of the following depending upon your usage: web://, db://, server://

    [web vs db|difference-between-accessing-'web'-and-'db']



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Mike,

      Is it required to customize the BAPI and replace the path from "C://Temp/" to "WEB://MIIFolderName" or can this be passed as a parameter to the BAPI?

      In either case don't we need to use MII Server and port number?

      When I pass just the WEB://MIIFolderName to ORIGINALPATH input node, I get an error message "File Web://MIIFolderName/username.doc" cannot be created"

      And when I pass <IP>:<PORT> to HOSTNAME input node, I get error message (this time in with less response time) - "Network address "<IP>:<PORT>" of your computer is not maintained"

      Please advice.

  • author's profile photo Former Member
    Former Member
    Posted on Nov 23, 2011 at 11:02 PM

    You can try using SDOK_PHIO_LOAD_CONTENT to get files from DMS instead of BAPI_DOCUMENT_CHECKOUTVIEW2

    This snippet from here:

    [Sdn Code Example|] shows how to get the id and class for a document:

    SELECT  lo_objid 
                 INTO TABLE it_lo_objid 
                 FROM dms_doc2loio 
                WHERE dokar = documenttype 
                  AND  doknr = documentnumber 
                  AND dokvr  = documentversion 
                  AND doktl = '000'. 
        v_counter = 1. 
        LOOP AT it_lo_objid INTO wa_lo_objid. 
          SELECT SINGLE phio_id 
                 INTO   (wa_object_id-objid ,wa_object_id-class) 
                 FROM    dms_ph_cd1 
                 WHERE   loio_id = wa_lo_objid.

    Call SDOK_PHIO_LOAD_CONTENT via JCo action an concatenate all of the FILE_CONTENT_BINARY LINE items into one string.

    Because the Binary data gets base64 encoded when formatted into the return XML use the Http Post Action to post the string (with content type multipart/form-data) to a jsp like this one:

    <%@ page import="java.util.*" %> 
    <%@ page import="*" %> 
    <%@ page import="java.lang.Exception"; %> 
    <%@ page import="java.lang.String"; %> 
    <%@ page import=""; %> 
    <%@ page import="*" %> 
    <%@ page import=""; %> 
    <%@ page import=""; %> 
    <%@ page import=""; %> 
    <%@ page import=""; %> 
    <%@ page import=""; %> 
    //get our user and check against a custom file upload role. 
    IUser user = UMFactory.getUserFactory().getUserByUniqueName(SessionHandler.getUser(request).getName()); 
    if(user.isMemberOfRole("ROLE.UME_ROLE_PERSISTENCE.un:CUSTOM_FILE_LOAD_ROLE", true)){ 
    BufferedReader bRead = request.getReader(); 
    String line = null; 
    StringBuffer theText = new StringBuffer(); 
    while((line=bRead.readLine())!=null){ theText.append(line); } 
    String base64 = theText.toString(); 
    byte decoded[] = new sun.misc.BASE64Decoder().decodeBuffer(base64); 
    try { 
    // FileUpload/FileStore/ will save uploaded file to the MII web container - FileUpload/WEB/FileStore"FileUpload/FileStore/" + request.getParameter("FILENAME") , decoded , SessionHandler.getUser(request), false,null, false); 
    out.println("<BR> File " + request.getParameter("FILENAME") + " Loaded"); 
    } catch (Exception e) { out.println("ERROR: "  + e.getMessage()  );} 
    }else { out.println("ERROR: USER HAS NO AUTHORY TO UPLOAD FILES ");} 

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.