11-20-2006 2:28 PM
Hi Friends,
I have one query for ALV grid.
Actually my requirement is like that
Whenever the user double click on grid the control moves to transaction 'VA01' tcode.
I also wanted to set the gui status in ALV grid.
How to do it??
Plz tell me in detail.
11-20-2006 2:33 PM
How do I program double click in ALV?
11-20-2006 2:33 PM
Salil,
Take a look at these example programs
http://www.geocities.com/mpioud/Z_ALV_SWITCH_LIST.html
http://www.geocities.com/mpioud/Z_REUSE_ALV_POPUP_TO_SELECT.html
regards,
Ravi
Note - Please mark all the helpful answers
11-20-2006 2:36 PM
Hi,
Pl find eg below :
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
*When doube click call respective tansaction .
DATA:lw_output LIKE LINE OF t_output.
CASE R_UCOMM.
WHEN '&IC1'.
IF RS_SELFIELD-FIELDNAME = 'MATNR'.
READ TABLE t_output INTO lw_output INDEX RS_SELFIELD-TABINDEX.
Set parameter ID for transaction screen field
if sy-subrc = 0.
SET PARAMETER ID 'MAT' FIELD lw_output-matnr .
CALL TRANSACTION 'MM43' AND SKIP first SCREEN.
CLEAR r_ucomm.
endif.
ENDIF.
ENDCASE.
ENDFORM
If sounds good pl reward.
Cheers.
11-20-2006 2:37 PM
Very simple....
copy paste this code.... remember I have created a GUI Status called ZALV_STATUS.
So u will have to create this status to run ur program.
U can come back if u have any doubts...
****************************************
&----
*& Report Z_ALV_TRAINING_LIST_HOTSPOT
*&
&----
*&
*&
&----
REPORT Z_ALV_TRAINING_LIST_HOTSPOT.
Type Pools Used **********
TYPE-POOLS : SLIS.
Internal Tables Declare ************
DATA : it_document type standard table of bkpf initial size 0 with header line,
IT_FIELD_CAT TYPE SLIS_T_FIELDCAT_ALV,
it_alv_event type SLIS_T_EVENT,
fl_layout type slis_layout_alv.
Select Data ***********
start-of-selection.
select * from bkpf into table it_document.
Make Field Catalog ******
PERFORM MAKE_FIELD_CATALOG.
Make Layout *********
perform sub_fill_layout.
Make Events Table *******
perform sub_Fill_alv_event.
Display ALV *********
PERFORM DISPLAY_ALV_LIST.
----
&----
*& Form make_field_catalog
&----
text
----
--> p1 text
<-- p2 text
----
FORM MAKE_FIELD_CATALOG .
data : wa type slis_fieldcat_alv.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME =
I_INTERNAL_TABNAME =
I_STRUCTURE_NAME = 'bkpf'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = it_field_cat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
read table it_field_cat into wa index 3.
wa-hotspot = 'X'.
modify it_field_cat index 3 from wa.
ENDFORM. " make_field_catalog
&----
*& Form display_alv_list
&----
text
----
--> p1 text
<-- p2 text
----
FORM DISPLAY_ALV_LIST .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_PF_STATUS_SET = 'SET_MY_PF_STATUS'
I_CALLBACK_USER_COMMAND = ' '
IS_LAYOUT = fl_layout
IT_FIELDCAT = it_field_cat[]
IT_SORT =
I_DEFAULT = 'X'
I_SAVE = 'X'
IS_VARIANT = '/TEST_VV'
IT_EVENTS = it_alv_event
TABLES
T_OUTTAB = it_document.
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_alv_list
&----
*& Form sub_my_pf_event
&----
text
----
--> p1 text
<-- p2 text
----
FORM sub_my_pf_event using p_comm type sy-ucomm p_sEL_FIELD TYPE SLIS_SELFIELD.
read table it_document index p_sel_field-tabindex.
set parameter id 'BLN' field it_document-belnr.
set parameter id 'BUK' field it_document-bukrs.
set parameter id 'GJR' field it_document-gjahr.
case p_comm.
when 'PICK'.
call transaction 'FB03' and skip first screen.
endcase.
ENDFORM. " sub_my_pf_event
&----
*& Form sub_Fill_alv_event
&----
text
----
--> p1 text
<-- p2 text
----
FORM sub_Fill_alv_event .
data : wa type slis_alv_event.
wa-name = 'USER_COMMAND'.
wa-form = 'SUB_MY_PF_EVENT'.
append wa to it_alv_event.
ENDFORM. " sub_Fill_alv_event
&----
*& Form sub_fill_layout
&----
text
----
--> p1 text
<-- p2 text
----
FORM sub_fill_layout .
fl_layout-f2code = 'PICK'.
fl_layout-box_fieldname = 'BELNR'.
ENDFORM. " sub_fill_layout
&----
*& Form SET_MY_PF_STATUS
&----
text
----
--> p1 text
<-- p2 text
----
FORM SET_MY_PF_STATUS USING p_rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZALV_STATUS'.
ENDFORM. " SET_MY_PF_STATUS
*******************************************
Plz award points if it was helpful....
Message was edited by:
Varun Verma
11-20-2006 2:47 PM
Hi Singh,
CALL FUNCTION REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = V_REPID
<b> I_CALLBACK_PF_STATUS_SET = 'FRM_PF_STATUS'</b>
<b> I_CALLBACK_USER_COMMAND = 'USER_COMMAND'</b>
I_STRUCTURE_NAME =
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FLDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
i_default = 'X'
i_save = 'A'
IS_VARIANT = ' '
it_events =
IT_EVENT_EXIT =
IS_PRINT =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_FINAL_SCMPO
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.
*********FOR PF STATUS
FORM FRM_PF_STATUS <b>USING T_EXTAB TYPE SLIS_T_EXTAB.</b>
<b>SET PF-STATUS 'ZPO'</b>
ENDFORM.
***for user command*****
<b>FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.</b>
case r_ucomm.
when 'BACK' or 'CANC' or 'EXIT'.
leave to screen 0.
when '&IC1'.
set parameter id 'AUN' field rs_selfield-value.
call transaction 'VA03' and skip first screen.
endcase.
ENDFORM. "USER_COMMAND
Thanks
Vikranth Khimavath
Message was edited by:
Khimavath Vikranth
Message was edited by:
Khimavath Vikranth
11-21-2006 10:14 AM
Hi,
I have prepared my pf status & activated but still it is not displaying in alv grid.
Anybody will tell me what is the reason for this??
11-21-2006 10:17 AM
hi,
simple chk this link.
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid.htm
code is there.
just cut and pste.
reagrds
Anver