cancel
Showing results for 
Search instead for 
Did you mean: 

how to pass value to freely defined search help?

0 Kudos

In my Web Dynpro,

I have a Sales Org at Header Level

and Material in the Item Table. (the table is not in ALV format)

The item Table has Plant also .

I created a freely Defined Search help for the Plant.

But I am not able to pass the Sales Org and Material to the Search Help.

Also, I am not able to figure out the index of the table row in which the F4 is clicked.

I tried WDDOMODIFYVIEW method of the calling WDApp.

But it is not getting triggered when the button on the Search Help is clicked.

Please advise how to pass the value to the Search Help.

I looked at several posts and docs but this particular piece is not working.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

amy_king
Active Contributor
0 Kudos

Hi Chandra,

I wonder if you really need the search help to be freely programmed? If you need to pass data into a freely programmed search help (or any used component), you can use interface methods to allow your main component to pass data, e.g., sales org and material number, to the search help component, but that might be more work than you need to do.

If it fits your needs, a simpler approach might be to create a custom elementary search help and use a data dictionary structure that contains both the inputs and outputs that you want to use, e.g., sales org, material, plant. If you set the parameter IDs correctly, the search help should automatically see the values for sales org and material. I know there have been forum posts about how to do this (here's one) if it sounds like this approach might work for you.

Cheers,

Amy

0 Kudos

Hi Amy,

I already created a custom search help and tried to pass teh values using SET PARMATER etc.

I tested by hard coidng values and it worked fine.

But when I tried to read the values from the WD screen, the values are not reaching to the search help.

So I thought of the Value help piece.

I am passing the values in the WDDOMODIFYVIEW method.

But this is not getting triggered as the user is not pressing any buttons but simplye inputs the Sales org, Material Number and then goes to choose the F4 on the Plant - so no method is getting accessed at this point. and thus no values get passed.

So I am getting an empty popup and as soon as I close it it starts working fine.

May be if I find another way of triggering some automatic action, this may get mitigated (which is not proper thinking - I think).

Can you please advise.

Thanks

amy_king
Active Contributor
0 Kudos

Hi Chandra,

Have you tried the approach of mapping your context node to a data dictionary structure? (My earlier post wasn't clear about needing to bind your context node to the data dictionary structure, sorry) If the structure has fields for sales org, material, plant, and the plant field has your search help attached, and the fields are named and typed the same as the search help parameters, I think the search help would pick up the other values in the context node structure automatically and bring them into the search help. I know  this works for the single field that the search help is attached to, e.g., if you enter plant ABC* then hit the plant search help button, the search help will open with ABC* already defaulted in the plant field. Also, I know this works to return multiple fields from the search help to multiple context node fields. In theory, it might also work to pick up multiple fields of the context node structure and bring them into the search help though I admit I have not tried this.

Alternatively-- and this is a workaround really-- you could disable the plant field until the user enters both sales org and material since these are required by the search help, You would need to train users that they must hit enter on either the sales org or material fields in order to re-enable the plant field.

Best of luck,

Amy

0 Kudos

Thanks Amy

I am thinking of ENTER on the Sales Org field - that seems to be the only alternate for now.

I will keep this open for a while if some other suggestion pops up or I find some other way of achieving this.

Porbaly adding a button next to the Plant field would help?

But in this case the button should be made avaialble at every row and also it has to be dynamic as users can add empty rows to an existing table.

Had the ENTER button been enabled in a generic way - like it happens in dialog program - this would not have been an issue.

SAP should make Web Dynpro ABAP more flexible and flexible, I think.

Former Member
0 Kudos

Hi,

Actually, you can pass values to your freely programmed search help.

Your search help has a listener. This listener object has a field f4_context_element. When you call the search help, the element that calls the search help is passed as f4_context_element.

Hence you just have to do lo_listener->f4_context_element->get_attribute( ) to get the values.

Helpful links:

http://scn.sap.com/thread/3175442

0 Kudos

I tried the f4_context_element suggestion.

Here si the situtation.

On my screen - Sales Order is at header level.

Material and Plant are in the same item table.

When I say F4 on Plant

(following code in WDDOINIT of the Value Help WDA Component)

l_selected_element = wd_comp_controller->value_help_listener->f4_context_element.

l_selected_element->GET_STATIC_ATTRIBUTES(

     IMPORTING

          STATIC_ATTRIBUTES = LS_WA )

it brings in the item details only .

How to read the Sales Org also?

Former Member
0 Kudos

Yes.

This is because it gives you only the element from which the search help was called.

Now for getting the Sales org which is at header level, I can think of two solutions. You will have to try which one works and is better and feasible.

1. Add one more attribute 'SALES_ORG' to the child node ( Items level ). Now when filling the child node, fill the sales org value as the parent node value. This way the logic you have written above will give you sales org also. You do not see to add this to your view. This is for your reference only.

i.e. your child node shall have data like

SALES ORG      MATERIAL     PLANT

001                    001               001

001                    002               002

001                    003               003

002                    001               001

002                    002               002... Something like this.

2. You get the selected element in search help.

     a. Get the node of this element using IF_WD_CONTEXT_ELEMENT->GET_NODE

     b. Get node info of the node obtained in step a. IF_WD_CONTEXT_NODE->GET_NODE_INFO

     c. Get the parent node IF_WD_CONTEXT_NODE_INFO->GET_PARENT.

     d. Get the lead selection

     c. Get the sales org using GET_ATTRIBUTE.

Hope one of these methods helps you.

0 Kudos

I already am using the first method of filling the item table with Sales Org.

The secod method is not working for me..

Thanks for the help.

0 Kudos

TIMEDTRIGGER refreshes the screen per interval specified and this is working ok for me so far.

You can find examples of this interface element in the system in the Web Dynpro application WDR_TEST_UI_ELEMENTS, and in the component WDR_TEST_EVENTS in the view TIMEDTRIGGER

Answers (0)