2010 May 18 11:18 AM
hi, i have displayed data in hierarchical list using oo prog.
i made use of classes like cl_salv_herseq_table
i wanted a functionality which in non OO prog using 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' can be done by sending
the parameter in I_CALLBACK_USER_COMMAND.
the function that we send to I_CALLBACK_USER_COMMAND has two parameters of type sy-ucomm and slis_selfield .
using object oriented prog i found a method get_events with the help of which i could trigger the even on mouseclicks
and getting appropriate functionkey in the parameter i_ucomm. But i want the slis_selffield option as well using OO prog
that could get the details of the item clicked.
hi, i have displayed data in hierarchical list using oo prog.
i made use of classes like cl_salv_herseq_table
i wanted a functionality which in non OO prog using 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' can be done by sending
the parameter in I_CALLBACK_USER_COMMAND.
the function that we send to I_CALLBACK_USER_COMMAND has two parameters of type sy-ucomm and slis_selfield .
using object oriented prog i found a method get_events with the help of which i could trigger the even on mouseclicks
and getting appropriate functionkey in the parameter i_ucomm. But i want the slis_selffield option as well using OO prog
that could get the details of the item clicked.
2010 May 18 2:35 PM
Use the method GET_SELECTIONS of the class CL_SALV_HIERSEQ_TABLE to get the Selection made on the Hierarchical ALV. This method will return the object reference to CL_SALV_SELECTIONS. You can use the methods GET_SELECTED_ROWS and GET_SELECTED_COLUMNS to get to know which Column and Rows are selected.
Regards,
Naimesh Patel
2010 May 19 2:26 PM
Check out this code:
REPORT ztest_sourav16. TYPE-POOLS: slis. TYPES: BEGIN OF x_mara, matnr TYPE matnr, ersda TYPE ersda, ernam TYPE ernam, laeda TYPE laeda, aenam TYPE aenam, vpsta TYPE vpsta, pstat TYPE pstat_d, lvorm TYPE lvoma, check TYPE char1, END OF x_mara, BEGIN OF x_marc, matnr TYPE matnr, werks TYPE werks_d, END OF x_marc. DATA: i_mara TYPE STANDARD TABLE OF x_mara INITIAL SIZE 0, i_marc TYPE STANDARD TABLE OF x_marc INITIAL SIZE 0, wa_alv_keyinfo TYPE slis_keyinfo_alv, i_fieldcat TYPE slis_t_fieldcat_alv, wa_layout TYPE slis_layout_alv. START-OF-SELECTION. SELECT matnr werks FROM marc INTO TABLE i_marc UP TO 100 ROWS. IF sy-subrc = 0. SELECT matnr ersda ernam laeda aenam vpsta pstat lvorm FROM mara INTO TABLE i_mara FOR ALL ENTRIES IN i_marc WHERE matnr = i_marc-matnr. IF sy-subrc = 0. ENDIF. ENDIF. END-OF-SELECTION. DATA: i_callback_program TYPE syrepid VALUE sy-repid. PERFORM sub_populate_fcat. wa_alv_keyinfo-header01 = 'MATNR'. wa_alv_keyinfo-item01 = 'MATNR'. wa_alv_keyinfo-item02 = 'WERKS'. wa_layout-box_fieldname = 'CHECK'. wa_layout-box_tabname = 'I_MARA'. CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' EXPORTING * I_INTERFACE_CHECK = 'X' i_callback_program = i_callback_program i_callback_pf_status_set = 'SUB_SET_PF_STATUS' i_callback_user_command = 'SUB_USER_COMMAND' is_layout = wa_layout it_fieldcat = i_fieldcat * IT_EXCLUDING = * IT_SPECIAL_GROUPS = * IT_SORT = * IT_FILTER = * IS_SEL_HIDE = * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * I_DEFAULT = 'X' * I_SAVE = ' ' * IS_VARIANT = * IT_EVENTS = * IT_EVENT_EXIT = i_tabname_header = 'I_MARA' i_tabname_item = 'I_MARC' * I_STRUCTURE_NAME_HEADER = * I_STRUCTURE_NAME_ITEM = is_keyinfo = wa_alv_keyinfo * IS_PRINT = * IS_REPREP_ID = * I_BYPASSING_BUFFER = * I_BUFFER_ACTIVE = * IR_SALV_HIERSEQ_ADAPTER = * IT_EXCEPT_QINFO = * I_SUPPRESS_EMPTY_DATA = ABAP_FALSE * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = TABLES t_outtab_header = i_mara t_outtab_item = i_marc EXCEPTIONS program_error = 1 OTHERS = 2 . IF sy-subrc 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. *&---------------------------------------------------------------------* *& Form sub_populate_fcat *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM sub_populate_fcat. DATA: l_wa_fieldcat TYPE slis_fieldcat_alv. l_wa_fieldcat-ref_tabname = 'MARA'. l_wa_fieldcat-tabname = 'I_MARA'. l_wa_fieldcat-fieldname = 'MATNR'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'ERSDA'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'ERNAM'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'LAEDA'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'AENAM'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'VPSTA'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'PSTAT'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'LVORM'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat. l_wa_fieldcat-fieldname = 'MATNR'. l_wa_fieldcat-ref_tabname = 'MARC'. l_wa_fieldcat-tabname = 'I_MARC'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat. l_wa_fieldcat-fieldname = 'WERKS'. l_wa_fieldcat-ref_tabname = 'MARC'. l_wa_fieldcat-tabname = 'I_MARC'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat. ENDFORM. "sub_populate_fcat' *&---------------------------------------------------------------------* *& Form SUB_USER_COMMAND *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM sub_user_command USING rf_ucomm TYPE syucomm rs TYPE slis_selfield. DATA: l_i_mara TYPE STANDARD TABLE OF x_mara INITIAL SIZE 0, l_lines TYPE i, l_wa_mara TYPE x_mara. CASE rf_ucomm. WHEN 'DETA'. l_i_mara[] = i_mara. DELETE l_i_mara WHERE check = space. l_lines = LINES( l_i_mara ). IF l_lines EQ 0. MESSAGE i001(00) WITH 'No lines selected.'. ELSEIF l_lines GT 1. MESSAGE i001(00) WITH 'More than one lines selected.'. ELSEIF l_lines EQ 1. READ TABLE l_i_mara INTO l_wa_mara INDEX 1. IF sy-subrc = 0. MESSAGE i001(00) WITH 'You have selected material:' l_wa_mara-matnr. ENDIF. ENDIF. * WHEN . * WHEN OTHERS. ENDCASE. ENDFORM. "sub_user_command *&---------------------------------------------------------------------* *& Form sub_set_pf_status *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->RT_EXTAB text *----------------------------------------------------------------------* FORM sub_set_pf_status USING rt_extab TYPE slis_t_extab. SET PF-STATUS 'ZSTANDARD'. ENDFORM. "sub_set_pf_status Hope this helps
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |