Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Drilldown to one Transaction

Former Member
0 Kudos

Hi,

I have listed one report using 'REUSE_ALV_GRID_DISPLAY'. In my report i want to allow when clicking the po number it will automatically take into PO transaction. in list we can use at line-selection. here how to do ?

4 REPLIES 4

Former Member
0 Kudos

all function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = w_repid2

i_grid_title = w_title

i_bypassing_buffer = c_xflag_alv_flg

i_grid_settings = st_settings

is_layout = st_layout

it_sort = it_sort

it_fieldcat = it_fieldcat

it_events = it_events

<b>i_callback_user_command = 'user_comand'</b>

i_default = c_xflag_alv_flg

i_save = c_aflag_alv_flg

is_variant = w_variant2

tables

t_outtab = it_alv_data

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.

When ever we call the alv list display function module the function module call the form user_command.

If the form user_command you write the code for calling the 'MM03'

next

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

read table i_output into w_output index rs_selfield-tabindex.

lv_matnr = w_output-matnr.

lv_ebeln = w_output-ebeln.

ELSEIF SELFIELD-FIELDNAME = 'EBELN'.

SET PARAMETER ID 'BES' FIELD lv_ebeln.

CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.

ENDIF.

Clear: lv_ebeln.

ENDFORM.

<b>NXT u shud catch the doucble click action.</b>

when '&IC1'.

hopt it helps ..kindly reward points.if it help ..or revert back

0 Kudos

Hi,

I hope this will help you,

First you fix the HOTSPOT functionality for the EBELN in FIELDCATLOG so that the user will know it.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = i_repid

************

i_callback_user_command = 'USER_COMMAND_PERNR'

*****************

it_fieldcat = header

is_layout = gt_layout

i_callback_top_of_page = 'TOP-OF-PAGE1'

i_grid_title = 'Communication device details-Active+Deleted records'

it_sort = gt_sort[]

i_default = 'X'

i_save = 'U'

is_variant = gt_variant

it_events = gt_events[]

TABLES

t_outtab = ITAB.

FORM USER_COMMAND_PERNR USING u_ucomm LIKE sy-ucomm

us_selfield TYPE slis_selfield."#EC CALLED

CASE u_ucomm.

when '&IC1'.

if us_selfield-fieldname = 'EBELN'.

set parameter id 'BES' field us_selfield-value.

call transaction 'ME23' and skip first screen.

endif.

ENDCASE.

This will help you.

Thanks.

Message was edited by: Deepak333 k

Former Member
0 Kudos

see below simple code

REPORT zsdw_alv_dbl_click .

*Purchasing Document Header

TABLES: ekko.

TYPE-POOLS: slis. "ALV Declarations

*Data Declaration

*----


TYPES: BEGIN OF t_ekko,

ebeln TYPE ekpo-ebeln,

ebelp TYPE ekpo-ebelp,

statu TYPE ekpo-statu,

aedat TYPE ekpo-aedat,

matnr TYPE ekpo-matnr,

menge TYPE ekpo-menge,

meins TYPE ekpo-meins,

netpr TYPE ekpo-netpr,

peinh TYPE ekpo-peinh,

END OF t_ekko.

DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,

wa_ekko TYPE t_ekko.

*ALV data declarations

DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,

gd_repid LIKE sy-repid.

************************************************************************

*Start-of-selection.

START-OF-SELECTION.

PERFORM data_retrieval.

PERFORM build_fieldcatalog.

PERFORM display_alv_report.

&----


*& Form BUILD_FIELDCATALOG

&----


  • Build Fieldcatalog for ALV Report

----


FORM build_fieldcatalog.

fieldcatalog-fieldname = 'EBELN'.

fieldcatalog-seltext_m = 'Purchase Order'.

fieldcatalog-col_pos = 0.

fieldcatalog-outputlen = 10.

fieldcatalog-emphasize = 'X'.

fieldcatalog-key = 'X'.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

fieldcatalog-fieldname = 'EBELP'.

fieldcatalog-seltext_m = 'PO Item'.

fieldcatalog-col_pos = 1.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

fieldcatalog-fieldname = 'STATU'.

fieldcatalog-seltext_m = 'Status'.

fieldcatalog-col_pos = 2.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

fieldcatalog-fieldname = 'AEDAT'.

fieldcatalog-seltext_m = 'Item change date'.

fieldcatalog-col_pos = 3.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

fieldcatalog-fieldname = 'MATNR'.

fieldcatalog-seltext_m = 'Material Number'.

fieldcatalog-col_pos = 4.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

fieldcatalog-fieldname = 'MENGE'.

fieldcatalog-seltext_m = 'PO quantity'.

fieldcatalog-col_pos = 5.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

fieldcatalog-fieldname = 'MEINS'.

fieldcatalog-seltext_m = 'Order Unit'.

fieldcatalog-col_pos = 6.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

fieldcatalog-fieldname = 'NETPR'.

fieldcatalog-seltext_m = 'Net Price'.

fieldcatalog-col_pos = 7.

fieldcatalog-outputlen = 15.

fieldcatalog-datatype = 'CURR'.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

fieldcatalog-fieldname = 'PEINH'.

fieldcatalog-seltext_m = 'Price Unit'.

fieldcatalog-col_pos = 8.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

ENDFORM. " BUILD_FIELDCATALOG

&----


*& Form DISPLAY_ALV_REPORT

&----


  • Display report using ALV grid

----


FORM display_alv_report.

gd_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = gd_repid

i_callback_user_command = 'HANDLE_ALV_UCOMM'

it_fieldcat = fieldcatalog[]

i_save = 'X'

TABLES

t_outtab = it_ekko

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_ALV_REPORT

&----


*& Form DATA_RETRIEVAL

&----


  • Retrieve data form EKPO table and populate itab it_ekko

----


FORM data_retrieval.

SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh

UP TO 9 ROWS INTO TABLE it_ekko

FROM ekpo." WHERE MATNR = 'CH 01'.

ENDFORM. " DATA_RETRIEVAL

&----


*& Form HANDLE_ALV_UCOMM

&----


  • text

----


  • -->R_UCOMM text

  • -->RS_SELFIELDtext

----


FORM handle_alv_ucomm USING r_ucomm LIKE sy-ucomm rs_selfield TYPE

slis_selfield.

DATA : mess TYPE string, index(4) TYPE n.

DATA wa TYPE t_ekko.

index = rs_selfield-tabindex.

READ TABLE it_ekko INTO wa INDEX index.

SET PARAMETER ID : 'BES' FIELD wa-ebeln.

CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

CLEAR INDEX.

ENDFORM. "HANDLE_ALV_UCOMM

Former Member
0 Kudos

call function 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = w_repid2

i_grid_title = w_title

i_bypassing_buffer = c_xflag_alv_flg

i_grid_settings = st_settings

is_layout = st_layout

it_sort = it_sort

it_fieldcat = it_fieldcat

it_events = it_events

i_callback_user_command = <b>'USER_COMMAND'</b>

i_callback_pf_status_set = c_pf_status

i_default = c_xflag_alv_flg

i_save = c_aflag_alv_flg

is_variant = w_variant2

TABLES

t_outtab = &1

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 USER_COMMAND USING UCOMM

LIKE SY-UCOMM "#EC *

SELFIELD TYPE SLIS_SELFIELD.

CASE UCOMM.

WHEN '&IC1'.

IF SELFIELD-FIELDNAME = 'EBELN'.

SET PARAMETER ID 'BES' FIELD SELFIELD-VALUE.

CALL TRANSACTION 'ME23N'.

ENDIF.

ENDCASE.

ENDFORM.

<b>Note: When using ME23N skip first screen is not required.</b>