on 06-26-2006 3:40 PM
Hello All,
I have been searching for some example code for pulling
some fields out of SAP from my Java app using JCo. I
just need to know how to load the imports/then get my
data back out of the exports or tables. I am very new
to SAP, but I am a Java Developer, just the documentation
does not make sense to me. Right now RFC_READ_TABLE
just complains about overflow, and I don't even know how
I overflowed it...... Thanks in advance for any help.
-Greg
Hi Greg,
I have some documents on JCO.
Ishall send it to you.
Please let me knwo your email address.
Regards,
Tanveer.
<b>Please mark helpful answers</b>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Gents,
Check this out:
http://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/
library/ep/portal-content/Simplified%20Queries%20of%20SAP%20Tables%20from%20Java
This really helped a lot. Hope it helps someone else too.
-Greg
Hi Greg,
Check this http://help.sap.com/saphelp_nw04/helpdata/en/35/42e13d82fcfb34e10000000a114084/frameset.htm
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
refer the thread
import com.sap.mw.jco.*;
public class JcoTest {
private static JCO.Client theConnection;
private static IRepository theRepository;
private static final String POOL_NAME = "myPool";
public static void main(String[] args) {
JCO.Pool connPool = JCO.getClientPoolManager().getPool(POOL_NAME);
if (connPool == null) {
JCO.addClientPool(POOL_NAME,
5, //number of connections in the pool
"client",
"username",
"paswword",
"EN",
"hostname",
"00");
}
theConnection = JCO.getClient(POOL_NAME);
retrieveRepository();
try {
JCO.Function function = getFunction("RFC_READ_TABLE");
JCO.ParameterList listParams = function.getImportParameterList();
listParams.setValue("BSAUTHORS", "QUERY_TABLE");
theConnection.execute(function);
JCO.Table tableList = function.getTableParameterList().getTable("DATA");
if (tableList.getNumRows() > 0) {
do {
for (JCO.FieldIterator fI = tableList.fields();
fI.hasMoreElements();)
{
JCO.Field tabField = fI.nextField();
System.out.println(tabField.getName()
+ ":t" +
tabField.getString());
}
System.out.println("n");
}
while (tableList.nextRow() == true);
}
}
catch (Exception ex) {
ex.printStackTrace();
}
JCO.releaseClient(theConnection);
}
private static void retrieveRepository() {
try {
theRepository = new JCO.Repository("saprep", theConnection);
}
catch (Exception ex)
{
System.out.println("failed to retrieve repository");
}
}
public static JCO.Function getFunction(String name) {
try {
return theRepository.getFunctionTemplate(name.toUpperCase()).getFunction();
}
catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
}
Regards
vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
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.