ENABLE AND DISABLE DRAG AND DROP.
To use Drag-and-Drop between GUIBBs and UIBBs, Drag-and-Drop must be enabled in the following areas:
we can enable Drag and Drop by two ways:-
1. The feeder class that provides the GUIBB with data or in the Web Dynpro component view of a UIBB
Code for enabling drag and drop in feeder class.
whenever we inherit any form feeder class( IF_FPM_GUIBB_FORM) or list feeder class( IF_FPM_GUIBB_LIST ) interface in your classthere is interface method GET_DEFINATION
Components of staructure FPMGB_S_DND_DEFINITION.
TYPE – This field defines the type of the drag & drop definition entry, whether it is a drag source or a drop target. This attribute value cann’t be overwritten in
the configuration or modified at runtime
ENABLED – This attribute defines whether a drag & drop definition entry is enabled or not. This attribute value can be overwritten in the configuration or
modified at runtime.
If a drag source is disabled dragging will be completely blocked.
If a drop target is disabled dropping on this target will be completely blocked.
TAGS – This attribute specifies the relevant tags of the drag & drop definition entry. If you have to drop some data than drag source tag must match with
drop source tag. Tags can be overwritten in the configuration or modified at runtime.
Multiple tags can be separated by a space.
Tags such as ‘JITU*’ or ‘TEST*’, are supported by system.
SCOPE – The scope defines whether dropping is possible on the drag source itself or on any other GUIBB.
If dropping is perform on drag source itself its local for example dragging row from list UIBB and dropping it on same list UIBB. If dragging from list
and dropping on form UIBB its scope must be global.
Deault scope is ‘Global’. The scope can be overwritten in the configuration or later at runtime.
NAME – A name is required for distinguish multiple drop definition entries of the same type. this attribute can neither be overwritten during configuration or
modified at runtime.
OVERRIDE – This attribute defines whether other properties such as scope of the drag & drop definition entry can be modified at runtime or not.
The attribute value can be overwritten in the configuration.
code for making DRAG and DROP source using compoments of structure FPMGB_S_DND_DEFINITION.
2. The Enable Drag and Enable Drop checkboxes in the configuration editor.
Drag-and-Drop is primarily enabled in the feeder class and its attributes are displayed as the Drag-and-Drop attributes in the configuration editor. You can edit these attributes. If no Drag-and-Drop attributes are defined in the feeder class, no Enable Drag and Enable Drop checkboxes are displayed in the configuration editor.
To display the Drag-and-Drop attributes in the configuration editor.
In List UIBB :-
Open FPM_LIST_UIBB component in diffent window.
Select general setting tab there on tool bar you will see GUIBB setting.
Selecting GUIBB setting will show DRAG and DROP setting click on it.
Explorer with popup window appear in which drag and drop properties defined in feeder class appear.
In Form GUIBB :-
Open form GUIBB in different window.
Select group fro making it drop source.
After dropping data.
Whenever a drag source is dropped FPM event ‘FPM_DROP_COMPLETED’ is triggered.
if_fpm_guibb_list=>gc_guibb_list_on_drop constant have value ‘FPM_DROP_COMPLETED’
after triggering ‘FPM_DROP_COMPLETED’ we have to call method get_value( ) of interface IF_FPM_PARAMETER
If you export drag source ( if_fpm_guibb_constants=>gc_guibb_dnd-drag_source ) in get_value( ) method.
Method will fill variable of type fpmgb_s_drag_and_drop this variable have all information about drag source.
DRAG_SOURCE_INDICES – holds table index
DROP_POSITION – holds at which drag data is dropped
DRAG_SOURCE_DATA – holds all drag source data
Code when ‘FPM_DROP_COMPLETED’ triggered.
IF iv_eventid->mv_event_id = if_fpm_guibb_list=>gc_guibb_list_on_drop.
iv_eventid->mo_event_data->get_value( exporting iv_key = if_fpm_guibb_constants=>gc_guibb_dnd-drag_source
importing ev_value = lt_drag_result ).
lo_result = lt_drag_result-drag_source_data.
if lo_result is not initial.
ASSIGN lo_result->* TO <lr_result>.
lt_drag_result_set = <lr_result>.
ct_selected_lines = lt_drag_result-drag_source_indices.
drop_position = lt_drag_result-drop_position.
if ct_selected_lines is not initial.
LOOP AT ct_selected_lines ASSIGNING <rstabix>.
ls_selected_lines = <rstabix>-tabix.
READ TABLE lt_drag_result_set assigning <value_sflight> index ls_selected_lines.
ls_sflight-connid = <value_sflight>-connid.
ls_sflight-carrid = <value_sflight>-carrid.
ls_sflight-planetype = <value_sflight>-planetype.
ls_sflight-price = <value_sflight>-price.
ls_sflight-fldate = <value_sflight>-fldate.
ls_sflight-currency = <value_sflight>-currency.
if mv_drop_on_row eq abap_true.
insert ls_sflight into lt_change_result index drop_position.
insert ls_sflight into lt_result index drop_position.
drop_position = drop_position + 1.