cancel
Showing results for 
Search instead for 
Did you mean: 

How to change standard search help to custom SH in webdynpro?

Former Member
0 Kudos

Hello Experts,

I need to change a standard search help into a custom one because I need to add a field in the result list. I already have the custom search help created, I just need to replace the standard one with this. The webdynpro component is /SAPSRM/WDC_DODC_ASL_H_GD (SRM) and the view is V_ASL_DODC_H_BASIC_D, input field is PORG_DESCRIPTION. I'm an ABAP developer with no experience in webdynpro.

Thanks in advanced,

Jack

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member193460
Contributor
0 Kudos

Hi Jack,

     Put the code mentioned by Oliver in view method enhancement WDDOINIT(POSTEXIT), This makes sure that the code is executed only when the application launches.

DATA: node_org_data  TYPE REF TO  if_wd_context_node,

        node_info TYPE REF TO if_wd_context_node_info.

  node_org_data = wd_context->get_child_node( name = wd_this->wdctx_org_data ).

  if node_org_data is bound.

    node_info = node_org_data->get_node_info( ).

    if node_info is bound.

      CALL METHOD lo_nd_info->set_attribute_value_help

        EXPORTING

          name            = 'PURCH_ORG_TEXT'

          value_help_mode = 'C_VALUE_HELP_MODE-AUTOMATIC'                 " Valid value help mode

          value_help      = 'z Search help name'.

    endif.

  endif.

and also make sure the search help has the same structure as in the standard search help(return structure).

PURCH_ORGTypesBBP_PROC_ORGCHAR140Responsible Purchasing Organization
PURCH_ORG_TEXTTypesBBP_PURCH_ORG_DESCCHAR400Purchasing Organization

With this it should work.

Regards,

Tashi

Former Member
0 Kudos

Hello Tashi,

Setting the value_help_mode to automatic causes the standard behavior to use the standard search help instead of the set custom one.

oliver_wurm
Active Participant
0 Kudos

Hi Jack,

you need to enhance method WDDOMODIFYVIEW (post-exit). In this enhancement the following code should do what you want. But this type of searchhelp assignment writes whatever the search help returns into that text field. You will have to add some logic to the search help exit function to populate the required fields of the web dynpro component. Please have a look at IF_V_ASL_DODC_H_BASIC_D (the WD_THIS references) and you'll see a definition of type Element_org_data referencing structure /SAPSRM/S_CLL_ORG_DATA. The standard search help would have populated fields PURCH_ORG and PURCH_ORG_TEXT of that structure because of the search help assignment ...

  DATA: node_org_data  TYPE REF TO  if_wd_context_node,

        node_info TYPE REF TO if_wd_context_node_info.

  node_org_data = wd_context->get_child_node( name = wd_this->wdctx_org_data ).

  if node_org_data is bound.

    node_info = node_org_data->get_node_info( ).

    if node_info is bound.

*     Valid Value Help Modes are

*      - deactivated 101

*      - automatic 111

*      - ddic 121

*      - ovs 131

      CALL METHOD lo_nd_info->set_attribute_value_help

        EXPORTING

          name            = 'PURCH_ORG_TEXT'

          value_help_mode = '121'                 " Valid value help mode

          value_help      = ''. " Search help name

    endif.

  endif.

Regards

Oliver

Former Member
0 Kudos

Hello Oliver,

I've actually already tried this in WDDOINIT. The problem is, the search help keeps returning the Purch Org. ID instead of the Purch. Org Description. And it seems that this is happening because the proper field is found in the structure where it references the standard search help. My custom search help is not referenced in the structure, therefore the correct field to display is not being determined. How can I make this possible? Can I somehow change the structure referenced through enhancement? In a POWL scenario, I could do this in a BADI CHNG_SELCRITERIA.

Thanks for your help,

Jack.

oliver_wurm
Active Participant
0 Kudos

Hi Jack,

in my original reply I mentioned that you will have to add some logic to the search help exit function module to populate the WebDynpro Component Context structure of type  ELEMENT_ORG_DATA. I would store the reference to that structure in a global memory area (e.g. static sttribute of a global class) and add some logic to the RETURN step of the search help exit that populates the fields with the selected value as required. The Purchasing Organization Text and the Purchasing Organization fields need to be popuplated.

Regards

Oliver

Former Member
0 Kudos

Hello Oliver,

Thanks for replying, I think we're on the right path. I failed to mention that I'm a beginner at webdynpro and OOP. Where can I find WebDynpro Component Context structure of type  ELEMENT_ORG_DATA? How do I change this through code? Could you please send a sample code?

Also, I tried to check the objects and it seems they're in a hierarchical order.

STRUCTURE

     - FIELD

     - FIELD

     - FIELD

I'm not sure that I can change the structure as this is being referenced by other fields.

Thanks.