cancel
Showing results for 
Search instead for 
Did you mean: 

Acess Bapi

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

prashil
Advisor
Advisor
0 Kudos

Hi Tony,

Please post the code that you have implemented.

Rgds,

Prashil

Former Member
0 Kudos

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