Skip to Content
-5

Double clicking on ALV in order to display a detail screen

Feb 14 at 07:14 PM

142

avatar image

Hi all,

When working with SE16, I can bring up a detail screen by just double-clicking one of the ALV’s lines. Similarly, when displaying an ALV from my own, a detail screen can be shown by either clicking the corresponding icon or by pressing CTRL+SHIFT+F3.

What I would like to know is how to display the detail screen in my (Z) program by just double clicking a particular line.

Thanks in advance,

Luis

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Balaji Nandikolla Feb 15 at 03:51 AM
0

Hi Luis,

If you are using CL_GUI_ALV_GRID in your custom program, the following are the steps to achieve it:

1. Register event handler method for double click, then this method is called for every double-click on particular line
2. In the event handler method, read the line using row id/index, and prepare details to be displayed
3. Finally, make a call to LVC_ITEM_DETAIL (FM) to display details

=

Regards,
Balaji


detail-alv.png (23.1 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Balaji,

Thanks for your answer.

I'm aware of both, handling events for double-click and the LVC_ITEM_DETAIL FM. Nevertheless, I thought that *maybe* there was a simpler or more direct method in ABAP. After all, somehow the ALV is able to do it behind the scenes and I hoped that there was a way to "intercept" or call this method directly, without any need to identify and isolate the record, copy it to another itab, etc.

Thanks again,

Luis

0
Krishna Murthy Feb 19 at 04:45 AM
0

hi

for your requirement pass function code of details screen to attribute of layout in alv.

for info, please see below simple code.

REPORT ZDEMO2.

TYPE-POOLS:SLIS.

TYPES:BEGIN OF TY_FINAL,
VBELN TYPE VBAK-VBELN,
KUNNR TYPE VBAK-KUNNR,
END OF TY_FINAL,
TT_FINAL TYPE STANDARD TABLE OF TY_FINAL.


DATA:GT_FINAL TYPE TT_FINAL,
GS_FINAL TYPE TY_FINAL.


DATA:GS_LAYOUT TYPE SLIS_LAYOUT_ALV.

DATA:GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
GS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.







START-OF-SELECTION.

SELECT VBELN KUNNR FROM VBAK INTO TABLE GT_FINAL UP TO 700 ROWS.





END-OF-SELECTION.



CLEAR GS_FIELDCAT.
GS_FIELDCAT-FIELDNAME = 'VBELN'.
GS_FIELDCAT-SELTEXT_L = 'SO Number'.
APPEND GS_FIELDCAT TO GT_FIELDCAT.

CLEAR GS_FIELDCAT.
GS_FIELDCAT-FIELDNAME = 'KUNNR'.
GS_FIELDCAT-SELTEXT_L = 'Customer Code'.
APPEND GS_FIELDCAT TO GT_FIELDCAT.


CLEAR GS_LAYOUT.
GS_LAYOUT-F2CODE = '&ETA'. " note here pass function code of details to layout attribute.



CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT
TABLES
T_OUTTAB = GT_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.

IF 1 = 4.

ENDIF.

Show 3 Share
10 |10000 characters needed characters left characters exceeded

HI

see picture

img.jpg (111.3 kB)
0

Krishna,

Thanks for your post. Your idea looks quite interesting. Nevertheless, I'm afraid that f2code seems to be missing from the lvc_s_layo type (used with REUSE_ALV_GRID_DISPLAY_LVC.

Would you per any chance know the F2code equivalent for LVC's layout definition?

Thanks again,

Luis

0

hi

for FM REUSE_ALV_GRID_DISPLAY_LVC please see below sample report.

REPORT ZDEMO2.



TYPE-POOLS:SLIS.

TYPES:BEGIN OF TY_FINAL,
VBELN TYPE VBAK-VBELN,
KUNNR TYPE VBAK-KUNNR,
END OF TY_FINAL,
TT_FINAL TYPE STANDARD TABLE OF TY_FINAL.


DATA:GT_FINAL TYPE TT_FINAL,
GS_FINAL TYPE TY_FINAL.


DATA:GS_LAYOUT TYPE LVC_S_LAYO.

DATA:GT_FIELDCAT TYPE LVC_T_FCAT,
GS_FIELDCAT TYPE LVC_S_FCAT.








START-OF-SELECTION.

SELECT VBELN KUNNR FROM VBAK INTO TABLE GT_FINAL UP TO 10 ROWS.





END-OF-SELECTION.



CLEAR GS_FIELDCAT.
GS_FIELDCAT-FIELDNAME = 'VBELN'.
GS_FIELDCAT-SCRTEXT_L = 'SO NUMBER'.
APPEND GS_FIELDCAT TO GT_FIELDCAT.

CLEAR GS_FIELDCAT.
GS_FIELDCAT-FIELDNAME = 'KUNNR'.
GS_FIELDCAT-SCRTEXT_L = 'Customer Code'.
APPEND GS_FIELDCAT TO GT_FIELDCAT.





CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT_LVC = GS_LAYOUT
IT_FIELDCAT_LVC = GT_FIELDCAT
TABLES
T_OUTTAB = GT_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.



IF 1 = 4.

ENDIF.



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


FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.

IF R_UCOMM = '&IC1'.
R_UCOMM = '&ETA'.
ENDIF.


ENDFORM.

here you have to use user_command Exit form.

0