One-Click action provides a better way of editing/deleting/changing the status of particular record(s) in list or tree uibb.
The below post shows how to implement One-Click Action with Edit/delete particular row(s) in a list uibb of an OVP applciation.
For list uibb we have the table type.
Add all fields of SPFLI table and to edit particular cell in a row, extra field REF_READ_ONLY field is added.
Create a list feeder class.
In the GET_DEFINITION method build the field catalog. Build the one click actions like here we have ROW_EDIT & ROW_DELETE.
Select data in GET_DATA METHOD.Activate all other methods.
Create an OVP application using tx- FPM_WB.
Add a list uibb and create the configuration by providing the above list feeder class.
Don’t select the Display mode as TRUE in general settings as we have to edit certain row cells depending upon user action
Add fields as per needed to display on the list. Here we have a field named as ‘FPM_ROW_ACTIONS_COLUMN’ this field is passed from the feeder class but not from the field catalog but as we have defined the row action. This always will be type as LINK TO ACTION. Make two field cityfrom & cityto as INPUT field.
For the field “FPM_ROW_ACTIONS_COLUMN’ provide the actions and the image. Save the configuration and test the application.
Here the OUTPUT List. As we set CITYFORM & CITYTO field as input field, it appears as input enabled.
Go to the feeder class, get_data method and put the highlighted code to make the input field as rad only. test the application again.
This time the input fields appear as rad only. Perfect. Now the idea is when we click the EDIT button in any row, that row specific CITYFORM & CITYTO fields should be enabled as input field.
Put the below highlighted code in the GET_DATA method of the list feeder class.
Test the application and edit a row.
You can put action on multiple rows.
Now we want to delete the record form the UI, when row specific DELETE button is pressed bu user. Put high lighted code in the get_Data method.
Test the application and try to delete a record.
The roe delete from UI.
CODE
METHOD if_fpm_guibb_list~get_data.
DATA : lv_index TYPE i.
CASE iv_eventid->mv_event_id .
WHEN ‘FPM_START’.
SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE gt_spfli.
LOOP AT gt_spfli ASSIGNING FIELD–SYMBOL(<fs_spfli>).
<fs_spfli>–ref_read_only = ‘X’.
ENDLOOP.
ct_data = gt_spfli.
ev_data_changed = abap_true.
WHEN ‘ROW_DELETE’.
CALL METHOD iv_eventid->mo_event_data->get_value
EXPORTING
iv_key = ‘FPM_GUIBB_LIST_INDEX’
IMPORTING
ev_value = lv_index.
DELETE gt_spfli INDEX lv_index.
ct_data = gt_spfli.
ev_data_changed = abap_true.
WHEN ‘ROW_EDIT’.
CALL METHOD iv_eventid->mo_event_data->get_value
EXPORTING
iv_key = ‘FPM_GUIBB_LIST_INDEX’
IMPORTING
ev_value = lv_index.
READ TABLE gt_spfli ASSIGNING <fs_spfli> INDEX lv_index.
IF sy–subrc IS INITIAL.
<fs_spfli>–ref_read_only = ‘ ‘.
ENDIF.
ct_data = gt_spfli.
ev_data_changed = abap_true.
WHEN OTHERS.
ENDCASE.
ENDMETHOD.
One comment