Action in BOPF

Action has the literal meaning in BOPF. Do something. We can create an Action to an existing business object node by carrying out the following steps,

  • Open the business object (ZAPF_I_AIRLINE).
  • In the business object editor, click on Go to the Root Node link.
  • Select Actions tab, and choose New.

A dialog appears, where we must specify the details of the action:

  • Name: Enter the name of the action; in our case, we enter “Set URL”.
  • Description: Enter description that describes the purpose of the action, for instance, “Set the URL”.
  • Implementation Class: We can simply accept the suggestion that will lead to the generation of a global ABAP class or enter an already existing class that implements the interface /bobf/if_frw_action~execute. We will call the class ZCL_A_LOCK_APF_I_AIRLINE.
  • Instance Multiplicity: Select multiple node instances here, as we want the action to operate on several Airlines to enable mass processing of URL set.
  • Parameter Structure: Standard proposed structure will be filled in it.

Below code can be used to do the actions part.

METHOD/bobf/if_frw_action~execute.
DATA(lt_airline)= VALUE ztiapf_airline().
” Retrieve
io_read->retrieve(
EXPORTING
iv_node =is_ctx-node_key
it_key =it_key
IMPORTING
et_data =lt_airline
).
LOOP AT lt_airline ASSIGNING FIELD-SYMBOL().
-url=’www.google.com’.”Set URL
” Update the node instance with the changed status
io_modify->update(
EXPORTING
iv_node =is_ctx-node_key
iv_key = -key
iv_root_key = -root_key
is_data = REF#()
it_changed_fields = VALUE#(
( zif_i_airline_c=>sc_node_attribute-zapf_i_airline-url)
)
).
ENDLOOP.
ENDMETHOD.

Custom button will be visible and upon clicking the button, URL will be set as per in the code snippet. In the next chapter, lets see Determinations of BOPF.

ABAP Programming Model for SAP Fiori

We are planning to start an Instructor Led Paid Online Practical Training on ABAP Programming Model for SAP Fiori. If learning this new programming model is in you study kitty, you may want to register and enroll in this course. Please register using below link and we will provide more information to the registered participants.

Introduction to ABAP Programming Model for SAP Fiori Training – Registration Form

Please follow our LinkedIn Page, LinkedIn Group, Facebook Page, Twitter and Instagram.

Save our number +1-646-727-9273 and send us a Whatsapp message ‘LEARN’ to be part of our Learning Community.

All SAP Fiori Tutorials

Check BOPF Tutorials




Previous articleABAP Programming Model for SAP Fiori – 9 – Use of Determinations in BOPF
Next articleABAP Programming Model for SAP Fiori – 11 – Enabling Draft Functionality for Transactional Apps

Avatar

Source Article