2010 Aug 18 6:02 AM
Hi,
I am generating the ALV grid using the FM REUSE_ALV_GRID_DISPLAY.
I want to capture the event of a button click on the toolbar.
When I click on the button or do anything on the screen like click on back button, it gives a runtime error saying "Assignment error: Overwriting a protected field."
There is a user_command perform in the report to handle the i_callback_user_command parameter of the FM.
Kindly suggest what could be missing.
Regards,
kshitija
Hi,
I am generating the ALV grid using the FM REUSE_ALV_GRID_DISPLAY.
I want to capture the event of a button click on the toolbar.
When I click on the button or do anything on the screen like click on back button, it gives a runtime error saying "Assignment error: Overwriting a protected field."
There is a user_command perform in the report to handle the i_callback_user_command parameter of the FM.
Kindly suggest what could be missing.
Regards,
kshitija
2010 Aug 18 6:31 AM
Hi
TO fetch the user command in your ALV, you need to create a FORM and do your coding to fetch the functionality for your FCODE of the button.
Then pass this FORM to i_callback_user_command.
I hope this will work for you.
Thanks
Lalit Gupta
2010 Aug 18 6:41 AM
I have the form for user_command already.
While debugging I saw that this form is not being called at all.
in th call to the FM REUSE_ALV_GRID_DISPLAY i have passed the form name as well:
i_callback_user_command = 'USER_COMMAND'
Any hints why?
2010 Aug 18 6:46 AM
Hi
Have you coded for the USER_COMMAND in the subroutine just refer below code:_
FORM USER_COMMAND USING L_UCOMM LIKE SY-UCOMM
LS_SELFIELD TYPE SLIS_SELFIELD.
CASE L_UCOMM.
WHEN '&IC1'.
READ TABLE IT_SFLIGHT INDEX LS_SELFIELD-TABINDEX INTO WA_SFLIGHT.
SELECT * FROM SPFLI INTO TABLE IT_SPFLI
WHERE CARRID = WA_SFLIGHT-CARRID.
WRITE : / SY-VLINE,(10) 'CARRID' CENTERED COLOR 7,
SY-VLINE,(10) 'CONNID' CENTERED COLOR 7,
SY-VLINE,(10) 'CITYFROM' CENTERED COLOR 7,
SY-VLINE,(10) 'CITYTO' CENTERED COLOR 7,
SY-VLINE,/ SY-ULINE.
LOOP AT IT_SPFLI INTO WA_SPFLI.
WRITE :/ SY-VLINE,(10) WA_SPFLI-CARRID COLOR 1,
SY-VLINE,(10) WA_SPFLI-CONNID COLOR 1,
SY-VLINE,(10) WA_SPFLI-CITYFROM COLOR 1,
SY-VLINE,(10) WA_SPFLI-CITYTO COLOR 1,
SY-VLINE,/ SY-ULINE.
ENDLOOP.
ENDCASE.
ENDFORM. "USER_COMMANDRegards
Abhii
2010 Aug 18 6:48 AM
2010 Aug 18 6:53 AM
2010 Aug 18 6:59 AM
FM call:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BACKGROUND_ID = 'ALV_BACKGROUND'
i_buffer_active = 'X'
i_callback_program = g_repid
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
i_structure_name = 'ZFDD_HD'
is_layout = gs_layout
i_save = 'X'
IS_VARIANT = GS_VARIANT
IT_EVENTS = GT_EVENTS[]
I_SCREEN_START_COLUMN = 0 "Use coordinates for
I_SCREEN_START_LINE = 0 "display as dialog box
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = gs_exit_caused_by_user
TABLES
t_outtab = is_po_hdr
EXCEPTIONS
program_error = 1
OTHERS = 2.
User command perform:
FORM user_command USING p_ucomm LIKE sy-ucomm
p_selfield TYPE slis_selfield.
CASE p_ucomm.
WHEN '&F03' OR '&F15' OR '&F12'.
LEAVE TO SCREEN 0.
WHEN '&IC1'. " SAP standard code for double-clicking
call to another fm.
endcase.
endform.
2010 Aug 18 7:19 AM
Hi
I beleive this is because you are not passing the program name in I_callback_program parameter in your FM.
declare a variable in which pass the Sy-Repid and then pass this variable to this parameter of FM Reuse_ALV_Grid.
See below.
DATA V_REPID TYPE SY-REPID. " VARIABLE FOR SY-REPID.
Also Why you are calling another FM in side the form for user command, and which fm you are calling.
I beleive there is a minor mistake.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |