cancel
Showing results for 
Search instead for 
Did you mean: 

Zfield/Custom field text issue

varun_jain3
Active Participant
0 Kudos

Dear Experts,

facing issue with custom field description. We have created couple of custom field and showing key and key-description next to that .

Issue is when I press F4, key description is not automatically copied to key-description field, I need to press enter or perform some action .

Same is working at Standard field, when I select any field from F4 key and description automatic copied .

Any catch why this is happening ?

Regards,

Varun

Accepted Solutions (0)

Answers (3)

Answers (3)

benjamin_allsopp
Active Participant
0 Kudos

I have had this issue.

I got around it by creating an exit on the search help and populating the description in the results table of the search help before it's passed back to the screen. Worked perfectly.

You could try this.

varun_jain3
Active Participant
0 Kudos

Hi Benjamin,

How you mapped search help result ( description field ) to UI field ?

Varun

benjamin_allsopp
Active Participant
0 Kudos

As long as you know what search help is being used:

  • Go to your search help in SE11
  • Create a Search help exit
  • In that exit you'll want to  execute some code when callcontrol-step = 'DISP' (which is when the data is being passed back to the screen)
  • The data being passed back to the screen is found in the table  record_tab which you can manipulate to pull in your description
former_member209780
Active Participant
0 Kudos

Hi Varun,

Check if the F4 event is switched off in the general setting of your UIBB.

Regards
Goutham

varun_jain3
Active Participant
0 Kudos

HI Goutham,

Yes this is switched off but I have custom field at Material - Basic data and same UIBB standard fields working , issue is with only custom fields.

Varun

Former Member
0 Kudos

Hi Varun,

I hope you might be using a custom feeder class inheriting from super standard class CL_MDG_BS_MAT_FEEDER_FORM_MAT.

Please try redefining methods CHANGE_FIELD_DEFINITION and AFTER_GET_DATA as mentioned in my previous reply and check once

benjamin_allsopp
Active Participant
0 Kudos

It might be worth checking up how your text field is set up.

I had to set up my text tables very carefully to get everything to work properly.

1. Check table for actual field set up.

2. Text table containing only key fields from check table,  language ,and description

3. Foreign key on text table fields to link to check table and to define text table as a text table you your check table

4. Domain of actual field needs your check table in the 'value range' field

This way you do not have to add your description field to the data model or any feeder classes. It will pull through as available in the uibb automatically and pull in the description automatically in the process as with standard fields. You may have to regenerate data structures before going to ui configuration.

I wrote some documentation with screenshots on this once. Let me know if you would like me to find it and send it to you.

varun_jain3
Active Participant
0 Kudos

this is for material data model

Former Member
0 Kudos

Hi Varun,

Please check below steps:

  • As you told continue with ROUNDTRIP (Roundtrip) event for the Custom 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 Description field

DATA: lt_components TYPE cl_abap_structdescr=>component_table.

"Get data type of custom field for 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,   "Custom field Key

      lv_key_txt TYPE YKEY_TXT.  "Custom field 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' " Custom 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'  "Custom field description

          iv_value = lv_key_txt

      ).

ENDMETHOD.

Hope this works!

Former Member
0 Kudos

Hi Varun,

Try assign FPM_REFRESH event for your custom field at UI config level.

varun_jain3
Active Participant
0 Kudos

Hello

No FPM_REFRESH  event is available and  I have assigned roundtrip event same as standard field but it would take place unless and until I press Enter or F4 on standard fld.

any solution for this ?

Regards,

varun

Former Member
0 Kudos

Hi Varun,

What Entity Type you are working upon ? Is it a custom Data Model ?