Starting transaction in SAPGUI via JCo

Hello,
I'm trying to start SAPGUI for Windows using parameter
setSapGui(1), but the GUI Window does not show. When I'm using setAbapDebug(true)than the GUI window starts in debug mode.
What can be wrong? Does anyone have any ideas?
I'm trying to start transaction se11 using BAPI RFC_CALL_TRANSACTION.
Code looks like this:
// Obtain parameter list for function
      JCO.ParameterList input = function.getImportParameterList();
       // Obtain table for function
       JCO.Table BDCtable = function.getTableParameterList().getTable("BDCTABLE");     
      //BDCtable.setRow(0);
      BDCtable.appendRows(4);
      BDCtable.setValue("SAPMSRD0", "PROGRAM");
      BDCtable.setValue("0102", "DYNPRO");
      BDCtable.setValue("X", "DYNBEGIN");
      BDCtable.nextRow();
      BDCtable.setValue("BDC_CURSOR", "FNAM");
      BDCtable.setValue("RSRD1-TBMA_VAL", "FVAL");
      BDCtable.nextRow();
      BDCtable.setValue("BDC_OKCODE", "FNAM");
      BDCtable.setValue("=SHOW", "FVAL");
      BDCtable.nextRow();
      BDCtable.setValue("RSRD1-TBMA", "FNAM");
      BDCtable.setValue("X", "FVAL");
      BDCtable.nextRow();
      BDCtable.setValue("RSRD1-TBMA_VAL", "FNAM");
      BDCtable.setValue("BUKRS", "FVAL");
      BDCtable.nextRow();
      BDCtable.setValue("SAPMSRD0", "PROGRAM");
      BDCtable.setValue("0102", "DYNPRO");
      BDCtable.setValue("X", "DYNBEGIN");
      // Pass function parameters
      input.setValue(transactionName, "TRANCODE");
      //input.setValue(daneKlienta, "DANE_KLIENTA");
      conn.execute(function, conn.createTID());
Regards Artur
Message was edited by: Artur Welke

Hi Artur,
This answer is in relation to BSP but i think concept is same, it will give you an idea. This answer is taken from
Brain's <a href="/people/brian.mckellar/blog/2003/10/23/bsp-trouble-shooting-frequently-asked-short-questions weblog.
<i>Typical question: "We have developed a BSP application and we're trying to call some function. It doesn't work. However, if we execute the BSP application in debug mode, everything works fine. Why?"
When you log onto a WebAS system the Dynpro engine is started that contains all the logic to handle interaction with the SAPGUI. For example, things such as rendering controls and doing file upload/download are all available.
When you run an HTTP request into Web AS, a very special "dark" (or background) Dynpro is started. A minimal Dynpro is required to get ABAP up and running. But now there is no SAPGUI available, so no SAPGUI-based service will work. Also little things such as popup windows do not work.
So why does the code work in the debugger? Because, once the debugger is triggered,it realizes that a normal Dynpro is required for the debugger and not the "dark" one. So the full-blown Dynpro engine is started, making all SAPGUI services available.
You can consider finding the code that causes the error and bracket it with IF-statements in this function, so that no SAPGUI interaction is required in the context of a HTTP call.</i>
Also visit this <a href="https://www.sdn.sap.com/sdn/collaboration.sdn?contenttype=url&content=https%3A//forums.sdn.sap.com/thread.jspa%3FthreadID%3D35880%26tstart%3D60">thread</a>, this will certainly help you.
Regards,
Narinder Hartala

Similar Messages

  • Starting SAPGUI via ActiveX

    HI,
    I'm trying to find an example of starting the SAP GUI via ActiveX / OCX. I'd like the same functionality as provided by the Enterprise Portal but within a normal HTML page.
    If this post belongs to another forum, then maybe someone can make another suggestion. I looked and didn't find anything better.
    Thanks.
    Dick

    option 1. use sap short cut , and the details can be found i this thread
    call SAP transaction from BSP- SAP ShortCut
    option 2. sapgui scripting using sap java gui
    Re: Calling SAP Transaction from BSP
    option3 sapgui scripting using sap windows gui
    SAPGUI scripting API - http://www.synactive.com/download/sap%20gui%20scripting/sap%20gui%20scripting%20api.pdf
    i have seen a example coding eithe rin BSP or in SAPGUI forum, but couldnt find it. but using the API documentation given above, you can create one.
    Raja

  • Start/Stop a tablespace via SAP transaction

    Dear All,
    I'm just wondering about start/stop a tablespace via SAP transactions. Is it possible? At the moment i'm working on SAP Netweaver (DB Server:DB2 8.1/z/os 1.7, AS:AIX 5.2).
    Many thanks for your help.
    Regards,

    Thanks Thomas for the fast answer!
    Starting right now to write my commands
    Best regards,
    Andrea

  • MSS:  Cannot Start Transaction HRWPC_FC_EXEC

    We have three custom ABAP reports setup for the 'Reports' tab in MSS.  Two of them work fine, but one of them is giving this error message:
    Cannot Start Transaction
    The Internet Transaction Server could not start the transaction "HRWPC_FC_EXEC" because of the following error: .
    It doesn't give an error message, so I have no idea what the error is.  Any ideas?

    I would check/try the following:
    1)Does the transaction exist and does it need to be published to the ITS?
    2)Does the user have the appropriate security profile to run the report - try with SAP_ALL and SAP_NEW as a test?
    3)Run the transaction directly in R/3 SAPGui with your test user ID, what happens?
    4)Is your test user appropriately integrated into your org chart (does the MSS report rely on this?)
    Just some ideas.... hope something gives you a clue

  • SRM portal: Cannot start transaction for shopping cart -wizard

    Hello All,
    User is not able to access the Shopping cart-wizard in EB portal, user has updated the internet  explorer to internet explorer V7 still he is not able to access.
    When user clicks on Shopping cart-wizard he gets the following error "Cannot Start Transaction**
    *The internet transaction server could not start the transaction "BBPSC02"* .
    Please let me know how can I resolve this issue.
    Have checked the attributes for this user it is maintained to access portal, all roles are properly assigned.
    Thanks.

    Hello,
    Service BBPSC02 is only not started from portal or you cannot start it as well when using the ITS link?
    Are you able to test the service via transaction SICF?
    Regards,
    Ricardo

  • Editing Loop Start and End times via automation / MIDI controllers?

    I'm trying to play a sample in EXS24 and have the Sample Start, Loop Start and End times manipulated over the course of the song. I've tried to open up the EXS sample editor, click on the numerical value of the Loop Start, and then attempt to Learn Automation. All it does is assign the knob for the instrument Volume Level. Is there any way to do this? It's basically how an Akai S612 works: http://www.vintagesynth.com/akai/s612.shtml
    I switched gears and tried it also with Battery, and there's a way to map the Start and End times in there, but it's not seeming to work as I've intended. I can't seem to make the loops move as they should and there's ways to use up to 4 loops, but not a way to target each loop's start and end points via separate controllers.
    I could use my S-612 [and probably will], but in moments where I don't have one available, I'd love to find a solution to this.
    Thanks,
    +odd

    Anyone with any thoughts? would be great to solve this.

  • How can I disable POST GOODS RECEIPT button in transactions VL31N/VL32N via Authorization or Role Level.

    How can I disable POST GOODS RECEIPT button in transactions VL31N/VL32N via Authorization or Role Level, There is a requirement from my client  and i propose two methode
    1- Creation of Ztcode ZVL32N and do changes ABAP program level
    2- Disablement via Authorization/Role level - but how can i find the auth object/ Authorization corresponds to POST GOODS RECEIPT button in VL32N

    I think you can make use of SHD0 - Transaction variant to achieve this. You can make it as grayed out while recording steps in SHD0.

  • How to connect to R/3 via JCo using MYSAPSSO2?

    Hello!
    I'm developing a J2EE application who resides in an EP with Single Sign On. I have to retrieve some data from R/3, the way I want to connect is via JCo using MYSAPSSO.
    I have read that is possible to connect passing MYSAPSSO2 as <i>user</i> and its value as <i>password</i>. The java code in the jsp is something like this:
    javax.servlet.http.Cookie [] my_cookies = request.getCookies();
    java.util.Hashtable cks = new Hashtable();
    for(int i=0;i<my_cookies.length;i++){
         cks.put(my_cookies<i>.getName(),java.net.URLDecoder.decode(my_cookies<i>.getValue()));
    String user = "$MYSAPSSO2$";
    String pass = (String)cks.get("MYSAPSSO2");
    JCO.Client conex;
    JCO.Repository rep;
    boolean ok=true;
    conex = JCO.createClient("000",user,pass,"es","192.168.0.1","00","","");
    try{
         conex.connect();
         rep = new JCO.Repository("mirep",conex);
    } catch (Exception e){
         out.write("<br>"e"<br>");
         ok = false;
    if (ok)
         conex.disconnect();
    We are working with EP6 SP2, WAS 6.20.
    The error is:
    com.sap.mw.jco.JCO$Exception: (103) RFC_ERROR_LOGON_FAILURE: Se ha recibido un ticket SSP que no se puede interpretar
    (I translate you:)
    RFC_ERROR_LOGON_FAILURE: unable to interpret a retrieved SSP ticket
    Thank you all!!

    Ok!
    I have solve the problem. So, I was trying to connect via SSO within an user that was not registered in R/3 and I forgot it.
    Sorry for the inconvenience.

  • Error during data transfer from Lotus Notes to SAP via JCO - Urgent Help Required

    Dear SAP Expert:
    I need your help! Recently getting error during data transfer to SAP. I need your suggestion!
    I am transferring Lotus Notes data to SAP via JCO, recently getting the below error msg, could you pls tell me what could be the reason?
    Please suggest me how to fix that kind of issue.
    "com.sap.mw.jco.JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: Error in ABAP/4 statement when processing an internal table. table.
    at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeExecute(Native Method)
    at com.sap.mw.jco.rfc.MiddlewareRFC$Client.execute(MiddlewareRFC.java:1244)
    at com.sap.mw.jco.JCO$Client.execute(JCO.java:3842)
    at com.sap.mw.jco.JCO$Client.execute(JCO.java:3287)
    at SAPAdapter.execute(Unknown Source)
    at JavaAgent.fillBapiAndWriteBackToNotes(Unknown Source)
    at JavaAgent.NotesMain(Unknown Source)
    at lotus.domino.AgentBase.runNotes(Unknown Source)
    at lotus.domino.NotesThread.run(NotesThread.java:249)
    Thanks in advance! Your help would be highly appreciated! Thanks again!

    error is clear, check your abap code.

  • Problem starting transaction for MDB

              Hello All,
              I have a MDB configured as Container managed transaction.
              Sometimes I rollback a message sent to a Queue.
              The problem is that sometimes the WEBLOGIC log show the follow error and do not
              start a JMS service.
              Anyone had this problem before?
              Thanks.
              <Mar 3, 2004 4:51:13 PM GMT-03:00> <Error> <JTA> <BEA-110424> <An unexpected exception
              was caught during begin: java.lang.NullPointerException
              at java.security.SecureRandom.setSeed(SecureRandom.java:369)
              at weblogic.transaction.internal.XidImpl.seedRandomGenerator(XidImpl.java:378)
              at weblogic.transaction.internal.XidImpl.create(XidImpl.java:266)
              at weblogic.transaction.internal.TransactionManagerImpl.getNewXID(TransactionManagerImpl.java:1719)
              at weblogic.transaction.internal.TransactionManagerImpl.internalBegin(TransactionManagerImpl.java:249)
              at weblogic.transaction.internal.ServerTransactionManagerImpl.internalBegin(ServerTransactionManagerImpl.java:303)
              at weblogic.transaction.internal.ServerTransactionManagerImpl.begin(ServerTransactionManagerImpl.java:259)
              at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:253)
              at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2596)
              at weblogic.jms.client.JMSSession.execute(JMSSession.java:2516)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
              >
              <Mar 3, 2004 4:51:13 PM GMT-03:00> <Error> <JMS> <BEA-040368> <The following exception
              has occurred:
              java.lang.RuntimeException: [EJB:010166]Error occurred while starting transaction:
              javax.transaction.SystemException: java.lang.NullPointerException.
              at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:277)
              at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2596)
              at weblogic.jms.client.JMSSession.execute(JMSSession.java:2516)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
              >
              

    Thanks for ur help!
              WLS 8.1
              <JDBCTxDataSource EnableTwoPhaseCommit="true"
              JNDIName="JDBCDataSource" Name="JDBCDataSource"
              PoolName="JDBCConnectionPool" Targets="myserver"/>
              WLS 7.0
              <JDBCDataSource JNDIName="JDBCDataSource" Name="JDBCDataSource" PoolName="JDBCConnectionPool"/>
              Because JDBCDataSource is the default datasource when you create a new datasource in WLS7.0, JDBCTXDataSource is the default datasource in WLS8.1.
              After I changed the config.xml, it's ok!
              > Can u please post the DB Connection Pool & DataSource
              > part of config.xml from both (7 & 8.1) your
              > environments ?
              >
              >
              > Cheers!
              > Dips

  • Create a new routing with BAPI BAPI_ROUTING_CREATE via JCo

    I try to create a new routing with BAPI BAPI_ROUTING_CREATE via JCo.
    I filled all necessary parameters. I also realized a commit_work. I get in the RETURN parameter of the BAPI the Message "S 000 Routing N/50001641/01". But the routing isn't in the database. Other JCo programs I wrote (create material master or costumer order) are working very well.
    Have anyone an idea?
    Thanks Jörg
    Here's my coding:
    public void createArbeitsplan() {
              doLogin();
    //          connectionAttributes();
              Plan plan = new Plan();
              for (int i = 0; i < planList.size(); i++)
                   plan = (Plan) planList.get(i);
                   //Ein Function-Objekt erzeugen
                   String bapi = "BAPI_ROUTING_CREATE";
                   JCO.Function savePlan = null;          
                   try { savePlan = this.createFunction(bapi); }
                   catch(Exception ex) { ex.printStackTrace(); System.exit(1); }
                   if(savePlan == null) { System.err.println(bapi + " not found in SAP"); System.exit(1); }
                   //Import und Tabellen füllen
                   // Plankopf
                   JCO.Table headData = savePlan.getTableParameterList().getTable("TASK");
                   headData.appendRow();
                   headData.setValue(plan.kurztext,"DESCRIPTION");
                   headData.setValue("1","TASK_LIST_USAGE");
                   headData.setValue(werks,"PLANT");
                   headData.setValue("4","TASK_LIST_STATUS");
                   headData.setValue("ST","TASK_MEASURE_UNIT");
                   headData.setValue("001","RESP_PLANNER_GROUP");
                   headData.setValue("20070101","VALID_FROM");
                   headData.setValue("20991231","VALID_TO_DATE");
                   headData.setValue("1","LOT_SIZE_FROM");
                   headData.setValue("99999999","LOT_SIZE_TO");
                   // Materialzuordnung
                   JCO.Table materialAlloc = savePlan.getTableParameterList().getTable("MATERIALTASKALLOCATION");
                   materialAlloc.appendRow();
                   materialAlloc.setValue(plan.material,"MATERIAL");
                   materialAlloc.setValue(werks,"PLANT");
                   materialAlloc.setValue("20070101","VALID_FROM");
                   materialAlloc.setValue("20991231","VALID_TO_DATE");
                   materialAlloc.setValue("1","GROUP_COUNTER");
                   // Vorgänge
                   JCO.Table operationData = savePlan.getTableParameterList().getTable("OPERATION");
                   for (int j = 0; j < plan.getAnzahl(); j++) {
                        operationData.appendRow();
                        operationData.setValue(plan.getVorgang(j).vorgang,"ACTIVITY");
                        operationData.setValue(plan.getVorgang(j).steuschl,"CONTROL_KEY");
                        operationData.setValue(plan.getVorgang(j).arbplatz,"WORK_CNTR");
                        operationData.setValue("1111","WORK_CNTR");
                        operationData.setValue(plan.getVorgang(j).text,"DESCRIPTION");
                        operationData.setValue(plan.getVorgang(j).basismenge,"BASE_QUANTITY");
                        operationData.setValue(plan.getVorgang(j).vw1,"STD_VALUE_01");
                        operationData.setValue(plan.getVorgang(j).vw2,"STD_VALUE_02");
                        operationData.setValue(plan.getVorgang(j).vw3,"STD_VALUE_03");
                        operationData.setValue(plan.getVorgang(j).ze1,"STD_UNIT_01");
                        operationData.setValue(plan.getVorgang(j).ze2,"STD_UNIT_02");
                        operationData.setValue(plan.getVorgang(j).ze3,"STD_UNIT_03");
                        operationData.setValue("1","DENOMINATOR");
                        operationData.setValue("1","NOMINATOR");
                        operationData.setValue("20070101","VALID_FROM");
                        operationData.setValue("20991231","VALID_TO_DATE");
                        operationData.setValue("ST","OPERATION_MEASURE_UNIT");
                   // Testflag
                   JCO.Structure test = savePlan.getImportParameterList().getStructure("TESTRUN");
                   test.setValue(" ","BAPIFLAG");
                   //BAPI ausführen (incl. Commit)
                   mConnection.execute(savePlan);
                   JCO.Function commit = null;
                   try {commit = this.createFunction("BAPI_TRANSACTION_COMMIT"); }
                   catch (Exception ex) { ex.printStackTrace();System.exit(1); }
                   JCO.ParameterList input = commit.getImportParameterList();
                   input.setValue("X","WAIT");
                   mConnection.execute(commit);
                   //Messages vom SAP-System holen
                   JCO.Table jcoReturn = savePlan.getTableParameterList().getTable("RETURN");
                   for (int k = 0; k < jcoReturn.getNumRows(); k++)
                        jcoReturn.setRow(i);
    //                    System.out.println(jcoReturn.getField("MESSAGE").getValue());
                        System.out.println(jcoReturn.getField("TYPE").getValue());
                        System.out.println(jcoReturn.getField("NUMBER").getValue());
                        System.out.println(jcoReturn.getField("MESSAGE_V1").getValue());
                        System.out.println(jcoReturn.getField("MESSAGE_V2").getValue());
                        System.out.println(jcoReturn.getField("MESSAGE_V3").getValue());
                        System.out.println(jcoReturn.getField("MESSAGE_V4").getValue());
                   JCO.Structure output = commit.getExportParameterList().getStructure("RETURN");;
                   System.out.println(output.getString("MESSAGE"));
                   System.out.println(output.getString("TYPE"));
                   System.out.println(output.getString("NUMBER"));
                   System.out.println(output.getString("MESSAGE_V1"));
              closeConnectionToSAP();
              System.exit(1);

    Hi,
    perhaps you could use
    BAPI_HRMASTER_SAVE_REPL_MULT
    Regards
    Bernd

  • Bapi problem via jco

    hi guys,
       i am using bapi via jco
       i am retrieving data,appending data  on standard funtional modules , ok, fine
      how  can i insert data into custom tables using bapi via jco...
      plz give me some steps...............
    thanks,
    tony

    Hi,
    Just to clarify (again) as far as I know yuo cannot directly access SAP tables via JCo calls from Java.  JCo only allows you to call function modules on teh SAP system.  Any database interaction (Select, Insert, etc.) has to be coded in ABAP inside the function module.  You then call the function module (which must be RFC enabled) via JCo in your Java.
    You can use standard function modules or you can create custom function modules if you need to acces custom tables or perform custom logic.
    Hope this helps,
    Gareth.

  • Attempt to start transaction on SQL server

    I have managed to successfully configure Oracle 8.1.7 on NT to retrieve data from a MS
    SQL Server (version 6.5)
    However, one of the databases we are accessing is set up as read only; Oracle is
    attempting a start transaction, as it recognises that the SQL server can take
    part in distributed transaction. I am doing something like
    insert into mytable (a, b, c) select a, b, c from remote_table@sql_server
    Because the SQL Server is in read-only mode, the 'start transaction' fails,
    and the insert statement fails as a whole (I've examined the trace file, and the
    error I'm getting is reproducable on the SQL server if I type it in)
    I've tried looking at the data dictionary, and sure enough it is set up for
    2 phase commit as per the documentation.
    My question is, can I tell Oracle to not attempt the 'start transaction' on the
    remote system? I've tried various DBMS_HS calls but to no avail (from the
    documentation I believe the agent overrides the data dictionary entries anyway)
    Thanks,
    Colin McPherson

    Colin,
    This looks like bug 1622021. This bug has been fixed in v9.0.1 of the gateway.

  • Execute Business Transaction from xMII via XI to SAP R/3

    Hello everyone,
             I have a requirement to post the SAP R/3 transaction from xMII via XI. Does anyone one could give me the steps needs to follow to accomplish this.
    Thanks,
    Mahesh

    Mahesh,
    So as i understand your flow is xMII -> XI -> SAP ECC. So basically in this case u can setup XI to host a web service and xMII can call the web-service and post the data to XI. You will have to get the WSDL for the XI Web Service and then use it in the Web Service action block in xMII to consume. You will also need to setup the soap adapter in XI to receive the web service call from xMII. Once xMII calls the web service, XI can then update the data into SAP ECC either thru Idoc or RFC adapter.
    So once your trigger point in xMII is activated, it should call the BLS which in turn will call the XI Web Service and post the data to XI.
    In case the scenario is the other way round you can also host your BLS as a Web Service in xMII. XI can then call the web service and send the data to xMII. Alternatively you can also use the http post action block in xMII to do the same.
    Let me know if you need anymore info.
    Thanks,
    Kapil.

  • How to via JCO Call RFC upload file to the SAP DMS.

    HI ,ALL :
      NOW i want to upload file via JCO,but i upload in sap gui is success ,but jco call RFC is error ,this is my code:
    excute this  code is not error ,but the data not write to SAP,
            //连接SAP
              Client client = com.hipfung.jco.JCOFactory.getInstance().getClient();
              JCO.Repository repo = new JCO.Repository("ZOA01", client);
              //调用RFC函数
              IFunctionTemplate ft = repo.getFunctionTemplate("CVAPI_DOC_CHECKIN");
              JCO.Function f = ft.getFunction();
              IFunctionTemplate ft2 = repo.getFunctionTemplate("BAPI_TRANSACTION_COMMIT");
              JCO.Function commitFunction = ft2.getFunction();
              //设置传入参数值(注意类型)
              //1.传入参数为Field
                f.getImportParameterList().setValue("TXB",          "PF_DOKAR");  //
              f.getImportParameterList().setValue("0000010101010101020000000","PF_DOKNR");  //文档类型
              f.getImportParameterList().setValue("01","PF_DOKVR");                          //文档版本
              f.getImportParameterList().setValue("000","PF_DOKTL");     
              f.getImportParameterList().setValue("SAPFTPA","PF_FTP_DEST");     
              f.getImportParameterList().setValue("SAPHTTPA","PF_HTTP_DEST");     
              // Get content as table
              f.getImportParameterList().setValue("TBL", "PF_CONTENT_PROVIDE");
            //read file and trans to byte
                      byte b[]=null;
                        File inf = new File("d:
    test.jpg");
                        InputStream in;
                        try {
                             in = new FileInputStream(inf);
                              b =new byte[(int)inf.length()];     //创建合适文件大小的数组
                             in.read(b);                          //读取文件中的内容到b[]数组
                             in.close();
                        } catch (FileNotFoundException e1) {
                             // TODO Auto-generated catch block
                             e1.printStackTrace();
              //set byte to internal table     
             JCO.Table poItem = f.getTableParameterList().getTable("PT_CONTENT");        
             poItem.appendRow(); //增加空行
             poItem.setValue(b, "ORBLK");
             poItem.nextRow();
             //运行RFC函数
              try
                   client.execute(f);
                   client.execute(commitFunction);
              catch(JCO.AbapException ae)
                   System.err.println("JCO.AbapException: < DMS > " + ae);
                   ae.printStackTrace();
              catch(JCO.Exception e)
                   System.err.println("JCO.Exception: < DMS > " + e);
                   e.printStackTrace();
             //返回参数
              JCO.Structure struct = f.getExportParameterList().getStructure("PSX_MESSAGE");
              String te = struct.getString("MSG_TYPE");
              System.out.println("RFC Error Type is :"+te);
              String pr = struct.getString("MSG_TXT");
              System.out.println("RFC get Data is :"+pr);
              com.hipfung.jco.JCOFactory.getInstance().release(client);
    i  can get file via CVAPI_DOC_CHECKoutView
    Edited by: pan qiaoming on Mar 15, 2011 3:05 PM

    HI ,ALL :
      NOW i want to upload file via JCO,but i upload in sap gui is success ,but jco call RFC is error ,this is my code:
    excute this  code is not error ,but the data not write to SAP,
            //连接SAP
              Client client = com.hipfung.jco.JCOFactory.getInstance().getClient();
              JCO.Repository repo = new JCO.Repository("ZOA01", client);
              //调用RFC函数
              IFunctionTemplate ft = repo.getFunctionTemplate("CVAPI_DOC_CHECKIN");
              JCO.Function f = ft.getFunction();
              IFunctionTemplate ft2 = repo.getFunctionTemplate("BAPI_TRANSACTION_COMMIT");
              JCO.Function commitFunction = ft2.getFunction();
              //设置传入参数值(注意类型)
              //1.传入参数为Field
                f.getImportParameterList().setValue("TXB",          "PF_DOKAR");  //
              f.getImportParameterList().setValue("0000010101010101020000000","PF_DOKNR");  //文档类型
              f.getImportParameterList().setValue("01","PF_DOKVR");                          //文档版本
              f.getImportParameterList().setValue("000","PF_DOKTL");     
              f.getImportParameterList().setValue("SAPFTPA","PF_FTP_DEST");     
              f.getImportParameterList().setValue("SAPHTTPA","PF_HTTP_DEST");     
              // Get content as table
              f.getImportParameterList().setValue("TBL", "PF_CONTENT_PROVIDE");
            //read file and trans to byte
                      byte b[]=null;
                        File inf = new File("d:
    test.jpg");
                        InputStream in;
                        try {
                             in = new FileInputStream(inf);
                              b =new byte[(int)inf.length()];     //创建合适文件大小的数组
                             in.read(b);                          //读取文件中的内容到b[]数组
                             in.close();
                        } catch (FileNotFoundException e1) {
                             // TODO Auto-generated catch block
                             e1.printStackTrace();
              //set byte to internal table     
             JCO.Table poItem = f.getTableParameterList().getTable("PT_CONTENT");        
             poItem.appendRow(); //增加空行
             poItem.setValue(b, "ORBLK");
             poItem.nextRow();
             //运行RFC函数
              try
                   client.execute(f);
                   client.execute(commitFunction);
              catch(JCO.AbapException ae)
                   System.err.println("JCO.AbapException: < DMS > " + ae);
                   ae.printStackTrace();
              catch(JCO.Exception e)
                   System.err.println("JCO.Exception: < DMS > " + e);
                   e.printStackTrace();
             //返回参数
              JCO.Structure struct = f.getExportParameterList().getStructure("PSX_MESSAGE");
              String te = struct.getString("MSG_TYPE");
              System.out.println("RFC Error Type is :"+te);
              String pr = struct.getString("MSG_TXT");
              System.out.println("RFC get Data is :"+pr);
              com.hipfung.jco.JCOFactory.getInstance().release(client);
    i  can get file via CVAPI_DOC_CHECKoutView
    Edited by: pan qiaoming on Mar 15, 2011 3:05 PM

Maybe you are looking for

  • Wireless Backup w/ time capsule

    I was thinking about getting time capsule. I do have a question about wireless backup though. I travel a lot and I wondered if I were to leave my time capsule at my house and travel out of town will I still be able to backup things on the time capsul

  • Help, java isnt working!

    Every time that I attempt to open a java app in safari or firefox, I am simply given the java cup loading logo and it never goes beyond that. Is this an issue between java 1.4 and java 5.0?

  • Backup issue with HotSync

    Hotsync keeps on backing up all the .PDBs in the handheld to the "backup" folder on my pc even though it has changed. I have a progam that I created in my handheld that uses these PDBs.This becomes an issue during the sync operation because some of t

  • Federated Portal not working

    Hi Guyz, We set up FPN but its not showing roles of producer portal in the Consumer portal, what might be the issue. Any guidance. The connection test is going through fine.

  • ITunes New Update 9.1 & ACC

    I looked everywhere now and I can't find the answer to my following question: How can I convert a MP3-File to an ACC-File with iTunes? It used to be optional before the update...