Skip to Content

Automatic fill of Inputfield2 when Inputfield1 is filled manually

Hi all gurus,

I need your help for an issue I'm not able to manage.

This is the scenario: in srm7, an header custom table is used in web dynpro /SAPSRM/WDC_DODC_CT (view V_DODC_CT) and the user can fill 5 values in it.

In particular, some fields depend on the value filled in another field: consider, for example, the couple:

ZVENDOR and ZVENDOR_DESCRIPTION (names say it all).

Actually I associated an OVS search help to ZVENDOR, so that when the user select a Vendor code from the OVS list, then:

ZVENDOR is filled with that code and

ZVENDOR_DESCRIPTION is filled too, on the basis of the selection table entry which has been chosen.

That's the stuff that works... Now, the trouble: the user could also introduce a value for ZVENDOR manually and press ENTER. This doens't trigger obviously the OVS search help for the field; as a consequence ZVENDOR_DESCRIPTION is not populated.

I'm looking then for a way to replicate the OVS behaviour also for manual insertion, but...

- the logic on which the selection list in OVS is build is quite complex... is it possible to reuse the OVS behaviour or should I replicate the logic in a separate method?

- I was thinking to introduce a sketch of code like the following in WDDOMODIFYVIEW (note that the table is binded dinamically):

DATA: vendor_desc_value TYPE ZR7_PROLE_DESC.

CALL METHOD lo_tabnode->get_attribute
*    index  = USE_LEAD_SELECTION
    name   = 'ZVENDOR'
    value  = vendor_value.

CALL METHOD lo_tabnode->get_attribute
*    index  = USE_LEAD_SELECTION
    value  = vendor_desc_value.

*if vendor_value is filled and vendor_desc_value not, then:
* 1) calculate the corresponding description (is it possible to use OVS?)
* 2) lo_tabnode->set_attribute for ZVENDOR_DESCRIPTION with the retrieved value.

Don't know if there's a better way to do that; if this could be a fine solution, could you please help me defining point 1) ?

Thanks again.


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Dec 22, 2010 at 01:08 AM


    As per my suggestion you need to replicate the logic in a separate method.

    The best place will be the 'ON_ENTER' method for field 'ZVENDOR'.

    I hope it helps.


    Sumit Oberoi

    Add comment
    10|10000 characters needed characters exceeded

    • Thanks Sumit, issue resolved with your help. 😊

      Just for completeness, since sintax is a bit different from what you posted, I did as follows in the post-exit for WDDOMODIFYVIEW:

      DATA : lr_table type ref to cl_wd_table,
             lr_column type ref to cl_wd_table_column,
             lr_input_field type ref to cl_wd_input_field,
             lr_editor type ref to cl_wd_uielement,
             lr_cell_editor TYPE ref to IF_WD_TABLE_CELL_EDITOR.
      lr_table ?= view->get_element( 'THCUS' ).
      lr_table->get_column( EXPORTING ID = 'THCUS_CZVENDOR' RECEIVING the_column = lr_column ).
      call method lr_column->get_table_cell_editor RECEIVING the_table_cell_editor = lr_cell_editor.
      lr_input_field ?= lr_cell_editor.

      There are just two differences:

      - dynamic cast for lr_input_field, required to use the set_on_enter method;;

      - the correct column ID I got in debug mode, which seems to be a concatenation of table ID and field name.

      Again, thank you very much for your support and patience.

      Best regards,