2006 Mar 21 3:00 PM
Hello,
Can you please tell me the equivalent of hide ...call transaction... for the ALV Grid, the clasical one, not OOP. I want to double click on a cell from the grid and to navigate to a certain tranzaction.
Thank you!
2006 Mar 21 3:12 PM
Hi
In the layout structure you can indicate the ok-code for doubleclick (field F2CODE):
IS_LAYOUT-F2CODE = 'DOUBLE'.
Assign the name of routine for user-command event in paramenter I_CALLBACK_USER_COMMAND and the name of calling (your) program in I_CALLBACK_PROGRAM.
gt_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gt_repid
i_callback_user_command = 'USER_COMMAND'
..................
The routine of user-command has to have this interface:
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
ENDFORM.
Anyway see the help for that parameter.
In this routine, you have to implement the abap code for doubleclick:
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE R_UCOMM.
WHEN 'DOUBLE'.
READ TABLE T_OUTPUT INDEX rs_selfield-tabix.
CASE rs_selfield-FIELDNAME.
WHEN 'FIELD1'.
SET PARAMETER ID <..> FIELD T_OUTPUT-FIELD1.
CALL TRANSACTION ........
WHEN 'FIELD2'.
.............
WHEN 'FIELDN'.
ENDCASE.
Max
Hello,
Can you please tell me the equivalent of hide ...call transaction... for the ALV Grid, the clasical one, not OOP. I want to double click on a cell from the grid and to navigate to a certain tranzaction.
Thank you!
2006 Mar 21 3:08 PM
in ALV where u populate the fields to the function module, it has an option which when used acts. So, when u double click on that field it takes to the corresponding screen which u mention in th
2006 Mar 21 3:11 PM
If you see the documentation for function module, it explains in detail how to do Interactive programming using ALV. See documentation for i_callback_pf_status_set and i_callback_user_command
Here is a sample code
To display basic list
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
i_grid_settings = wa_grid_settings
is_layout = wa_layout
it_fieldcat = tb_fieldcatalog[]
i_save = 'A'
it_events = tb_events[]
tables
t_outtab = tb_final
exceptions
program_error = 1
others = 2.
Event for User Command
&----
*& Form USER_COMMAND
&----
Subroutine for displaying Number of records details
----
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
Double click on the Process Order No
when '&IC1'.
perform display_procorder using rs_selfield.
endcase.
endform.
&----
*& Form DISPLAY_PROCORDER
&----
Display Process Order
----
form display_procorder using rs_selfield type slis_selfield.
Display Batch Details
if rs_selfield-sel_tab_field = 'TB_FINAL-MATNR' or
rs_selfield-sel_tab_field = 'TB_FINAL-CHARG' or
rs_selfield-sel_tab_field = 'TB_FINAL-WERKS'.
read table tb_used index rs_selfield-tabindex.
set parameter id 'MAT' field tb_FINAL-matnr.
set parameter id 'WRK' field tb_FINAL-werks.
set parameter id 'CHA' field tb_FINAL-charg.
call transaction 'MSC3N' and skip first screen.
endif.
endform. " DISPLAY_PROCORDER
2006 Mar 21 3:12 PM
Hi
In the layout structure you can indicate the ok-code for doubleclick (field F2CODE):
IS_LAYOUT-F2CODE = 'DOUBLE'.
Assign the name of routine for user-command event in paramenter I_CALLBACK_USER_COMMAND and the name of calling (your) program in I_CALLBACK_PROGRAM.
gt_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gt_repid
i_callback_user_command = 'USER_COMMAND'
..................
The routine of user-command has to have this interface:
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
ENDFORM.
Anyway see the help for that parameter.
In this routine, you have to implement the abap code for doubleclick:
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE R_UCOMM.
WHEN 'DOUBLE'.
READ TABLE T_OUTPUT INDEX rs_selfield-tabix.
CASE rs_selfield-FIELDNAME.
WHEN 'FIELD1'.
SET PARAMETER ID <..> FIELD T_OUTPUT-FIELD1.
CALL TRANSACTION ........
WHEN 'FIELD2'.
.............
WHEN 'FIELDN'.
ENDCASE.
Max
2006 Mar 21 3:25 PM
Hi,
See this sample...
REPORT ZTEST_ALV123 .
TYPE-POOLS:SLIS.
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0,
VBELN LIKE LIKP-VBELN,
POSNR LIKE LIPS-POSNR,
VGBEL LIKE LIPS-VGBEL,
VGPOS LIKE LIPS-VGPOS,
END OF ITAB1.
DATA: IT_LIPS LIKE ITAB1 OCCURS 0 WITH HEADER LINE.
SELECT VBELN
POSNR
up to 1000 rows
FROM VBAP
INTO TABLE ITAB.
IF SY-SUBRC = 0.
SORT ITAB BY VBELN .
SELECT VBELN
POSNR
VGBEL
VGPOS
INTO TABLE ITAB1
FROM LIPS
FOR ALL ENTRIES IN ITAB
WHERE VGBEL = ITAB-VBELN
AND VGPOS = ITAB-POSNR.
ENDIF.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'POPUP'
I_CALLBACK_USER_COMMAND = 'HANDLE_USER_COMMAND'
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC = 0.
ENDIF.
*&---------------------------------------------------------------------*
*& Form POPUP
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_EXTAB text
*----------------------------------------------------------------------*
FORM POPUP USING P_EXTAB TYPE SLIS_T_EXTAB.
*- Pf status
SET PF-STATUS 'POPUP'.
ENDFORM. " POPUP
*&---------------------------------------------------------------------*
*& Form HANDLE_USER_COMMAND
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->R_UCOMM text
* -->RS_SELFIELD text
*----------------------------------------------------------------------*
FORM HANDLE_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
SET PARAMETER ID 'AUN' FIELD RS_SELFIELD-VALUE.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM. "HANDLE_USER_COMMANDregards
Vjay
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |