Skip to Content

isssue using SAP BRM rules edit API

Hi all,

I am trying to use BRM rules edit API added all the dependencies to DC component .Followed the link

https://help.sap.com/saphelp_nw73ehp1/helpdata/en/e2/3620cef55842cca4632664212f31b1/frameset.htm

but after adding the code in one of the class

package test;
import com.sap.brms.rulesedit.IProject; 
import com.sap.brms.rulesedit.RulesEditAPI;
import com.sap.brms.rulesedit.std.DefaultRulesEditAPIFactory;
public class GetBRMInstance {
DefaultRulesEditAPIFactory apiInstance = DefaultRulesEditAPIFactory.getInstance();
RulesEditAPI  api = apiInstance.getAPI();
}

i get below error

Default constructor cannot handle exception type RulesEditAPIException thrown by implicit super constructor. Must define an explicit constructor

How to handle this exception for RulesEditAPI

Regards

Prasad

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Apr 27 at 01:00 PM

    Hi Prasad!

    I guess it's not the good idea to use Instance Initializer blocks in your class body. Your class definition should look like:

    public class GetBRMInstance {
    public RulesEditAPI getREAPI() throws RulesEditAPIException {
    return DefaultRulesEditAPIFactory.getInstance().getAPI();
    }
    
    public static void main(String[] args) {
    try {
    GetBRMInstance instance = new GetBRMInstance();
    RulesEditAPI api = instance.getREAPI();
    }
    catch (Exception e) {
    e.printStackTrace();
    }
    }
    }

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 21 at 05:10 AM

    hi Prasad,

    I am also trying to achieve a similar goal, however i am receiving an exception - "Unable to find resource com/sap/brms/qrules/io/RulePersistenceHandler.class". I have posted a question for this issue in "https://answers.sap.com/questions/688679/sap-brm-rules-edit-apis-noclassdeffounderror-rulep.html".

    (As described in the help.sap.com, i have added 'sc/brms-façade' and 'tc/brms/edit/api' available in SC 'BRMS-FACADE').

    I am eager to know if you encountered this issue, and if not which are the DCs you have added to the dependency? or do u have a suggestion?

    thanks

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 27 at 08:37 AM

    Hi Prasad, thanks for responding.

    I am using the latest NWDS compatible to my PI system. Since i m using PO 7.5 service pack 11, I have installed the equivalent version of NWDS to develop the EJB for calling the BRM.

    But still, i have a question, is this class specifically available in NWDS 7.3 EHP1?

    Add comment
    10|10000 characters needed characters exceeded