10-10-2007 6:43 AM
Hi,
I have displayed the ALV report.
Now I want to create a single user command case so that if I double click on the record I go to transaction IW33. After going to IW33 when I click ob 'back' button it should come back to the ALV report.
Can anyone tell me how I can do this? Please post the lines of code if possible
10-10-2007 6:50 AM
Call this perform berfor u dispaly the ALV ie before REUSE_ALV_GRID_DISPLAY
DATA: it_eventcat TYPE slis_t_event.
DATA: wa_eventcat TYPE slis_alv_event.
FORM p_eventcat .
CLEAR wa_eventcat.
REFRESH it_eventcat.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_eventcat
EXCEPTIONS
list_type_wrong = 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.
READ TABLE it_eventcat WITH KEY name = slis_ev_user_command INTO wa_eventcat.
IF sy-subrc = 0.
MOVE 'ZUCOMM' TO wa_eventcat-form.
MODIFY it_eventcat FROM wa_eventcat INDEX sy-tabix TRANSPORTING form.
ENDIF.
FORM zucomm USING vcomm TYPE sy-ucomm
p_selfield TYPE slis_selfield.
CASE vcomm.
WHEN 'PICK'.
IF p_selfield-fieldname = '<Field which is clicked>'.
READ TABLE it_final INTO wa_final WITH KEY vbeln = p_selfield-value.
SET PARAMETER ID '<get it from Technical help of that field F1 & F9>' FIELD wa_final-vbeln.
CALL TRANSACTION 'IW33' .
endcase.
This works.
Reward if helpful
10-10-2007 1:08 PM
hi,
try like this.
DATA:t_eve TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = eve
EXCEPTIONS
LIST_TYPE_WRONG = 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.
READ TABLE eve INTO t_eve WITH KEY name = 'USER_COMMAND'.
IF sy-subrc = 0.
t_eve-form = 'USER_COMMAND'.
MODIFY eve FROM t_eve TRANSPORTING form WHERE name = t_eve-name.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZINT_ALV'
<b> i_callback_user_command = 'USER_COMMAND'</b>
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.
<b>FORM user_command USING u_com LIKE sy-ucomm sel_field TYPE slis_selfield.</b>
CLEAR fcat1.
CASE u_com.
WHEN '&IC1'.
READ TABLE itab INDEX sel_field-tabindex.
IF sy-subrc = 0.
t_mat = itab-matnr.
ENDIF.
SET PARAMETER ID 'MAT' FIELD t_mat.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
ENDCASE.
<b>ENDFORM. "user_command</b>
here instead of
<b>SET PARAMETER ID 'MAT' FIELD t_mat.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.</b>
you have to write,
<b>SET PARAMETER ID 'ANR' FIELD t_mat.
CALL TRANSACTION 'IW33' AND SKIP FIRST SCREEN.</b>
here in t_mat, take the order number on which cursor is placed.
reward if useful.
10-10-2007 1:21 PM
Hi Deepayan,
try using,
AT LINE-SELECTION.
Getting The Field Name and value of the field selected by the user
GET CURSOR FIELD <fieldname> VALUE <fieldvalue>.
in ur case field name will be order number as u will b clicking on the order number 2 go to the ) display order transaction IW33 .
If the user double clicks on the material number
IF <fieldname> = <Output field name of the order number field> AND NOT <fieldvalue> IS INITIAL.
Call the transaction to display Material Number
SET PARAMETER ID 'ANR' FIELD <fieldvalue>.
CALL TRANSACTION IW33 AND SKIP FIRST SCREEN.