cancel
Showing results for 
Search instead for 
Did you mean: 

bapi message type e

Former Member
0 Kudos

I am trying to execute the following program.i am getting an exception here:

I am using crm5.2

I AM GETTING BAPI_MTYPE AS E.

JCO.Structure returnStructure =

function.getExportParameterList().getStructure("RETURN");

JCO.Structure returnStructure =

function.getExportParameterList().getStructure("RETURN");

if (! (returnStructure.getString("TYPE").equals("") ||

returnStructure.getString("TYPE").equals("S")) ) {

System.out.println(returnStructure.getString("MESSAGE"));

System.out.println("TYPE");

System.exit(1);

y am i not getting type as S or " ".

I am working with jco for the first time.please help.

how to resolve this?

regards

shilpi

import com.sap.mw.jco.*;

public class Bapi1 extends Object{

JCO.Client mConnection;

JCO.Repository mRepository;

public Bapi1() {

try {

// Change the logon information to your own system/user

mConnection =

JCO.createClient("002", // SAP client

"training3", // userid

"welcome", // password

null, // language

"usaboses01.ad.infosys.com", // application server host name

"00"); // system number

mConnection.connect();

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

}

catch (Exception ex) {

ex.printStackTrace();

System.exit(1);

}

JCO.Function function = null;

JCO.Table codes = null;

try {

function = this.createFunction("BAPI_BANK_GETLIST");

if (function == null) {

System.out.println("BAPI_BANK_GETLIST" +

" not found in SAP.");

System.exit(1);

}

mConnection.execute(function);

JCO.Structure returnStructure =

function.getExportParameterList().getStructure("RETURN");

if (! (returnStructure.getString("TYPE").equals("") ||

returnStructure.getString("TYPE").equals("S")) ) {

System.out.println(returnStructure.getString("MESSAGE"));

System.out.println("TYPE");

System.exit(1);

}

codes =

function.getTableParameterList().getTable("BANK_LIST");

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

codes.setRow(i);

System.out.println(codes.getString("BANK_KEY") + '\t' +

codes.getString("BANK_NAME"));

}

}

catch (Exception ex) {

ex.printStackTrace();

System.exit(1);

}

try {

codes.firstRow();

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

function = this.createFunction("BAPI_BANK_GETDETAIL");

if (function == null) {

System.out.println("BAPI_COMPANYCODE_GETDETAIL" +

" not found in SAP.");

System.exit(1);

}

function.getImportParameterList().

setValue(codes.getString("BANK_KEY"), "BANKKEY");

function.getExportParameterList().

setActive(false, "BANK_CTRY");

mConnection.execute(function);

JCO.Structure returnStructure =

function.getExportParameterList().getStructure("RETURN");

if (! (returnStructure.getString("TYPE").equals("") ||

returnStructure.getString("TYPE").equals("S") ||

returnStructure.getString("TYPE").equals("W")) ) {

System.out.println(returnStructure.getString("MESSAGE"));

}

JCO.Structure detail =

function.getExportParameterList().

getStructure("BANK_DETAIL");

System.out.println(detail.getString("BANK_KEY") + '\t' +

detail.getString("BANK_CTRY") + '\t' +

detail.getString("CITY"));

}

}

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("Problem retrieving JCO.Function object.");

}

}

public static void main (String args[]) {

Bapi1 app = new Bapi1();

}

}

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

"E" stands for error. Check the input parameters you are passing to SAP to make sure you set all parameters correctly. Additionally, you can test the Function Module directly by setting the same data that you try setting through JCo and then see what happens.

Under "Message" in the return table, you should be able to see a more detailed reason for the error.

T00th