<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic sample code required for RFC_READ_TABLE in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-required-for-rfc-read-table/m-p/1705422#M309024</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;we are trying to get the data from ekko table by using RFC_READ_TABLE.&lt;/P&gt;&lt;P&gt;But we are unable to get the data, Please send me the sample code and &lt;/P&gt;&lt;P&gt;i am not understand the following lines of code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;importParamList.setValue("/AIN/DM_DEVCTR", "QUERY_TABLE");&lt;/P&gt;&lt;P&gt;importParamList.setValue(";", "DELIMITER");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rajesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Nov 2006 13:23:27 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-28T13:23:27Z</dc:date>
    <item>
      <title>sample code required for RFC_READ_TABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-required-for-rfc-read-table/m-p/1705422#M309024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;we are trying to get the data from ekko table by using RFC_READ_TABLE.&lt;/P&gt;&lt;P&gt;But we are unable to get the data, Please send me the sample code and &lt;/P&gt;&lt;P&gt;i am not understand the following lines of code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;importParamList.setValue("/AIN/DM_DEVCTR", "QUERY_TABLE");&lt;/P&gt;&lt;P&gt;importParamList.setValue(";", "DELIMITER");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rajesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Nov 2006 13:23:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-required-for-rfc-read-table/m-p/1705422#M309024</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-28T13:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: sample code required for RFC_READ_TABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-required-for-rfc-read-table/m-p/1705423#M309025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rajesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;are you calling it from Java using JCO then...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this sample code.you have to call the RFC RFC_READ_TABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import com.sap.mw.jco.*;

public class JcoTest {
 private static JCO.Client theConnection;
 private static IRepository theRepository;
  
 public static void main(String[] args) {
  createConnection();
  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() &amp;gt; 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();
  }
  
  
  
 }
 
 private static void createConnection() {
  try {
   theConnection = JCO.createClient("000", "DDIC", "minisap", "en", "sincgo", "00");
   theConnection.connect(); 
  }
  catch (Exception ex) {
   System.out.println("Failed to connect to SAP system");
  }
 }
 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;
    }  
}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Nov 2006 13:32:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-required-for-rfc-read-table/m-p/1705423#M309025</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-28T13:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: sample code required for RFC_READ_TABLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-required-for-rfc-read-table/m-p/1705424#M309026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the above one is with out connection pool, check this with connection pool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;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() &amp;gt; 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;
    }  
}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Nov 2006 13:33:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-required-for-rfc-read-table/m-p/1705424#M309026</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-28T13:33:33Z</dc:date>
    </item>
  </channel>
</rss>

