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

How to read data from the excel file using java code.

Hi to all, I am using below code to getting the data from the excel file but I can't get the corresponding data from the specific file. can anyone give me the correct code to do that... I will waiting for your usefull reply...... advance thanks.... i

How to compare two huge xml files(50MB+) using Java Code

I want to compare two huge xml files using java code and need to find the difference of those xml files is there any API for thatYou should find third party APIRead other 2 answers

Run batch files through java code

Hi All I need to run a batch file using java code . I am not getting any error, but also no output. Can someone let me know the problem with my code.The code i am using is import java.io.*; public class batchtest {      public static void main(String

Opening a template indd file using java API

How do I open a template indd file using java API and use it for laying out graphics and text ? Thanks in advanceSample code: VariableType vtDocument = myApp.open(VariableTypeUtils.createFile("c:\\myfile.indd")); myDocument = DocumentHelper.narr

How to launch Jar file in Mac Os using java code??

can anyone tell me how can i launch another jar file in my apllication using java code.define "launch". - You want to run a new java program in a separate process? (see Runtime.exec()) - You want to run a method in a specific class in the jar? (

Unzipping files using java.util

I am trying to unzip files using java.util.zip It works fine when I am trying to unzip a file that is already residing on the server. But I want to unzip the file that user will upload to the server . My code is uploading zip file to server but not a

How Can I execute a java program using java code?

{color:#000000}Hello, i am in great trouble someone please help me. i want to execute java program through java code i have compiled the java class using Compiler API now i want to execute this Class file through java code please help me, thanks in a

How to read pdf files using java.io package classes

Dear All, I have a certain requirement that i should read and write PDF files at runtime. With normal java file IO reading is not working. Can any one suggest me how to proceed probably with sample code block Thanks in advance.hi I also have the pbm.

How can i generate BARCODE Images using JAVA Code

Hello , My requirement is to generate BarCode Images to Print using JAVA Code. User will give only 1) String.as Input Parameter and 2) Type of Encoding you want to apply on to the String. outPut : code should generate Bar Code Images as per the requi

How to dynamically configure JPA setting at runtime using java code?

Hi, I am new to EJB 3.0 and JPA. I am trying to help my company to deploy the use of JPA in EJB3.0. Currently, i am trying out with OpenJPA in IBM Webshpere Application Server 7.0. We have four different WAS servers running for testing, system integr

How to write as XML file using java 1.5

hi all, i am trying to create an XML file using java 1.5. I took a XML creating java file which was working with java 1.4 and ported same file into java 1.5 with changes according to the SAX and DOM implmentation in java 1.5 and tried to compile. But

Append to jar file using java codings

Hi, I have codings which could create jar file and write datas in it. but i need to append datas to existing jar file using java codings.Here i have attached my codings which will write datas to new jar file. when ever i use this my existing contents

How to read a text file using Java

Guys, Good day! Please help me how to read a text file using Java and create/convert that text file into XML. Thanks and God Bless. Regards, I-Talk     public void fileRead(){              File aFile =new File("myFile.txt");          BufferedRea

How to uncompress zip files using java program

hai, please give some sample code to decompress the zip file. how to uncompress zip files using java program thanking you arivarasuhttp://developer.java.sun.com/developer/technicalArticles/Programming/PerfTuning/ Scroll down to 'Compression'Read othe

How can zip file using java ?

I would like to ask is that any package or example code allowing zipping serveral file using java ?Here's a test program I wrote, which may help. As far as I know the jip/zar classes are interchangeable. import java.io.*; import java.util.jar.*; publ

How to get MAC address using java code

hi friends please write me, How can I get MAC Address of local machine using java code.I don't want to use JNI. Please reply me. Its urgent for me Thanks in advance USYou have several ways under *nix ifconfig -a | grep HWwill output something like et

How can we get requester's user id using java code

Hi, How can we get requester's user id using java code? eg: If i had logged in as xelsysadm and request a resource for user uid101 on the userid field it should display uid101 and not xelsysadm. also, I have a resoure "A" which on revoking shoul

Running bat files in java code

Hi, I am trying to run a .bat file within java code like this. Runtime.getRuntime().exec("c:\\Test.bat"); but no success. Could you please suggest how to run .bat file or simply a DOS command from java code. thanx in advance Deepak Garg.try this

How to print PDF files using java print API

Hi, I was goign throw lot of discusion and reading lot of forums related to print pdf files using java api. but nothing seems to be working for me. Can any one tell me how to print pdf files using java api. Thanks in advanceMike, Can't seem to get ho