on 01-05-2006 3:46 PM
Hello everybody,
I have a problem to check out a document, when there is more than one document attached to one document number(JCO 2.0.8).
I use getDocumentDetails() to get the FILE_ID of the requested document, but somehow I have no success to pass the FILE_ID to BAPI_DOCUMENT_CHECKOUTVIEW2.
Anybody here with a clue ?
Best regards
Andreas
--- Code Snippet -
public static void getDocument(IRepository repository, JCO.Client client, String docNumber,String docType, String docVer, String docPart) throws Exception {
String fileID=getDocumentDetails( repository, client, docNumber, docType, docVer, docPart);
JCO.setMiddlewareProperty("jco.middleware.allow_start_of_programs", "sapftp");
IFunctionTemplate ftemplate = repository.getFunctionTemplate("BAPI_DOCUMENT_CHECKOUTVIEW2");
// Create a function from the template
JCO.Function function = new JCO.Function(ftemplate);
JCO.ParameterList input = function.getImportParameterList();
input.appendValue("DOCUMENTTYPE", JCO.TYPE_CHAR, 3, docType);
input.appendValue("DOCUMENTNUMBER", JCO.TYPE_CHAR, 25, docNumber);
input.appendValue("DOCUMENTVERSION", JCO.TYPE_CHAR, 2, docVer);
input.appendValue("DOCUMENTPART", JCO.TYPE_CHAR, 3, docPart);
input.appendValue("ORIGINALPATH", JCO.TYPE_CHAR, 255, "D:
SAPTemp
");
//this does not work
input.appendValue("DOCUMENTFILE-FILE_ID", JCO.TYPE_CHAR, 32, "fileID");
//this does not work either
JCO.Structure struct = (JCO.Structure)function.getImportParameterList().getStructure("DOCUMENTFILE");
struct.setValue(docType, "DOCUMENTTYPE");
struct.setValue(docPart, "DOCUMENTNUMBER");
struct.setValue(docVer, "DOCUMENTVERSION");
struct.setValue(docPart, "DOCUMENTPART");
struct.setValue(fileID, "FILE_ID");
client.execute(function); //-> Exception
...
}
public static String getDocumentDetails(IRepository repository, JCO.Client client, String docNumber,String docType, String docVer, String docPart) throws Exception {
String fileID="";
IFunctionTemplate ftemplate = repository.getFunctionTemplate("BAPI_DOCUMENT_GETDETAIL2");
// Create a function from the template
JCO.Function function = new JCO.Function(ftemplate);
JCO.ParameterList input = function.getImportParameterList();
input.appendValue("DOCUMENTTYPE", JCO.TYPE_CHAR, 3, docType);
input.appendValue("DOCUMENTNUMBER", JCO.TYPE_CHAR, 25, docNumber);
input.appendValue("DOCUMENTVERSION", JCO.TYPE_CHAR, 2, docVer);
input.appendValue("DOCUMENTPART", JCO.TYPE_CHAR, 3, docPart);
client.execute(function);
....
JCO.Table docList = function.getTableParameterList().getTable("DOCUMENTFILES");
...
fileID= (String) docList.getValue("FILE_ID");
..
return fileID;
}
Message was edited by: Andreas Schmidt
Hi,
Check if the File_ID is being returned by getDocumentDetails() by Printing out or Logging the File_ID value after the file_id retrival step in your code.
And do check if there is any attribute which is unique like timestamp of the file similar to File_Id and try to use that attribute in your code to checkout the desired file.
Hope this will help you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Cool you got the Output !!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.