Skip to Content
0
Former Member
Jul 20, 2005 at 09:02 PM

BAPI Exception Handling + JCA

90 Views

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"))

myBean.setException(exportStructure.getString("MESSAGE"));

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

table.beforeFirst();

while(table.next()){

...........

..........

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..