01-09-2008 7:26 AM
Hi guys ,
I have created an ALV report using the CAll function " REUSE alv grid display "
I want the functionality that on double clicking the doc nr ( belnr of table bseg ) the doc should open .
I have found the folowing cod from sdn
FORM dis_data.
g_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_user_command = 'USER_COMMAND'
i_grid_title = 'Interactive ALV'
it_fieldcat = fcat
it_events = eve
TABLES
t_outtab = itab
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.
ENDFORM. "dis_data
FORM user_command USING u_com LIKE sy-ucomm sel_field TYPE slis_selfield.
CLEAR fcat1.
CASE u_com.
WHEN '&IC1'.
READ TABLE itab INDEX sel_field-tabindex.
IF sy-subrc = 0.
t_doc = itab-vbeln.
SET PARAMETER ID 'AUN' FIELD t_doc.
CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM. "user_command
In the above code there is an event eve .. does someone kno what is this. also what is t_doc here .
Which parameter id should i set .
Thanks & Regards
Ashish
01-09-2008 7:36 AM
Hi Ashish,
let's go step by step:
1. "eve" is an internal table that holds the list events you would like to handle. A typical example could be:
DATA: eve TYPE slis_t_event.
DATA: le_events TYPE slis_alv_event.
le_events-name = 'TOP_OF_PAGE'.
le_events-form = 'PRINT_TOP'.
APPEND le_events TO eve.
le_events-name = 'END_OF_LIST'.
le_events-form = 'PRINT_SELECTIONS'.
APPEND le_events TO eve.
...where PRINT_TOP and PRINT_SELECTIONS are FORMs that carry out some headers and some footers of the listing.
2. "t_doc" seems to me to be a variable that stores a sales document number (VBELN), which is then passed to a SET/GET parameter 'AUN'.
I strongly recommend you to have a llok at the documentation of the parameters of function module REUSE_ALV_GRID_DISPLAY, it is VERY complete and helpful.
I hope this helps. Best regards,
Alvaro
01-09-2008 7:31 AM
Hi,
Please refer to the link below :
http://www.sapdev.co.uk/reporting/alv/alvgrid_ucomm.htm
Thanks,
Sri,
01-09-2008 7:41 AM
I HAVE CHECKED THE CODE ,
i want the belnr of bseg to be displayed can you let me know what parameter id should be set
01-09-2008 7:36 AM
Hi Ashish,
let's go step by step:
1. "eve" is an internal table that holds the list events you would like to handle. A typical example could be:
DATA: eve TYPE slis_t_event.
DATA: le_events TYPE slis_alv_event.
le_events-name = 'TOP_OF_PAGE'.
le_events-form = 'PRINT_TOP'.
APPEND le_events TO eve.
le_events-name = 'END_OF_LIST'.
le_events-form = 'PRINT_SELECTIONS'.
APPEND le_events TO eve.
...where PRINT_TOP and PRINT_SELECTIONS are FORMs that carry out some headers and some footers of the listing.
2. "t_doc" seems to me to be a variable that stores a sales document number (VBELN), which is then passed to a SET/GET parameter 'AUN'.
I strongly recommend you to have a llok at the documentation of the parameters of function module REUSE_ALV_GRID_DISPLAY, it is VERY complete and helpful.
I hope this helps. Best regards,
Alvaro
01-09-2008 8:06 AM
Hi Alvaro ,
Thanks 4 ur reply .
I have user USER COMMAND , so do
i still need the it_event .
Edited by: Ashish Joshi on Jan 9, 2008 9:07 AM
01-09-2008 8:17 AM
Hi again, Ashish.
It's not necessary; just call function REUSE_ALV_GRID_DISPLAY with parameter
i_callback_user_command = 'USER_COMMAND'
and then create a FORM USER_COMMAND in order to handle the status:
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
*
CASE r_ucomm.
WHEN xxx.
...
WHEN OTHERS.
ENDCASE.
rs_selfield-refresh = c_yes.
rs_selfield-col_stable = c_yes.
rs_selfield-row_stable = c_yes.
*
ENDFORM. " user_command
I hope this helps. Kind regards,
Alvaro
01-09-2008 8:19 AM
By default Double-click give r_ucomm = '&IC1'. in user_command form. You can change this value when calling REUSE_ALV_GRID_DISPLAY in field F2CODE of parameter IS_LAYOUT, if not don't forget to clear r_ucomm after your code. Double-click is so frequent that it is managed in Function Miodule parameter, you don't need to manage events for this one.
To call FB03 (display accounting document) use parameter id BLN for BELNR doc. nr, BUK for BUKRS society and GJR for GJAHR year. (Call FB03 and press F1 then F9 on parameter fields to find the parameter id).
Regards
01-09-2008 8:10 AM