Hello,

Sign up to join our community!

Welcome Back,

Please sign in to your account!

Forgot Password,

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask a question.

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

SAP EWM Help Latest Questions

  • 0
  • 0
DPM125
Beginner

Add buttons in sap rap application

Step 1: Create the RAP Project

  1. In ABAP Development Tools (ADT):

    • Go to File → New → ABAP Project.

    • Connect to your system.

    • Create a new ABAP Package (e.g., Z_RAP_BUTTONS).

  2. Create the RAP artifacts:

    • Business Object (BO):

      • Right-click the package → New → Other ABAP Repository Object → Business Object → RAP Business Object.

      • Example: ZBO_SALESORDER.

 

Step 2: Define the Behavior (Behavior Definition)

  1. In your Behavior Definition (.behavior):

define behavior for ZI_SALESORDER
persistent table ZI_SALESORDER
lock master
{
create;
update;
delete;

// Add custom action button
action confirm order result [0..1];
}

 

Step 3: Implement the Behavior Logic

  1. In Behavior Implementation (.behavior.abap):

implementation in class zbp_i_salesorder unique;

method confirm_order.
” Your business logic goes here
loop at it_entity into data(ls_entity).
ls_entity-status = ‘CONFIRMED’.
modify table et_entity from ls_entity.
endloop.
endmethod.

endimplementation.

 

Step 4: Expose Action in Service Definition

  1. Open Service Definition (.service):

define service ZC_SALESORDER_SRV {
expose ZI_SALESORDER;
// Optionally expose action explicitly
action confirm order;
}

 

 

Step 5: Register & Test Service

  1. Go to /IWFND/MAINT_SERVICE → register your RAP service.

  2. Test via SAP Gateway Client (/IWFND/GW_CLIENT) to see the metadata:

    • You should see your confirm order action exposed.

Step 6: Fiori/UI Integration

  • If you use Fiori Elements (List Report / Object Page):

    1. The action confirm order will automatically appear as a button in the Object Page or List Report.

    2. No extra UI5 code is required if you use standard Fiori Elements.

    3. If you want custom UI5, you can bind a button like this:

<Button
text=”Confirm Order”
press=”.onConfirmOrder”
/>

 

And in your controller:

onConfirmOrder: function(oEvent) {
var oModel = this.getView().getModel();
var sPath = oEvent.getSource().getBindingContext().getPath();
oModel.callFunction(“/ConfirmOrder”, {
method: “POST”,
urlParameters: {
SalesOrderID: oModel.getProperty(sPath + “/SalesOrderID”)
},
success: function() {
MessageToast.show(“Order Confirmed!”);
},
error: function() {
MessageToast.show(“Error!”);
}
});
}

Related Questions

Leave an answer

Leave an answer