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: 

Change edit mode with clasic FM REUSE_ALV_GRID_DISPLAY

Former Member
0 Kudos
367

Hello,

I'm using the function "REUSE_ALV_GRID_DISPLAY", in the classic method. I want to switch from display to edit mode when the user press the edit mode button. But I don't get it to work.

So far as I know building up the ALV is correct so I don't put all the source code here.

What's wrong in my code?

FORM BUILD_ALV_REPORT.

perform build_field_cat.

----


  • After building the field catalog (e.g., from a DDIC structure), we can

  • modify these settings in the following subroutine.

----


PERFORM modify_fieldcatalog.

IF Not fieldcatalog is initial.

perform collect_data

TABLES it_collector

USING werks

lgort

s_jaar

s_mnd.

PERFORM t_sort_build USING gd_sort.

perform build_layout CHANGING gd_layout.

----


  • Table ta_comment is used to display header information in the

  • top-of-page of the ALV output.

----


PERFORM build_comment CHANGING ta_comment[].

----


  • Table gd_tab_group wordt gebruikt om een groepering op te bouwen.

----


PERFORM build_group CHANGING gd_tab_group[].

SET PF-STATUS 'STANDARD_FULLSCREEN'.

gx_variant-report = gd_repid.

CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'

EXPORTING

I_SAVE = 'A'

CHANGING

CS_VARIANT = gx_variant

EXCEPTIONS

WRONG_INPUT = 1

NOT_FOUND = 2

PROGRAM_ERROR = 3

OTHERS = 4.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = gd_repid

I_CALLBACK_PF_STATUS_SET = 'STANDARD_FULLSCREEN'

I_CALLBACK_USER_COMMAND = 'R1_PROCESS_USER_COMMAND'

I_CALLBACK_TOP_OF_PAGE = co_rout_top_of_page

I_BACKGROUND_ID = 'ALV_BACKGROUND'

I_GRID_TITLE = 'Lijst goedgekeurde ATBs'

  • I_GRID_SETTINGS =

IS_LAYOUT = gd_layout

IT_FIELDCAT = fieldcatalog

  • IT_EXCLUDING =

IT_SPECIAL_GROUPS = gd_tab_group[]

IT_SORT = gd_sort[]

I_SAVE = 'A'

IS_VARIANT = gx_variant

I_SCREEN_START_COLUMN = 0

TABLES

T_OUTTAB = it_collector

  • 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.

ENDIF.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

ENDFORM. " BUILD_ALV_REPORT

  • Setting the column to edit mode

ls_fieldcat-fieldname = '3_ATWRT'.

ls_fieldcat-seltext_m = 'WBS-NRG'.

ls_fieldcat-seltext_l = 'WBS-element NRG'.

ls_fieldcat-row_pos = 0.

ls_fieldcat-col_pos = 30.

  • ls_fieldcat-outputlen = 4.

  • ls_fieldcat-emphasize = 'X'.

  • ls_fieldcat-key = 'X'.

  • ls_fieldcat-do_sum = 'X'.

ls_fieldcat-edit = 'X'.

append ls_fieldcat to fieldcatalog.

clear ls_fieldcat.

ENDFORM. " modify_fieldcatalog

FORM r1_process_user_command "#EC CALLED

USING utp_ucomm TYPE syucomm

utp_selfield TYPE slis_selfield.

DATA: ltp_repid TYPE syrepid.

----


  • Handle the specific user-commands.

----


CASE utp_ucomm.

----


  • Handle double click or hotspot on a specific field. *

  • These are some examples *

----


WHEN co_double_click.

WHEN OTHERS.

ENDCASE.

WHEN 'SWITCH'.

IF V_EDIT = ' '.

V_EDIT = 'X'.

ELSE.

V_EDIT = ' '.

ENDIF.

PERFORM modify_edit_mode.

utp_selfield-refresh = 'X'.

WHEN OTHERS.

ENDCASE.

ENDFORM. "R1_PROCESS_USER_COMMAND

FORM modify_edit_mode .

DATA: ls_fieldcat TYPE slis_fieldcat_alv.

LOOP AT fieldcatalog into ls_fieldcat.

CASE ls_fieldcat-FIELDNAME.

WHEN '3_ATWRT'.

ls_fieldcat-edit = V_EDIT.

gd_layout-edit = V_EDIT.

gd_layout-edit_mode = V_EDIT.

ENDCASE.

modify fieldcatalog from ls_fieldcat.

clear ls_fieldcat.

ENDLOOP.

ENDFORM. " modify_edit_mode

3 REPLIES 3

Former Member
0 Kudos
114

Hello,

<b>

FIELDCAT-EDIT = 'X'.

</b>

Vasanth

Former Member
0 Kudos
114

Vasanth,

This is what I'm already doing in the program by setting the edit mode for the column '3_ATWRT'. But I want to switch from edit to display mode and back again. This is not working. Only when I buildup the fieldcatalog this is working?

Kind regards,

Richard Meijn

Former Member
0 Kudos
114

chk my blog

/people/community.user/blog/2007/01/10/displaychange-mode-of-editable-fields-in-alv-using-function-modules-but-not-custom-containers