cancel
Showing results for 
Search instead for 
Did you mean: 

A Problem about BAPI

Former Member
0 Kudos

Hi,everyone.

Now i want to use JCo and BAPI to execute a function(create sales order ps:transaction code is VA01).

How do i to find the BAPI that i need?

And where can i find some documents about BAPI?

Thx~~ a lot

PS:if this topic isn`t suitable in Java Programming,plz tell me thx ,^^

by Louis

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Louis,

Refer these threads...

If you post about this in ABAP forums, You will get more answers from ABAP experts...

Regards,

Uma

Answers (1)

Answers (1)

kishorg
Advisor
Advisor
0 Kudos

HI Louis,

You can find out the bapis , by running transaction -bapi (Bapi Explorer).

Here u get a list of standard BAPI's given by SAP.

u can select appropriate bapi from here.. Associated with each bapi documentation is there . from this u will get a clear picture of import params ,export params and tables.

Now to execute BAPI or RFC using JCO,

-


please go through this sample piece of code. fill the params of standard jco methods with appropriate parameters for your use.

private static JCO.Client client;

private static JCO.Repository repository;

client =

JCO.createClient(

"<client num>",

"<user name>",

"<password>",

"en",

"<server ip or server name>",

"<instance number>");

client.connect();

repository = new JCO.Repository("REP", client);

try {

IFunctionTemplate m_read_container;

m_read_container =repository.getFunctionTemplate("<RFC Name>");

JCO.Function function_read_cont = m_read_container.getFunction();

JCO.ParameterList importparam =

function_read_cont.getImportParameterList();

importparam.setValue(<Your value to pass>, "<Import parameter name as in RFC>");

client.execute(function_read_cont);

JCO.ParameterList tables =

function_read_cont.getTableParameterList();

//For Tables

JCO.Table container = tables.getTable("<Your table Name from table parameter>");

for (int iCtr = 0; iCtr < container.getNumRows(); iCtr++) {

container.setRow(iCtr);

Strin value = container.getString("<Tale fieldName>");

}

JCO.ParameterList exp_abs_read =

function_read_cont.getExportParameterList();//For Export Params

JCO.Structure st_abs_read =

exp_abs_read.getStructure("<If structure using then give structure name>");

for (int iCtrst = 0;iCtrst < st_abs_read.getNumFields();

iCtrst++) {

// String str_field_val = st_abs_read.getString("<Structure Field Name>"));

String fieldName = st_abs_read.getName(iCtrst);

}

} catch (Exception e) {

}

Regards

Kishor Gopinathan