on 11-19-2011 12:36 AM
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
DocumentPart
DocumentVersion
GetStructure - "1"
Getcomponents - "X"
GetHeader - "X"
DocumentType
PF_FTP_DEST - "SAPFTPA"
PF_HTTP_DEST - "SAPHTTPA"
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
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|http://wiki.sdn.sap.com/wiki/display/Snippets/CodetogetthecontentofanattachmentinDMandmailittoexternalemailid] 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
ph_class
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="java.io.*" %>
<%@ page import="java.lang.Exception"; %>
<%@ page import="java.lang.String"; %>
<%@ page import="com.sap.xmii.Illuminator.security.User"; %>
<%@ page import="com.sap.xmii.Illuminator.common.*" %>
<%@ page import="com.sap.xmii.Illuminator.content.ContentManager"; %>
<%@ page import="com.sap.xmii.system.SessionHandler"; %>
<%@ page import="com.sap.security.api.IUser"; %>
<%@ page import="com.sap.security.api.UMFactory"; %>
<%@ page import="com.sun.org.apache.xerces.internal.impl.dv.util.Base64"; %>
<%
//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
ContentManager.save("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 ");}
%>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
User | Count |
---|---|
9 | |
7 | |
3 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.