Not able to checkout Files using Java Code and SAP BAPI  from DMSServer

Advertisement
Hi
Able to download / checkout the files using T-Code SE37 (BAPI_DOCUMENT_CHECKOUTVIEW2).
But when same RFC is executed from Java, it alsways says -
Message ::::::::Document LGL/10000000003/000/00 does not exist
My inputs in Java Code is as below -
import java.io.*;
import java.util.*;
import com.sap.mw.jco.*;
//CREATED ON - 10-APRIL-2010.
public class BapiDocCheckOutview {
     public static void main(String args[]){
          try{
               if(mConnection!=null){
JCO.Repository repository=new JCO.Repository("AraSoft",mConnection);
JCO.setMiddlewareProperty("jco.middleware.allow_start_of_programs", "SAPFTPA");
JCO.Function function=repository.getFunctionTemplate("BAPI_DOCUMENT_CHECKOUTVIEW2").getFunction();
                    //End of get function.
                 System.out.println("Before execution1");
                 if(function !=null){
               JCO.Field DOCUMENTTYPE = function.getImportParameterList().getField("DOCUMENTTYPE");
                DOCUMENTTYPE.setValue("LGL");
                JCO.Field DOCUMENTNUMBER = function.getImportParameterList().getField("DOCUMENTNUMBER");
                DOCUMENTNUMBER.setValue("10000000003");
                JCO.Field DOCUMENTPART = function.getImportParameterList().getField("DOCUMENTPART");
                DOCUMENTPART.setValue("000");
                JCO.Field DOCUMENTVERSION = function.getImportParameterList().getField("DOCUMENTVERSION");
                DOCUMENTVERSION.setValue("00");
                JCO.Field GETSTRUCTURE = function.getImportParameterList().getField("GETSTRUCTURE");
                GETSTRUCTURE.setValue("1");
JCO.Field GETCOMPONENTS = function.getImportParameterList().getField("GETCOMPONENTS");
             GETCOMPONENTS.setValue("X");
JCO.Field ORIGINALPATH = function.getImportParameterList().getField("ORIGINALPATH");
              ORIGINALPATH.setValue("C:
TEMP
DMS_");
JCO.Field GETHEADER = function.getImportParameterList().getField("GETHEADER");
                      GETHEADER.setValue("X");
JCO.Field PF_FTP_DEST=function.getImportParameterList().getField("PF_FTP_DEST");
          PF_FTP_DEST.setValue("SAPFTPA");
//JCO.Field PF_HTTP_DEST=function.getImportParameterList().getField("PF_HTTP_DEST");
     //PF_HTTP_DEST.setValue("SAPHTTPA");
                      System.out.println("Here Setting Values Inside Structure ::DOCUMENTFILE");
JCO.Structure DOCUMENTFILE=function.getImportParameterList().getStructure("DOCUMENTFILE");
DOCUMENTFILE.setValue("1","ORIGINALTYPE");
DOCUMENTFILE.setValue("WWI","WSAPPLICATION");
DOCUMENTFILE.setValue("ZHCL_CS","STORAGECATEGORY");
DOCUMENTFILE.setValue("E0DF7893E2BD5DF19C07001517B4A299","APPLICATION_ID");
DOCUMENTFILE.setValue("E0DF7893E2BD5FF19C07001517B4A299","FILE_ID");
DOCUMENTFILE.setValue("X","CHECKEDIN");
DOCUMENTFILE.setValue("X","ACTIVE_VERSION");
                        //DOCUMENTFILE.setValue("LGL","DOCUMENTTYPE");
                        //DOCUMENTFILE.setValue("10000000003","DOCUMENTNUMBER");
                        //DOCUMENTFILE.setValue("000","DOCUMENTPART");
                        //DOCUMENTFILE.setValue("00","DOCUMENTVERSION");
                      //JCO.Field GETCOMPONENTS = function.getImportParameterList().getField("GETCOMPONENTS");
                      //GETCOMPONENTS.setValue("X");
                      //JCO.Field GETHEADER = function.getImportParameterList().getField("GETHEADER");
                      //GETHEADER.setValue("X");
                    mConnection.execute(function);
If anyone have an Idea on what I have missed out...
Please do advice me.
Thanks
Prashant
Advertisement

Replay

Hi
To update in the initial requirement, I have added (prefixed, zeroes) in Document No., doing that, now the  application is able to find the document, but not able to transfer the same from DMS Server to my local Machine, always giving the following error -
Type ::::::::E
Message ::::::::File d:\dms\z_IPI_PRASHANT01.doc cannot be created
Please let me know, if some services needed to checked in SAP System or some more information to be provided in RFC.
Thanks
Prashant
Dear Experts
Any advice on this. Still not able to download the documents from DMS Server.
I have also added few more code in my Java program -
     private int use_sapgui;
     public void setSapGui(int use_sapgui){
          use_sapgui = 2;
PLease help !!
Regards
Edited by: Prashantroy on Sep 26, 2011 12:49 PM
Hi,
Further to my earlier Mail, while checking the Trace suing SM59 in ECC System I got  the following Error -
Trace file opened at 20111010 142232 India Standard Time, SAP-REL 701,0,134
======> cannot open SAPGUI
ABAP Programm: SAPLSYSE (Transaction: )
User: IPI_PRASHANT (Client: 220)
Destination: SAPFTP (handle: 3, , )
SERVER> RFC Server Session (handle: 1, 43220900, {5D1DF3E0-ACBD-F11F-8EA0-00A0D1
SERVER> Caller host:
SERVER> Caller transaction code:  (Caller Program: java)
SERVER> Called function module: RFC_START_PROGRAM
Error RFCIO_ERROR_SYSERROR in abrfcpic.c : 1742
FUNCTION: 'exec_sapgui'
cannot open SAPGUI
PROG =sapftp erpdev sapgw00 43232164 IDX=4
Can someone help me in getting this sorted out.
Thanks N Regards
Edited by: Prashantroy on Oct 10, 2011 2:32 PM