Skip to Content
0
Nov 14, 2018 at 11:38 AM

Agentry Java BusinessLogicException in Steplet

172 Views

Hi,

When we are posting transaction data, calling the steplet from client, we hit an exception in Steplet class where we initiate the Handler. Below is the code structure for Customized PoJo Object/Steplet/StepHandler and BAPI. All these are configured in SAP Config Panel properly. when I debug I get BusinessLogicException in steplet where the _returnData is "null" due to<error(s)_during_the_evaluation>. Below is the code snippet.

PoJo Object Structure

===========================

public class ZXyz extends SAPObject{

Declare variables

Default Constructor()

Getters and setters for declared variables

public ZXyz(Table arg0) throws Exception{

setWorkOrder(arg0.getString("AUFNR"));

......

}

@Override

public String getID() {

// TODO Auto-generated method stub

return null;

}

@Override

public void setNotes(Table arg0) throws Exception {

// TODO Auto-generated method stub

}

@Override

public void setProperties(Table tbl) throws Exception {

// TODO Auto-generated method stub

}

}

Steplet Structure

===========================

public class ZXyzSteplet extends Steplet{

public ZXyzSteplet(TransactionSession session)

throws AgentryException, BusinessLogicException {

super(session);

// TODO Auto-generated constructor stub

}

@Override

public boolean execute() throws AgentryException {

try{

ZXyzStepHandler handler = new ZXyzStepHandler ((com.syclo.sap.User)_user);

handler.createXyz();

return true;

}

catch(Throwable exception){

throwExceptionToClient(exception);

return false;

}}}

StepletHandler Structure

===========================

public class ZXyzStepHandler extends StepHandler{

Default Constructor

//Handler Method

public void createXyz() throws Exception{

ZXyz zxyzObj = new ZXyz();

ZXyzBAPI bapi = new ZXyzBAPI(user, new GregorianCalendar());

bapi.run(zxyzObj);

bapi.processResults();

}}

BAPI Structure

==========================

public class ZXyzBAPI extends AbstractFetchBAPI{

public ZXyzBAPI(User u, GregorianCalendar lu) throws Exception {

super(u, lu);

user = (User) u;

// TODO Auto-generated constructor stub

}

@Override

public ArrayList<? extends SAPObject> processResults() throws Exception {

// TODO Auto-generated method stub

return null;

public void setParameters(SAPObject obj) throws Exception {

super.setParameters(obj);

try {

// SAP Table name to update back transactional Values.

JCO.Table tbl = this.getTable("ZXYZ_FORM");

Define local variables to get transactional values

// Arraylist created to update as records

ArrayList<ZXyz> HSRiskRecordodList= new ArrayList<ZXyz>();

// Business Logic to iterate through transactional data and add as records

for(int i=1; i<18;i++){

ZXyz xyzObject = new ZXyz();

xyzObject.setWorkOrder(user.getString("transaction.Wororder"));

HSRiskRecordodList.add(healthSafetyObject);

}

// Insert the number of rows into the table

tbl.appendRows(HSRiskRecordodList.size());

// Looping Arraylist and updating records to SAP Table

for(int i=1; i<HSRiskRecordodList.size();i++)

{

setValue((Table) tbl, "AUFNR", HSRiskRecordodList.get(i).getWorkOrder());

} }

catch (Exception e) {

user.rethrowException(e, true);

}

}