cancel
Showing results for 
Search instead for 
Did you mean: 

Change search help for each line of a web dynpro table

Former Member
0 Kudos

Hi all i have got the following code to dynamically change the search help of a single field on a web dynpro app and was just wondering if anyone could show me the code for implementing it onto a table so that the same field on each row has a different search help assigned to it!

CALL METHOD node_info->set_attribute_value_help

EXPORTING

name = 'DEPT'

value_help_mode = '121'

value_help = 'PREMN'.

Regards

Mart

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

it is possible to have different search help for same table column for different context elements i.e. table lines. the way to acheive this is by using cell variants in table column.

Steps to follow:

1. In your table column insert cell variant. Depending upon number of variations for search help, insert that number of cell variants in table column

2. Enter the value of variant key property of each cell variant for ex. 01 for first cell variant and 02 for second cell variant

3. Insert cell editor for each of cell variant. for ex. if you have 2 different search helps for single column then insert two cell variant in table column and for each cell variant insert cell editor, let say input field in this case

4. Bind the value property of each input field to different context attribute of the node. for ex: you have table with two columns i.e. Dynamic and fldate

. First column is Dynamic. It will have two cell variants and each cell variant have cell editor of type input field i.e. depending upon the value of second column i.e. fldate, the search help of first column will be decided.

5. Create context node from structure "SFLIGHT" and select 3 components from structure i.e. Carrid, connid, fldate. Add another context attribute to same context node i.e. selected_cell_variant of type string

6. Bind each of context attribute carrid and coonid to value property of cell editor i.e. input field of cell vairaints from column Dynamic

7. Bind value property of cell editor i.e. input field of fldate column to context attribute fldate

8.. Bind selectedCellVariant property of table column Dynamic to context attribute selected_cell_variant

9. Now, Write method at the wddoinit of view to fill up the context node from table sflight table

10. Write event handler for event OnEnter of cell editor from table column FLDATE. in this event handler depnding upon the date set the value of context attribute "selected_cell_variant" to 01 or 02

DATA lv_date TYPE S_DATE.

  ASSERT CONDITION context_element IS NOT INITIAL. " context_element is default paramter for event handler

  context_element->get_attribute(
    EXPORTING
      name  = 'FLDATE'    " NAME
    IMPORTING
      value = lv_date    " DATA
  ).

  IF lv_date > '20101016'.

    context_element->set_attribute(
      EXPORTING
        value =  '01'   " Attribute Value
        name  = 'SELECTED_CELL_VARIANT'     " Web Dynpro: Name of Context Element
    ).

  ELSE.

    context_element->set_attribute(
      EXPORTING
        value =  '02'   " Attribute Value
        name  = 'SELECTED_CELL_VARIANT'     " Web Dynpro: Name of Context Element
    ).

ENDIF.

11. Depending upon the value of selectedCellVariant the corresponding search help will show up in table column. So change the value of column fldate for each table row and see how search help gets changed.

Thanks,

Rahul

Edited by: Rahul Yadav on Oct 17, 2010 12:09 AM

Former Member
0 Kudos

Excellent thanks Rahul that works a treat!

Regards

Mart

Former Member
0 Kudos

Yes..

The method what Rahul said can help you.

In fact, the method still makes use of the statically declared Attribute with different DDIC search help.Just make use of the Cell Variant of table...

I still think:

We cann't change the search help to different rows of the same Context Attribute..

Anyway, the method what Rahul said is a very flexible solution..Thanks very much...

Best wishes.

Answers (3)

Answers (3)

Former Member
0 Kudos

hi,

Sorry, as far as i know, we cannot : assign different DDIC search help to the same attribute of context node.

You know, also you can check, only the object "if_wd_context_node_info" has the method to set the value help for his attribute..IF_wd_context_element, wdr_context_element, cl_wd_table,all have no such method or interface...

The reason is that system will treat one attribute with one unique way...

So, if you want to use different search help, you should look for another way..Such as Selection-option(using Value-set attribute), Dropdown list in ALV(using column-setting, and dropdown list's SET_VALUESET_FIELDNAME method)...

However these are all not DDIC search help...

If anyone have the solution to this matter, thanks very much..

Best wishes.

Former Member
0 Kudos

Thanks very much for the responces, it does seem that you can only assign search helps to the context (i.e. via the context_info) and not the context element list. I will just keep this question open for a little bit longer just incase someone has a cunning way of doing this or can show me the ABAP code that does it via the element list.

Thanks again

Regards

Mart

Former Member
0 Kudos

Hello Mart,

you could use get_elements method of if_wd_context_node interface and you would get

WDR_CONTEXT_ELEMENT_SET.

Regards

Anurag Chopra

Former Member
0 Kudos

Hello Mart,

You must be using a context node of cardinality of 0..n or 1..n for your table.

Once you get the reference of that node, you need to get its "collection".

Then you need to loop at those n instances and then you could assign the valur help using set_attribute_value_help method.

Regards

Anurag Chopra