12-29-2005 9:57 AM
Hi,
i'm usinf the REUSE* Function module to display ALV lists. By doubleclicking a cell i want to start a new transaction with the content of this cell as key. Example:
in the ALV list for HR a personal number is displayed. By doubleclicking i want to that TA PA20 (or PA30) with that personal number to display the data without selection screen.
How can i do that?
Thx in advance
Rainer
12-29-2005 10:05 AM
Hi,
Here is the sample code.Kindly reward points by clicking the star on the left of reply,if it helps.
report test.
type-pools : slis.
data : itab_events type slis_t_Event with header line,
it_output like vbak occurs 0 with header line,
itab_fldcat type SLIS_T_FIELDCAT_ALV.
data : v_Repid type sy-repid,
WA_FLDCAT TYPE SLIS_FIELDCAT_ALV .
start-of-selection.
v_repid = sy-repid.
select * from vbak into table it_output.
if sy-subrc = 0.
sort it_output by vbeln.
endif.
Field the field catalog
WA_FLDCAT-TABNAME = 'IT_OUTPUT'.
wa_fldcat-fieldname = 'VBELN'.
WA_FLDCAT-SELTEXT_M = 'Sales Document' .
WA_FLDCAT-COL_POS = 1 .
WA_FLDCAT-DDICTXT = 'M'.
WA_FLDCAT-KEY = 'X'.
WA_FLDCAT-HOTSPOT = 'X'.
append wa_fldcat to itab_fldcat.
clear wa_fldcat.
wa_fldcat-fieldname = 'AUART'.
WA_FLDCAT-TABNAME = 'IT_OUTPUT'.
WA_FLDCAT-SELTEXT_M = 'Order Type' .
WA_FLDCAT-COL_POS = 2 .
WA_FLDCAT-DDICTXT = 'M'.
append wa_fldcat to itab_fldcat.
clear wa_fldcat.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'FRM_ALV_USER_COMMAND'
I_STRUCTURE_NAME =
IS_LAYOUT =
IT_FIELDCAT = ITAB_FLDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = ITAB_EVENTS[]
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
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_output
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 frm_alv_user_command USING UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
case ucomm.
when '&IC1'.
IF SELFIELD-TABNAME = 'IT_OUTPUT'.
IF SELFIELD-FIELDNAME = 'VBELN'.
read table it_output index SELFIELD-TABINDEX.
if sy-subrc = 0.
SET PARAMETER ID 'AUN' FIELD IT_OUTPUT-VBELN.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
endif.
endif.
endif.
endcase.
endform.
*The UCOMM will always contain '&IC1'.
12-29-2005 9:58 AM
Use the statement in the at user-command event.
Call transaction 'PA20' <and skip first screen-optional>.
12-29-2005 10:05 AM
12-29-2005 10:04 AM
case sy-ucomm.
when '&IC1'
SET PARAMETER ID 'PER' FIELD IT_FINAL-PERNR.
CALL TRANSACTION 'PA20' AND SKIP FIRST SCREEN.
similarly Pa30
vijay
12-29-2005 10:13 AM
**-ALV list Display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET1'
<b>I_CALLBACK_USER_COMMAND = 'USER_COMMAND'</b>
IS_LAYOUT = X_LAYOUT
IT_FIELDCAT = IT_FIELDCAT1
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = IT_VEKP1
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 UCOMM LIKE SY-UCOMM SELFIELD TYPE SLIS_SELFIELD.
CASE UCOMM.
**-When User Double Clicks
WHEN '&IC1'.
IF SELFIELD-TABINDEX <> 0.
**if user clicks on sales order
SET PARAMETER ID 'PER' FIELD IT_FINAL-PERNR.
CALL TRANSACTION 'PA20' AND SKIP FIRST SCREEN
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDFORM.
</b>
try this...
Message was edited by: Vijay Babu Dudla
12-29-2005 10:05 AM
Hi,
Here is the sample code.Kindly reward points by clicking the star on the left of reply,if it helps.
report test.
type-pools : slis.
data : itab_events type slis_t_Event with header line,
it_output like vbak occurs 0 with header line,
itab_fldcat type SLIS_T_FIELDCAT_ALV.
data : v_Repid type sy-repid,
WA_FLDCAT TYPE SLIS_FIELDCAT_ALV .
start-of-selection.
v_repid = sy-repid.
select * from vbak into table it_output.
if sy-subrc = 0.
sort it_output by vbeln.
endif.
Field the field catalog
WA_FLDCAT-TABNAME = 'IT_OUTPUT'.
wa_fldcat-fieldname = 'VBELN'.
WA_FLDCAT-SELTEXT_M = 'Sales Document' .
WA_FLDCAT-COL_POS = 1 .
WA_FLDCAT-DDICTXT = 'M'.
WA_FLDCAT-KEY = 'X'.
WA_FLDCAT-HOTSPOT = 'X'.
append wa_fldcat to itab_fldcat.
clear wa_fldcat.
wa_fldcat-fieldname = 'AUART'.
WA_FLDCAT-TABNAME = 'IT_OUTPUT'.
WA_FLDCAT-SELTEXT_M = 'Order Type' .
WA_FLDCAT-COL_POS = 2 .
WA_FLDCAT-DDICTXT = 'M'.
append wa_fldcat to itab_fldcat.
clear wa_fldcat.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'FRM_ALV_USER_COMMAND'
I_STRUCTURE_NAME =
IS_LAYOUT =
IT_FIELDCAT = ITAB_FLDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = ITAB_EVENTS[]
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
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_output
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 frm_alv_user_command USING UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
case ucomm.
when '&IC1'.
IF SELFIELD-TABNAME = 'IT_OUTPUT'.
IF SELFIELD-FIELDNAME = 'VBELN'.
read table it_output index SELFIELD-TABINDEX.
if sy-subrc = 0.
SET PARAMETER ID 'AUN' FIELD IT_OUTPUT-VBELN.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
endif.
endif.
endif.
endcase.
endform.
*The UCOMM will always contain '&IC1'.