cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic value help for a table field to fill two fields, how to?

matteo_montalto
Contributor
0 Kudos

Hi all gurus,

In SRM 7 I defined a dynamic value help for a single field (ZZ_PROLE_R3) of my header custom table.

That's the code from WDDOMODIFYVIEW in the webdynpro /SAPSRM/WDC_DODC_CT, view V_DODC_CT:

DATA: lo_tabnode        TYPE REF TO IF_WD_CONTEXT_NODE.
      DATA: lo_tabnode_info   TYPE REF TO IF_WD_CONTEXT_NODE_INFO.
      DATA: tab_value         TYPE WDR_CONTEXT_ATTR_VALUE_LIST,
            wa_value          TYPE WDR_CONTEXT_ATTR_VALUE.

      lo_tabnode = wd_context->GET_CHILD_NODE( name = 'THCUS' ). "the custom table node
      lo_tabnode_info = lo_tabnode->get_node_info( ).
      wd_this->GET_VALHELP_ZZ_PROLE_R3( EXPORTING iv_guid = lv_guid
                                        IMPORTING ZZ_PROLE_R3_VALHELP = tab_value ). "this method returns the dyn value table 

      lo_tabnode_info->set_attribute_value_set( name = 'ZZ_PROLE_R3'
                                                 value_set = tab_value ).

The method GET_VALHELP_ZZ_PROLE_R3 dynamically builds the value help table tab_value; such table is made up by two fields:

value : contains the value of the field

text : contains a description of the value

The above solution works; now I'd like to enhance it. The custom table THCUS contains also a field called ZZ_PROLE_R3_DESC, which represents the description of ZZ_PROLE_R3. It is, exactly, the TEXT field in tab_value.

So I'd like to do as follows:

- the user clicks on the search help for ZZ_PROLE_R3 field of the table;

- the above described value help appears;

- after the selection, both ZZ_PROLE_R3 and ZZ_PROLE_R3_DESC are filled with the selected couple value - text chosen from the value help.

Could anyone help me achieving such a behaviour?

Again, a little request... when I open the above value help dialog box, the window itself has a label "Floorplan Manager application for OIF.." that obviously I'd like to redefine (e.g. "Role selection value help"). Is there any way to do that?

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

I think you are using drop down by key and populating it at run time. you should use OVS for help creation, you will be able to set the text also with record selection.

thanks

Vishal

Answers (2)

Answers (2)

matteo_montalto
Contributor
0 Kudos

Solved, I found out how to use the same Controller Usage to manage multiple OVS help.

ChrisPaine
Active Contributor
0 Kudos

Hi Matteo,

multiple things here!

It seems to me - given that your code is in wddomodifyview that you are trying to have different dropdowns per row

- I'm not sure where you are populating lv_guid - but I'd guess it is an attribute of the row selected? If it isn't then I can't see any reason that you would do this code in wddomodifyview and not wddoinit.

if you are attempting to have different dropdowns per row - a more usual method would be to have the dropdown by list bound to a non-singleton subnode of you main table node - and populate this node when you populate the main context.

However - by your comment on the "value help dialog box" I am guessing you are using an input field? If this is the case then I would strongly suggest that you change/enhance the structure of the context node THCUS (btw, better coding practise to refer to it as wd_this->wdctx_thcus when using the get child node construct) so that you refer to an actual SAP ddic search help, if you then associate in the structure the value and text fields then populating the text field should happen automatically. Also you'd have the nice side effect that your value help dialog would be named after the associated ddic search help.

Finally - I'd like to advise against using the OVS - it doesn't provide nearly as much functionality as coding your own ddic search help - if you need more control than a standard ddic search help can provide, I'd build my own custom value help (a component that implements IWD_VALUE_HELP)(and in that you'd have full control over populating whatever attributes of the custom table that you wanted.)

I realise that this is rather a lot - so if you have any specific question please do respond - hopefully I or someone else will be able to clarify.

Cheers,

Chris

matteo_montalto
Contributor
0 Kudos

It seems to me - given that your code is in wddomodifyview that you are trying to have different dropdowns per row

- I'm not sure where you are populating lv_guid - but I'd guess it is an attribute of the row selected? If it isn't then I can't see any reason that you would do this code in wddomodifyview and not wddoinit.

Hi Chris and thanks for your help,

lv_guid is the GUID of the document's header; I need to pass it to the method that populates my value help table because the values in it are derived from some fields on the document. (the situation actually is more complex; there's an RFC call on the backend for which the document is intended for to retrieve the data that populate the value help...).

I'm quite unexperienced on webdynpro and terminology; if dropdown menus are fixed selection option that appears on a field, I guess this is not my case. I did a pair of screenshot to provide an idea of what the solution by now is, and what "I would like to have":

[Pre-selection (F4 icon on the field in table)|http://imagebin.ca/view/npIsaqF.html]

[Value Help popup for the field ZZ_PROLE_R3|http://imagebin.ca/view/8fZUh3T.html]

[Result by now |http://imagebin.ca/view/3PaqdvE.html]

[Result I'd like to have.|http://imagebin.ca/view/dExR0J.html]

However - by your comment on the "value help dialog box" I am guessing you are using an input field? If this is the case then I would strongly suggest that you change/enhance the structure of the context node THCUS (btw, better coding practise to refer to it as wd_this->wdctx_thcus when using the get child node construct) so that you refer to an actual SAP ddic search help, if you then associate in the structure the value and text fields then populating the text field should happen automatically. Also you'd have the nice side effect that your value help dialog would be named after the associated ddic search help.

Thanks for the code suggestion, I'll apply that. For what concerns the context node THCUS... It is, by standard, a node which I can't explictly find in the context for the view V_DODC_CT. The problem is that ZZ_PROLE_R3 and the corresponding description field ZZ_PROLE_R3_DESC of the table must be filled with data retrieved dynamically @ runtime from the backend. So I guess I can't populate a val help referring to a dictionary table/field; I'd rather do as follows:

- retrieve what's the target backend for the document (to do so, I have to process the document .. that's why the header guid passed to my method);

- RFC call to a custom method that extracts possible values for the specific backend;

- bind the ammissible values to the value help.

I realise that this is rather a lot - so if you have any specific question please do respond - hopefully I or someone else will be able to clarify.

Thanks again for your help; additional info as well as code examples would be highly appreciated

matteo_montalto
Contributor
0 Kudos

Hello,

I'm trying the OVS way, but there's a little step missing...

I defined the OVS help as defined in a page on <Removed By Moderator>

Now, I have to bind my custom tables attributes (ZZ_PROLE_R3 and ZZ_PROLE_R3_DESC) to the OVS.

Here's the prob.

In that link, attributes are defined explicitly in the Context; my case is a bit different since these attributes are dinamically retrieved since they're field of the THCUS table.

I can retrieve the reference to the table:

DATA: lo_tabnode        TYPE REF TO IF_WD_CONTEXT_NODE.
      DATA: lo_tabnode_info   TYPE REF TO IF_WD_CONTEXT_NODE_INFO.

      lo_tabnode = wd_context->GET_CHILD_NODE( name = 'THCUS' ).
      lo_tabnode_info = lo_tabnode->get_node_info( ).

Now, lo_tabnode_info represents my custom table and the fields I'd like to associate to the OVS search help are two attributes of lo_tabnode_info. How can I dinamically bind these two fields to the OVS?

Thanks in advance.

Edited by: Matteo Montalto on Nov 2, 2010 2:58 PM

Edited by: Thomas Jung on Nov 8, 2010 8:29 AM to remove blacklist external links

matteo_montalto
Contributor
0 Kudos

Solved!

lo_tabnode = wd_context->GET_CHILD_NODE( name = 'THCUS' ). "the custom table node
      lo_tabnode_info = lo_tabnode->get_node_info( ).
      CALL METHOD lo_tabnode_info->set_attribute_value_help
        EXPORTING
          name = 'ZZ_PROLE_R3'
          value_help_mode = 131 "ovs mode
          value_help = 'OVS'.

That sketch of code did the trick.

An additional request: what if I have to realize more that 1 OVS per view?

Actually, I had to declare the WDR_OVS Component in the used component list in my WD component (say, the "top" level) and exactly one Controller Usage for the view I'm working in ("low" level).

I guess I will have to multiply the controller usage entries still keeping just one WDR_OVS Component declataration at WD Component level. Is this correct? Thanks in advance.