Skip to Content
avatar image
Former Member

Acess Bapi

hi friends,

I have Z_BAPI_VEN is the classname, in that method name is

Z_BAPI_VENDOR_GET_DETAILS

i am accessing the z_bapi_vendor_get_details ,but i am unable to access

the z_bapi_ven ..

how to access that z_bapi_ven using jco programming ...

thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Aug 03, 2007 at 11:12 AM

    Hi Tony,

    Please post the code that you have implemented.

    Rgds,

    Prashil

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi prashil,

      import com.sap.mw.jco.*;

      public class Bapi1 extends Object{

      JCO.Client mConnection;

      JCO.Repository mRepository;

      public Bapi1(){

      try{

      mConnection = JCO.createClient("100","NTWDEV","******",

      null,"10.111.11.111","00" );

      mConnection.connect();

      mRepository = new JCO.Repository("MyRepos", mConnection);

      }catch(Exception ex){

      ex.printStackTrace();

      System.exit(1);

      }

      JCO.Function function = null;

      JCO.Table codes = null;

      try{

      function = this.createFunction("Z_BAPI_VENDOR_GET_DETAILS ");

      if (function == null){

      System.out.println("Z_BAPI_VENDOR_GET_DETAILS " + "not found in SAP");

      System.exit(1);

      }

      mConnection.execute(function);

      codes = function.getTableParameterList().getTable("IT_LFA");

      for( int i = 0; i < codes.getNumRows();i++){

      codes.setRow(i);

      System.out.println(codes.getString(codes.getName(i));

      }

      }catch(Exception ex){

      ex.printStackTrace();

      System.exit(1);

      }

      mConnection.disconnect();

      }

      public JCO.Function createFunction(String name) throws Exception{

      try{

      IFunctionTemplate ft = mRepository.getFunctionTemplate(name.toUpperCase());

      if (ft == null)

      return null;

      return ft.getFunction();

      }catch(Exception ex){

      throw new Exception("Probelm retrieving JCO.Fucntion object");

      }

      }

      public static void main(String agrs[]){

      Bapi1 app = new Bapi1();

      }

      My problem is how to access the Bapi ? I am access the Function module

      thanks