Code: Alles auswählen.
METHOD alv_refresh.
DATA lv_stable TYPE lvc_s_stbl.
lv_stable-row = abap_true.
lv_stable-col = abap_true.
w_variant-report = sy-repid.
w_variant-variant = '/DEFAULT'.
me->alv_hide_cols( ).
me->r_alv->set_frontend_fieldcatalog( EXPORTING it_fieldcatalog = t_fcat ).
me->r_alv->set_frontend_layout( EXPORTING is_layout = w_layout ).
me->r_alv->refresh_table_display( is_stable = lv_stable ).
* i_soft_refresh = abap_false ).
ENDMETHOD.
METHOD build_display_options.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = '/KBC/FI_ADJUSTMENT_ALV_EDIT_S'
i_bypassing_buffer = abap_true
CHANGING
ct_fieldcat = t_fcat.
alv_rename_cols( ).
alv_hide_cols( ).
* w_layout-cwidth_opt = abap_true.
w_layout-stylefname = 'T_STYLE'.
w_layout-ctab_fname = 'T_COLOR'.
w_variant-report = sy-repid.
w_variant-variant = '/DEFAULT'.
APPEND cl_gui_alv_grid=>mc_fg_edit TO t_excl.
ENDMETHOD.
r_alv->set_ready_for_input( 1 ).
CALL METHOD r_alv->set_table_for_first_display
EXPORTING
i_bypassing_buffer = abap_true
is_variant = w_variant
i_save = 'A'
i_default = 'X'
it_toolbar_excluding = t_excl
is_layout = w_layout
CHANGING
it_outtab = r_iat->t_balance_alv
it_fieldcatalog = t_fcat.
Folgende Benutzer bedankten sich beim Autor a-dead-trousers für den Beitrag:
Romaniac
Die originale Spaltenreihenfolge wie im Dictionary definiert, wurde bei meinen Tests mit der MethodeWie ich die original Spaltenreihenfolge wieder herbekomme weis keiner?
Code: Alles auswählen.
me->r_alv->set_frontend_fieldcatalog( EXPORTING it_fieldcatalog = t_fcat ).
Code: Alles auswählen.
METHOD alv_hide_cols.
t_cols_text = VALUE #(
( fieldname = 'KEY_BUKRS' )
( fieldname = 'KEY_BCS_ITEM' )
( fieldname = 'KEY_BCS_ITEM_ID' ) " for test do not hide
( fieldname = 'KEY_BCS_BEWAR' )
( fieldname = 'KEY_BCS_GSBER' )
( fieldname = 'KEY_BCS_VBUND' )
( fieldname = 'SORT_KEY' ) " for test do not hide
( fieldname = 'LINE_TYPE' )
( fieldname = 'KSL_RTCUR' )
( fieldname = 'KSL_TARGET_VALUE' )
( fieldname = 'KSL_CALC_VALUE' )
( fieldname = 'CREDIT_DEBIT_SHIFT' )
( fieldname = 'HEADER' ) ).
LOOP AT t_cols_text ASSIGNING FIELD-SYMBOL(<lw_cols_text>).
READ TABLE t_fcat ASSIGNING FIELD-SYMBOL(<lw_fcat>)
WITH KEY fieldname = <lw_cols_text>-fieldname.
IF sy-subrc = 0.
<lw_fcat>-tech = abap_true.
ENDIF.
ENDLOOP.
* open/close business area
LOOP AT t_fcat ASSIGNING <lw_fcat>
WHERE fieldname = 'ERP_GSBER'
OR fieldname = 'BCS_GSBER'
OR fieldname = 'TARGET_GSBER'.
CASE r_iat->b_use_gsber.
WHEN abap_false.
<lw_fcat>-tech = abap_true.
WHEN abap_true.
<lw_fcat>-tech = abap_false.
ENDCASE.
ENDLOOP.
ENDMETHOD.