04-16-2007 3:29 PM
hallow i wont to learn about event double click in alv
did some one have pdf or word docoument that explain that
regards
04-16-2007 3:33 PM
04-16-2007 3:33 PM
04-16-2007 3:38 PM
04-16-2007 3:39 PM
04-16-2007 3:44 PM
Hi Antonio,
Refer to this code.. it will really help you. This is a drill down report....
On double clicking vbeln in output, control will take you to ME53N transaction.
report zsample .
----
----
T Y P E - P O O L S
----
Alv-Grid Type
type-pools :slis.
----
T A B L E S
----
*Tables
tables: vbap.
----
I N T E R N A L T A B L E S
----
data: ls_fieldcat_alv type slis_fieldcat_alv, "FIELD CATALOG LIST FOR ALV
tb_field_cat type slis_t_fieldcat_alv, "FIELD CATALOG
top_of_page type slis_t_listheader,
ls_line type slis_listheader,
i_sort type slis_t_sortinfo_alv.
data: begin of tb_vbap occurs 0,
vbeln like vbap-vbeln,
kwmeng like vbap-kwmeng,
end of tb_vbap.
----
V A R I A B L E S
----
Global Variables
data: g_repid like sy-repid. "Report ID
----
S E L E C T I O N S C R E E N
----
For User Input(Selection Criteria)
selection-screen begin of block b0 with frame title text-001.
select-options :
s_vbeln for vbap-vbeln.
selection-screen end of block b0.
----
I N I T I A L I Z A T I O N
----
initialization.
Program ID
g_repid = sy-repid. " Prog ID
----
S T A R T - O F - S E L E C T I O N
----
start-of-selection.
set pf-status 'SAMPLE'.
FIELD CATALOG FOR ALV
perform field_catalog using tb_field_cat.
For logo and heading
perform comment_build using top_of_page.
Get Data
perform get_data.
To sort the field and for sub-totals
perform t_sort_build using i_sort.
For displaying the alv
perform display.
----
F O R M S
----
&----
*& Form FILL_FIELD_CATALOG_UOM
&----
text
----
FIELD CATALOG FOR ALV
----
form field_catalog using l_fieldcat type slis_t_fieldcat_alv.
clear ls_fieldcat_alv.
ls_fieldcat_alv-fieldname = 'VBELN'.
ls_fieldcat_alv-key = 'x'.
ls_fieldcat_alv-col_pos = 1.
ls_fieldcat_alv-ref_fieldname = 'VBELN'.
ls_fieldcat_alv-ref_tabname = 'VBAP'.
ls_fieldcat_alv-no_sum = 'x'.
append ls_fieldcat_alv to l_fieldcat.
clear ls_fieldcat_alv.
ls_fieldcat_alv-fieldname = 'KWMENG'.
ls_fieldcat_alv-key = ''.
ls_fieldcat_alv-col_pos = 2.
ls_fieldcat_alv-ref_fieldname = 'KWMENG'.
ls_fieldcat_alv-ref_tabname = 'VBAP'.
ls_fieldcat_alv-do_sum = 'x'.
append ls_fieldcat_alv to l_fieldcat.
clear ls_fieldcat_alv.
endform. " FILL_FIELD_CATALOG_UOM
&----
*& Form GET_DATA
&----
text
----
--> p1 text
<-- p2 text
----
form get_data.
select vbeln
kwmeng
from vbap
into table tb_vbap
where vbeln in s_vbeln.
endform. " GET_DATA
----
FORM COMMENT_BUILD *
----
--> L_TOP_OF_PAGE *
----
form comment_build using i_list_top_of_page type slis_t_listheader.
data: ls_line type slis_listheader.
***Header
clear : ls_line.
ls_line-typ = 'H'.
LS_LINE-KEY: not used for this type
ls_line-info = 'Heading list'.
append ls_line to i_list_top_of_page.
***Selection
clear ls_line.
ls_line-typ = 'S'.
ls_line-key = 'Key 1'.
ls_line-info = 'Information'.
append ls_line to i_list_top_of_page.
ls_line-key = 'Key 2'.
append ls_line to i_list_top_of_page.
***Action
clear ls_line.
ls_line-typ = 'A'.
LS_LINE-KEY: not used for this type
ls_line-info = 'Status list'.
append ls_line to i_list_top_of_page.
endform. "comment_build
&----
*& Form display
&----
text
----
--> p1 text
<-- p2 text
----
form display .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = g_repid
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
i_background_id = 'ALV_BACKGROUND'
it_fieldcat = tb_field_cat
it_sort = i_sort[]
tables
t_outtab = tb_vbap
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. " display
----
FORM TOP_OF_PAGE *
----
........ *
----
form top_of_page.
*
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = top_of_page.
endform. "top_of_page
&----
*& Form t_sort_build
&----
text
----
-->L_SORT text
----
form t_sort_build using l_sort type slis_t_sortinfo_alv.
data: ls_sort type slis_sortinfo_alv.
ls_sort-fieldname = 'VBELN'.
ls_sort-spos = 1.
ls_sort-up = 'X'.
ls_sort-subtot = 'X'.
append ls_sort to l_sort.
endform. "t_sort_build
&----
*& Form USER_COMMAND
&----
text
----
-->R_UCOMM text
-->RS_SELFIELDtext
----
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when '&IC1'. "doubleclick
check rs_selfield-fieldname = 'VBELN'.
read table tb_vbap index rs_selfield-tabindex.
call transaction 'ME53N' and skip first screen.
endcase.
endform. "USER_COMMAND
Reward if found useful....
04-16-2007 3:47 PM
04-16-2007 3:50 PM
Hi..,
<b>Assigning a function to double-click
Procedure : </b>
The function code 'F2' for double-click or hotspot must have the ALV standard function code
'&IC1' in the interface. This applies for both the ALV standard interface and applicationspecifically
enhanced interfaces.
If double-click or hotspot should call another function code, you can assign the function code
to be called to the field <b>IS_LAYOUT-F2CODE</b> in the ALV importing structure <b>IS_LAYOUT</b>. Any
function (ALV standard or application-specific function) can be assigned to double-click or
hotspot in this way.
The ALV standard function 'List row details' can be assigned to double-click by
assigning <b>IS_LAYOUT-F2CODE = '&ETA'</b> and passing the layout structure to
ALV module.
regards,
sai ramesh