09-28-2011 8:04 AM
Hi all,
I am using ALV Blocked List consissting of 3 blocks.
For my requirement, in the 1st block, I need to make a colum clickable, for which I have used the User_Command Event.
But this is not working. The second list is not gettin displayed.
Here'z my code:
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = v_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_EXCLUDING =
.
REFRESH: it_events[].
wa_events-name = slis_ev_top_of_list.
wa_events-form = 'FIRST_HEADING'.
APPEND wa_events TO it_events.
wa_events-name = slis_ev_user_command.
wa_events-form = 'USER_COMMAND'.
APPEND wa_events TO it_events.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = v_layout
it_fieldcat = it_disptab_field[]
i_tabname = 'DISPTAB'
it_events = it_events[] " Call 1st BLOCK TO BE APPENDED For SALES ANALYSIS
IT_SORT =
I_TEXT = ' '
TABLES
t_outtab = it_disptab
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
READ TABLE it_disptab INTO w_disptab INDEX rs_selfield-tabindex.
IF rs_selfield-fieldname = 'KUNAG'.
WRITE:/1 'invoice',
10 'Quantity in Base Unit',
20 'Base Unit',
30 'Qty in KL',
40 'Price'.
ENDIF.
ENDCASE.
ENDFORM. " USER_COMMAND
Please Help..
09-28-2011 9:18 AM
For my requirement, in the 1st block, I need to make a colum clickable, for which I have used the User_Command Event.
But this is not working. The second list is not gettin displayed.
What is your exact problem ??
Column click not working ?? 2nd list not visible ?? Is 2nd list visible if there is NO clickable column in 1st list ??
In your pasted code, there is no code for 2nd ALV list ...
09-28-2011 10:59 AM
Hi Diwakar,
After debugging my code, I have found out that, the basic list is clickable and the secondary , i.e detailed list is also displayed.
But the click should be field specific.
The field: rs_selfield-fieldname is not getting populated on clicking on a particular column in the basic list.
Only rs_selfield-tabindex is gettin populated. If i comment out the check :
CASE r_ucomm.
WHEN '&IC1'.
READ TABLE it_disptab INTO w_disptab INDEX rs_selfield-tabindex.
IF rs_selfield-fieldname = 'KUNAG'.
WRITE: /10 'Customer Code : ', w_disptab-kunag.
SKIP.
WRITE: /10 'Customer Name : ', w_disptab-party.
In this case the the second list is getting displayed not otherwise.
Also, the user_command is applied to all the blocks. On clicking on any of the blocks, the second list is getting displayed, which is not desired. I want only the 1st block to have the clicable property.
09-28-2011 12:23 PM
For getting click on specific field try to use the HOTSPOT for that field.
for getting the field name try using GET CURSOR FIELD f.
09-28-2011 12:33 PM
Hi,
Again you can write select query for secondary list purposed
thanks,
R
09-28-2011 12:41 PM
Hi Ganesh,
Thanks for your reply. I have already used hotspot on the fieldcat of the clickable field. But it seems that except for the hand cursor appearing only on that field, the other columns are also clickable.
Moreover, only the fiirst block should be clickable but all the blocks are applying the user_command.
This might be due to the REUSE_ALV_BLOCK_LIST_INIT Function Module, which applies to all the blocks.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = v_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USER_COMMAND'
IT_EXCLUDING =
.
In orser to avoid this, I am using the following code, which can be a temporary solution to the problem.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: row_count TYPE sy-lilli.
CASE r_ucomm.
WHEN '&IC1'.
DESCRIBE TABLE it_disptab LINES row_count.
READ TABLE it_disptab INTO w_disptab INDEX rs_selfield-tabindex.
IF rs_selfield-tabindex LE row_count AND rs_selfield-tabindex ne 0 AND rs_selfield-tabname = 'DISPTAB'.
PERFORM get_data.
PERFORM build_fieldcat.
PERFORM display_second_list.
ELSE.
EXIT.
ENDIF.
ENDCASE.
ENDFORM. " USER_COMMAND