Code: Alles auswählen.
METHOD register_f4_fields.
DATA: lt_f4 TYPE lvc_t_f4,
ls_f4 TYPE lvc_s_f4.
FIELD-SYMBOLS: <fcat> TYPE lvc_s_fcat.
LOOP AT it_fcat ASSIGNING <fcat>
WHERE f4availabl = 'X'.
ls_f4-fieldname = <fcat>-fieldname.
ls_f4-register = 'X'.
* ls_f4-getbefore = 'X'.
ls_f4-chngeafter = 'X'.
ls_f4-internal = 'X'.
INSERT ls_f4 INTO TABLE lt_f4.
ENDLOOP.
CALL METHOD ir_alv->register_f4_for_fields( lt_f4 ).
ENDMETHOD.
Code: Alles auswählen.
DATA ls_shlp TYPE shlp_descr.
DATA ld_rc TYPE sy-subrc.
DATA lt_value TYPE TABLE OF ddshretval.
DATA ls_value TYPE ddshretval.
* DATA ls_pnodid TYPE pnodid.
* DATA lr_pn TYPE REF TO /bdfplm/if_dcc_pn.
FIELD-SYMBOLS <fs_alv> TYPE zmcc_pn_rel_alv.
FIELD-SYMBOLS <fs_interface> TYPE ddshiface.
CHECK e_fieldname = 'PNAME'.
er_event_data->m_event_handled = 'X'.
CASE sender.
WHEN gr_relv_alv.
READ TABLE gi_relv_alv INDEX es_row_no-row_id ASSIGNING <fs_alv>.
WHEN gr_reln_alv.
READ TABLE gi_reln_alv INDEX es_row_no-row_id ASSIGNING <fs_alv>.
ENDCASE.
CALL FUNCTION 'F4IF_GET_SHLP_DESCR'
EXPORTING
shlpname = 'PVS_PNODE00'
shlptype = 'SH'
IMPORTING
shlp = ls_shlp.
READ TABLE ls_shlp-interface ASSIGNING <fs_interface>
WITH KEY shlpfield = 'PNAME'.
<fs_interface>-valfield = 'X'.
CALL FUNCTION 'F4IF_START_VALUE_REQUEST'
EXPORTING
shlp = ls_shlp
IMPORTING
rc = ld_rc
TABLES
return_values = lt_value.
CHECK ld_rc = 0.
IF lt_value IS INITIAL.
* Daten sind nicht geändert. Einfach raus.
EXIT.
ENDIF.
READ TABLE lt_value INTO ls_value WITH KEY fieldname = 'PNAME'.
<fs_alv>-pname = ls_value-fieldval.
* ls_pnodid-pname = <fs_alv>-pname.
* lr_pn = gr_pn_cntl->get_obj_pn( ls_pnodid ).
* IF o_appl_message->check_error( ) IS INITIAL
* ENDIF.
CALL METHOD refresh_display
EXPORTING
ir_alv = sender.
ENDMETHOD.
Code: Alles auswählen.
METHOD on_data_changed.
DATA ls_good TYPE lvc_s_modi.
DATA ld_retco TYPE sy-subrc.
CASE sender.
WHEN gr_relv_alv.
LOOP AT er_data_changed->mt_good_cells INTO ls_good.
CASE ls_good-fieldname.
WHEN 'PNAME'.
CALL METHOD check_if_pnode_exists
EXPORTING
ir_data_changed = er_data_changed
is_good = ls_good
IMPORTING
ed_retco = ld_retco.
IF ld_retco NE 0.
EXIT.
ENDIF.
CALL METHOD check_if_otype_is_n
EXPORTING
ir_data_changed = er_data_changed
is_good = ls_good
IMPORTING
ed_retco = ld_retco.
IF ld_retco NE 0.
EXIT.
ENDIF.
CALL METHOD check_if_pnode_is_in_list
EXPORTING
ir_data_changed = er_data_changed
is_good = ls_good
it_alv = gi_relv_alv
IMPORTING
ed_retco = ld_retco.
IF ld_retco NE 0.
EXIT.
ENDIF.
CALL METHOD check_circle
EXPORTING
ir_data_changed = er_data_changed
is_good = ls_good
id_type = 'RELV'
IMPORTING
ed_retco = ld_retco.
IF ld_retco NE 0.
EXIT.
ENDIF.
CALL METHOD lock_pnode
EXPORTING
ir_data_changed = er_data_changed
is_good = ls_good
IMPORTING
ed_retco = ld_retco.
IF ld_retco NE 0.
EXIT.
ENDIF.
CALL METHOD modify_cells
EXPORTING
ir_data_changed = er_data_changed
is_good = ls_good
id_type = 'RELV'.
ENDCASE.
ENDLOOP.
IF ld_retco NE 0.
RETURN.
ENDIF.
WHEN gr_reln_alv.
LOOP AT er_data_changed->mt_good_cells INTO ls_good.
CASE ls_good-fieldname.
WHEN 'PNAME'.
CALL METHOD check_if_pnode_exists
EXPORTING
ir_data_changed = er_data_changed
is_good = ls_good
IMPORTING
ed_retco = ld_retco.
IF ld_retco NE 0.
EXIT.
ENDIF.
CALL METHOD check_if_otype_is_n
EXPORTING
ir_data_changed = er_data_changed
is_good = ls_good
IMPORTING
ed_retco = ld_retco.
IF ld_retco NE 0.
EXIT.
ENDIF.
CALL METHOD check_if_pnode_is_in_list
EXPORTING
ir_data_changed = er_data_changed
is_good = ls_good
it_alv = gi_reln_alv
IMPORTING
ed_retco = ld_retco.
IF ld_retco NE 0.
EXIT.
ENDIF.
CALL METHOD check_circle
EXPORTING
ir_data_changed = er_data_changed
is_good = ls_good
id_type = 'RELN'
IMPORTING
ed_retco = ld_retco.
IF ld_retco NE 0.
EXIT.
ENDIF.
CALL METHOD lock_pnode
EXPORTING
ir_data_changed = er_data_changed
is_good = ls_good
IMPORTING
ed_retco = ld_retco.
IF ld_retco NE 0.
EXIT.
ENDIF.
CALL METHOD modify_cells
EXPORTING
ir_data_changed = er_data_changed
is_good = ls_good
id_type = 'RELN'.
ENDCASE.
ENDLOOP.
IF ld_retco NE 0.
RETURN.
ENDIF.
ENDCASE.
CALL METHOD cl_ppeuieng_cntl=>set_update_flag.
ENDMETHOD.
Folgende Benutzer bedankten sich beim Autor a-dead-trousers für den Beitrag:
PeterPaletti
Code: Alles auswählen.
DATA: ls_f4 TYPE lvc_s_modi.
FIELD-SYMBOLS: <lt_f4> TYPE lvc_t_modi.
Code: Alles auswählen.
ASSIGN er_event_data->m_data->* TO <lt_f4>.
ls_f4-fieldname = e_fieldname.
ls_f4-row_id = es_row_no-row_id.
ls_f4-value = <fs_alv>-pname .
APPEND ls_f4 TO <lt_f4>.
Code: Alles auswählen.
METHOD on_onf4.
DATA ls_shlp TYPE shlp_descr.
DATA ld_rc TYPE sy-subrc.
DATA lt_value TYPE TABLE OF ddshretval.
DATA ls_value TYPE ddshretval.
DATA lr_alv TYPE REF TO cl_gui_alv_grid.
DATA: ls_f4 TYPE lvc_s_modi.
FIELD-SYMBOLS: <lt_f4> TYPE lvc_t_modi.
FIELD-SYMBOLS <fs_alv> TYPE zmcc_pn_rel_alv.
FIELD-SYMBOLS <fs_interface> TYPE ddshiface.
CHECK e_fieldname = 'PNAME'.
er_event_data->m_event_handled = 'X'.
lr_alv ?= sender.
CASE sender.
WHEN gr_relv_alv.
READ TABLE gi_relv_alv INDEX es_row_no-row_id ASSIGNING <fs_alv>.
WHEN gr_reln_alv.
READ TABLE gi_reln_alv INDEX es_row_no-row_id ASSIGNING <fs_alv>.
ENDCASE.
CALL FUNCTION 'F4IF_GET_SHLP_DESCR'
EXPORTING
shlpname = 'PVS_PNODE00'
shlptype = 'SH'
IMPORTING
shlp = ls_shlp.
READ TABLE ls_shlp-interface ASSIGNING <fs_interface>
WITH KEY shlpfield = 'PNAME'.
<fs_interface>-valfield = 'X'.
CALL FUNCTION 'F4IF_START_VALUE_REQUEST'
EXPORTING
shlp = ls_shlp
IMPORTING
rc = ld_rc
TABLES
return_values = lt_value.
CHECK ld_rc = 0.
IF lt_value IS INITIAL.
* Daten sind nicht geändert. Einfach raus.
EXIT.
ENDIF.
READ TABLE lt_value INTO ls_value WITH KEY fieldname = 'PNAME'.
<fs_alv>-pname = ls_value-fieldval.
ASSIGN er_event_data->m_data->* TO <lt_f4>.
ls_f4-fieldname = e_fieldname.
ls_f4-row_id = es_row_no-row_id.
ls_f4-value = <fs_alv>-pname .
APPEND ls_f4 TO <lt_f4>.
CALL METHOD refresh_display
EXPORTING
ir_alv = sender.
ENDMETHOD.
Code: Alles auswählen.
METHOD on_onf4.
DATA ls_shlp TYPE shlp_descr.
DATA ld_rc TYPE sy-subrc.
DATA lt_value TYPE TABLE OF ddshretval.
DATA ls_value TYPE ddshretval.
DATA: ls_f4 TYPE lvc_s_modi.
FIELD-SYMBOLS: <lt_f4> TYPE lvc_t_modi.
FIELD-SYMBOLS <fs_interface> TYPE ddshiface.
CHECK e_fieldname = 'PNAME'.
er_event_data->m_event_handled = 'X'.
CALL FUNCTION 'F4IF_GET_SHLP_DESCR'
EXPORTING
shlpname = 'PVS_PNODE00'
shlptype = 'SH'
IMPORTING
shlp = ls_shlp.
READ TABLE ls_shlp-interface ASSIGNING <fs_interface>
WITH KEY shlpfield = 'PNAME'.
<fs_interface>-valfield = 'X'.
CALL FUNCTION 'F4IF_START_VALUE_REQUEST'
EXPORTING
shlp = ls_shlp
IMPORTING
rc = ld_rc
TABLES
return_values = lt_value.
CHECK ld_rc = 0.
IF lt_value IS INITIAL.
* Daten sind nicht geändert. Einfach raus.
EXIT.
ENDIF.
READ TABLE lt_value INTO ls_value WITH KEY fieldname = 'PNAME'.
ASSIGN er_event_data->m_data->* TO <lt_f4>.
ls_f4-fieldname = e_fieldname.
ls_f4-row_id = es_row_no-row_id.
ls_f4-value = ls_value-fieldval.
APPEND ls_f4 TO <lt_f4>.
ENDMETHOD.