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: 

ALV-selecting only one field to go to next list

Former Member
0 Kudos

Hi Friends,

The below code is related to ALV for interactive report.In the Basic list it supposed to go to next list if we double click on a single field..But ,even i click on any field on that row its going to the next secondary list.How to restrict it and how to code to restrict the user to click only on a specific field

REPORT ZSAG.

TYPE-POOLS : slis.

DATA: vt_fieldcat TYPE slis_t_fieldcat_alv.

DATA: vt_fieldcat1 TYPE slis_t_fieldcat_alv.

DATA : BEGIN OF itab OCCURS 0,

p1 TYPE i VALUE 2,

p3 TYPE i VALUE 3,

END OF itab.

APPEND itab.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_internal_tabname = 'ITAB'

i_client_never_display = 'X'

i_inclname = sy-repid

CHANGING

ct_fieldcat = vt_fieldcat.

.

IF sy-subrc <> 0.

ENDIF.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-repid

i_callback_user_command = 'DISP_DETAIL'

it_fieldcat = vt_fieldcat

TABLES

t_outtab = itab.

IF sy-subrc <> 0.

ENDIF.

&----


*& Form DISP_DETAIL

&----


  • text

----


  • -->UCOMM text

  • -->SELFIELD text

----


FORM disp_detail USING ucomm LIKE sy-ucomm

selfield TYPE slis_selfield.

IF ucomm = '&IC1'.

READ TABLE itab INDEX selfield-tabindex.

IF sy-subrc = 0.

DATA : itab1 LIKE TABLE OF itab WITH HEADER LINE.

LOOP AT itab .

MOVE 6 TO itab1-p1.

MOVE 6 TO itab-p3.

APPEND itab1.

ENDLOOP.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_internal_tabname = 'ITAB'

i_client_never_display = 'X'

i_inclname = sy-repid

CHANGING

ct_fieldcat = vt_fieldcat1.

.

IF sy-subrc <> 0.

ENDIF.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-repid

it_fieldcat = vt_fieldcat1

TABLES

t_outtab = itab1.

ENDIF.

ENDIF.

ENDFORM. "DISP_DETAIL

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Change your code as below:

FORM disp_detail USING ucomm LIKE sy-ucomm

selfield TYPE slis_selfield.

<b>IF selfield-fieldname = 'MATNR'. "Your field name</b>

IF ucomm = '&IC1'.

READ TABLE itab INDEX selfield-tabindex.

IF sy-subrc = 0.

DATA : itab1 LIKE TABLE OF itab WITH HEADER LINE.

LOOP AT itab .

MOVE 6 TO itab1-p1.

MOVE 6 TO itab-p3.

APPEND itab1.

ENDLOOP.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_internal_tabname = 'ITAB'

i_client_never_display = 'X'

i_inclname = sy-repid

CHANGING

ct_fieldcat = vt_fieldcat1.

.

IF sy-subrc <> 0.

ENDIF.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-repid

it_fieldcat = vt_fieldcat1

TABLES

t_outtab = itab1.

ENDIF.

ENDIF.

<b>ENDIF.</b>

ENDFORM. "DISP_DETAIL

1 REPLY 1

Former Member
0 Kudos

Change your code as below:

FORM disp_detail USING ucomm LIKE sy-ucomm

selfield TYPE slis_selfield.

<b>IF selfield-fieldname = 'MATNR'. "Your field name</b>

IF ucomm = '&IC1'.

READ TABLE itab INDEX selfield-tabindex.

IF sy-subrc = 0.

DATA : itab1 LIKE TABLE OF itab WITH HEADER LINE.

LOOP AT itab .

MOVE 6 TO itab1-p1.

MOVE 6 TO itab-p3.

APPEND itab1.

ENDLOOP.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_internal_tabname = 'ITAB'

i_client_never_display = 'X'

i_inclname = sy-repid

CHANGING

ct_fieldcat = vt_fieldcat1.

.

IF sy-subrc <> 0.

ENDIF.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-repid

it_fieldcat = vt_fieldcat1

TABLES

t_outtab = itab1.

ENDIF.

ENDIF.

<b>ENDIF.</b>

ENDFORM. "DISP_DETAIL