Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2756

Re: Zfield/Custom field text issue

$
0
0

Hi Varun,

 

Please check below steps:

  • As you told continue with ROUNDTRIP (Roundtrip) event for the Key field.
  • In your feeder class, redefine method CHANGE_FIELD_DEFINITION and use below code:

 

METHOD /plmu/if_frw_g_field_def~change_field_definition.

 

"Get the current UI structure's field list

DATA(lt_fields) = co_catalogue->get_included_view( ).

 

DATA: lo_field_description TYPE REF TO cl_abap_datadescr,

          lv_type TYPE YKEY_TXT. "Data Element for Key description

DATA: lt_components TYPE cl_abap_structdescr=>component_table.

 

"Get data type of new field Key description

    lo_field_description ?= cl_abap_datadescr=>describe_by_data(

      p_data = lv_type

    ).

 

"Add field to UI data structure

    INSERT

      VALUE #(

        name = 'Y_KEY__TXT'

        type = lo_field_description

        )

      INTO TABLE lt_fields.

 

"Add UI field to description structure

    INSERT

      VALUE /plmu/s_frw_g_field_descr_appl(

        name = 'Y_KEY__TXT'

      )

      INTO TABLE CT_DEFINITION.

 

    MOVE-CORRESPONDING lt_fields TO lt_components.

 

    co_catalogue = cl_abap_structdescr=>create(

      p_components = lt_components

    ).

 

"Call super class method

    CALL METHOD super->/plmu/if_frw_g_field_def~change_field_definition

      IMPORTING

        et_special_groups = et_special_groups

      CHANGING

        co_catalogue      = co_catalogue

        ct_definition     = ct_definition.

 

ENDMETHOD.

 

  • Also redefine method AFTER_GET_DATA and use below code:

METHOD /plmu/if_frw_g_after_get_data~after_get_data.

    ASSERT it_selected_fields IS SUPPLIED.    "Should always be passed in as of 7.31+

 

DATA: lv_key TYPE YKEY,   "Key

      lv_key_txt TYPE YKEY_TXT.  "Key description

 

    CALL METHOD super->/plmu/if_frw_g_after_get_data~after_get_data

      EXPORTING

        iv_first_time           = iv_first_time

        io_event                = io_event

        it_selected_fields      = it_selected_fields

      IMPORTING

        et_message              = et_message

        ev_field_usage_changed  = ev_field_usage_changed

        ev_action_usage_changed = ev_action_usage_changed

      CHANGING

        ct_field_usage          = ct_field_usage

        ct_action_usage         = ct_action_usage.

 

      mo_context->get_attribute(

        EXPORTING

          iv_name  = 'Y_KEY' " Key field

        IMPORTING

          ev_value = lv_key

      ).

 

"Based on lv_key fetch the lv_key_txt value and set the value on UI

*lv_key_txt = 'TEST'.

 

      mo_context->set_attribute(

        EXPORTING

          iv_name  = 'Y_KEY__TXT'  "Key description

          iv_value = lv_key_txt

      ).

ENDMETHOD.

 

Hope this works!


Viewing all articles
Browse latest Browse all 2756

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>