Showing results for 
Search instead for 
Did you mean: 

BAPI Exception Handling + JCA

Former Member
0 Kudos

Iam having problems handling exceptions of a BAPI connecting thru JCA.



MappedRecord exportParams = (MappedRecord) interaction.execute(interactionSpec, importParams);

IRecord exportStructure = (IRecord) exportParams.get("RETURN");

if (exportStructure.getString("TYPE").toUpperCase().equals("E"))


IRecordSet table = (IRecordSet)exportParams.get("MY_Table");





After executing the BAPI, it shud check for the RETURN Structure and if there is nothing the flow shud be normal otherwise it shud set the bean.

Somehow the above 'if' block is blocking the normal flow even if RETURN throws nothing.It does fine if remove the if block...

IS that the correct of handling the Exceptions??

I found a sample code by prakash,

IRecord exportStructure = (IRecord) exportParams.get("RETURN");

if (exportStructure.getString("TYPE").toUpperCase().equals("A")|| exportStructure.getString("TYPE").toUpperCase().equals("E"))

throw new Exception(exportStructure.getString("MESSAGE"));

Thanks...Hoping some suggestions..

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Robert,

Your code looks like fine and looks like your bapi is returning some error message. Are you getting any error message. i would code the error logic in following way?

if (exportStructure.getString("TYPE").compareToIgnoreCase("E"))