Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Background on Search Help, Structures - how its tied together to work in WD

Consider having multiple UI elements in a Form or table with couple them tied to automatic F4 helps. When you select a value from F4 the corresponding details / values of other fields are filled in the Form or Table. How is this done? We have our context nodes and attributes which are tied to some structures mostly. This structure in turn have Search Helps tied to them. There is a mapping done at the structure level to the fields from the Search Help. Classic !!! When this is setup properly then BINGO in WD ABAP we do not need to do anything and the values are automatically populated to the fields based on the F4.

Couple of Example Scenarios

1) Country Code and Description

2) PERNR and UserName Details

3) Order No and Descirption

4) Company Code and Description

.....and the list goes endless

Why this BLOG?

The F4 help implementation as such is a direct one when DDIC is used and there is no modifications to the standard structure. But often we end up handling with SAP standard components delivered with the business packages. One such requirement came to us to map one of the field and its description to a custom search help instead of the standard one. The Description field was read only and the code is the one that can be selected. Right away oh yeah this falls under a classic examples we saw above but the only difference is its in the standard component. We built a custom search help and then in our WD we made a call in one of our POSTEXIT's to use this custom search help through a sample code below -


Data: lo_nd_attrib type ref to if_wd_context_node,
      lo_nd_attrib_info type ref to if_wd_context_node_info.
*  Get the Node and Attribute Information
lo_nd_attrib = wd_context->path_get_node( path = `Node PATH` ).
lo_nd_attrib_info = lo_nd_attrib->get_node_info( ).
* Set the custom search help that need to be executed for the context attribute
lo_nd_attrib_info->set_attribute_value_help( name = 'ATTRIBUTE_NAME' value_help_mode = '121' value_help = 'ZCUSTOM_SEARCHHELP' ).

Issue Faced:

Only the code was being populated back but the description was not mapped to the corresponding field and it was blank. I raised a question in our forum to get inputs on how this can be achieved. Enhancing F4 Search Help Issue - Standard Component

Thanks to ramakrishnappa for helping me in this thread with couple options that we discussed on achieving this solution.

Thought Process after hitting Roadblocks

From the discussion we had in the thread above I was left with either build an OVS or somehow handle the F4 close event in WDABAP Domodifyview. We are not on SAP 7.31 so there is no listeners like the register_on_enter_for_f4.

Then I came across the document written by chris.paine on Firing a WDA event on using a Search Help - how to do it, without an NDA


and thought ok this is the way I might need to approach the solution so I get the code back and through the listener classes I can handle the context elements...do a select statement to get the description based on the code selected from the F4. Yuppie !!! his blog worked like a charm and I was able to complete the requirement given :smile: .


Still Not Convinced

Got the solution but was not able to move on as there got to be some way that SAP provides us these values back to the front end instead taking all these approaches. Then, with the help of my colleagues and thanks a lot to them ( Mahesh Square - 2 guys but the combo had the same name :razz: ) who are core ABAPers and I wanted to check the Search Help Exit for the callcontrol-step = 'RETURN’


Tagging magesh.basavaraj2 and mahesh.ys


And the SOLUTION We FOUND WAS


Basically, the standard search Help when it returns the values back there is an output flag which is set to 'X' and sent back. This was taken as the reference and we implemented the below code in our search help exit to achieve the solution !!!



DATA: shinterface TYPE DDSHIFACE.
FIELD-SYMBOLS: <lf_desc> TYPE DDSHFPROP.
IF callcontrol-step = 'RETURN'.
  CLEAR: shinterface.
* A Mapping between the Search help field and the structure field has to be done here for all fields that need to carry data to Webdynpro
    shinterface-SHLPFIELD = 'F4 Field'.
    shinterface-VALFIELD  = 'ABAP STRUCTURE-FIELD'.
    shinterface-F4FIELD   = 'X'.
    APPEND shinterface TO shlp-INTERFACE.
    LOOP AT SHLP-FIELDPROP ASSIGNING <lf_desc>.
* From the Search Help populate the output flag for fields that need to carry the data to Webdynpro
      IF <lf_desc>-FIELDNAME = 'F4 Field_1' OR <lf_desc>-FIELDNAME = 'F4 Fild_2'.
        <lf_desc>-SHLPOUTPUT = 'X'.
      ENDIF.
    ENDLOOP.
ENDIF.

Your Comments and critics are most welcome !!!

Labels in this area