Hi Java Guru,
I am new in Java. However I have try to compile the Java program however i have this error massage as below. Can any Java Guru help me on this.
lai.java:7: package com.sap.mw.jco does not exist
import com.sap.mw.jco.*;
lai.java:17: package JCO does not exist
JCO.Client client = null;
............
Source code as below
/**
Example1.java
Property of SAP AG, Walldorf
(c) Copyright SAP AG, Walldorf, 2000.
All rights reserved.
*/
import com.sap.mw.jco.*;
/**
@version 1.0
@author SAP AG, Walldorf
*/
public class lai {
public static void main(String[] argv)
{
JCO.Client client = null;
try {
// Print the version of the underlying JCO library
System.out.println("\n\nVersion of the JCO-library:\n" +
"----
\n" + JCO.getMiddlewareVersion());
// Create a client connection to a dedicated R/3 system
client = JCO.createClient("xxx", // SAP client
"xx", // userid
"xx", // password
"EN", // language
"",// host name
"01"); // system number
// Open the connection
client.connect();
// Get the attributes of the connection and print them
JCO.Attributes attributes = client.getAttributes();
System.out.println("Connection attributes:\n" +
"----
\n" + attributes);
// Create the input parameter list
JCO.ParameterList input = JCO.createParameterList();
// Set the first (and only) import parameter
input.appendValue("REQUTEXT", JCO.TYPE_CHAR, 255, "This is my first Jayco example.");
// Create the out parameter list
JCO.ParameterList output = JCO.createParameterList();
// Specify the parameters types the function will be returning
output.addInfo("ECHOTEXT", JCO.TYPE_CHAR, 255);
output.addInfo("RESPTEXT", JCO.TYPE_CHAR, 255);
// Call the function
client.execute("STFC_CONNECTION", input, output);
// Print the result
System.out.println("The function 'STFC_CONNECTION' returned the following parameters:\n" +
"----
");
for (int i = 0; i < output.getFieldCount(); i++) {
System.out.println("Name: " + output.getName(i) + " Value: " + output.getString(i));
}//for
// Close the connection
client.disconnect();
// All done
System.out.println("\n\nCongratulations! It worked.");
}
catch (Exception ex) {
System.out.println("Caught an exception: \n" + ex);
if (client != null) client.disconnect();
}
}
}
Message was edited by:
Lord shadow