05-02-2008 9:21 AM
Hi friends ,
i have created blocked ALV and Simple ALV report.i wanted to use At line-selection event .
if anybody knows please let me know.
]
thanks and regards,
shridevi
05-02-2008 9:24 AM
Create a hotspot and add user command to the ALV, when one click the line then some action should initiate. Thuse you can implement the 'at line-selection' event in ALV.
Refer the following code:
REPORT zdemoab.
TYPE-POOLS: slis.
TABLES: mara.
TYPES: BEGIN OF t_itab,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
END OF t_itab.
DATA: itab TYPE TABLE OF t_itab,
wa_itab like line of itab.
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF i_fieldcat,
i_layout TYPE slis_layout_alv,
g_repid TYPE sy-repid.
SELECT matnr mtart INTO TABLE itab FROM mara UP TO 10 ROWS.
CLEAR: wa_fieldcat.
wa_fieldcat-col_pos = 0.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = 'MARA'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR: wa_fieldcat.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'MTART'.
wa_fieldcat-tabname = 'MARA'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR: wa_fieldcat.
i_layout-colwidth_optimize = 'X'.
i_layout-hotspot_fieldname = 'MATNR'.
g_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
I_CALLBACK_USER_COMMAND = 'USER_COMMAND '
is_layout = i_layout
it_fieldcat = i_fieldcat[]
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.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'MATNR'.
* To pass the material no in ME22 transaction
READ TABLE itab INTO wa_itab INDEX rs_selfield-tabindex.
* Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_itab-matnr.
* Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'MM03'.
*
ENDIF.
ENDFORM.
05-02-2008 9:25 AM
hi shridevi
check this links for diffrent alv funtonality
For alv
http://www.sap-img.com/abap-function.htm
http://www.saptechnical.com/Tutorials/ALV/ALVMainPage.htm
thanks & regards
snehi chouhan
05-05-2008 7:25 AM
hi .
Thanks for your answer.
you have sent program without perform statment.can u send some other example or can you tell where to use that function module.
thanks and regards,
shridevi.