Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Search Help

Former Member
0 Likes
427

Hi,

I'm having this problem with the custom search help. I have 2 custom fields which i want to populate when i click on a row in the search help.

for example, in the 1st field, when i click on the search help, and click on a row, it should populate 1st field with the export value and populate the 2nd field with the other export value in the search help.

So far, it is only populating the 1st field and not the 2nd one.

Does anyone know what the problem is? could it be due to the naming that i've used or is this not possible at all?

Thanks.

Regards,

r3venant

4 REPLIES 4
Read only

Former Member
0 Likes
403

Hi,

Not sure that search help can return value more than 1 field.

Can u do like this, populate 1st field which is the PK.

Then u read the table again based on that key to get the 2nd field value.

Best Regards,

Victor.

Read only

Former Member
0 Likes
403

<b>How are you coding in your program, to direct the value to 2nd field ?</b>

<i>May be you can create another search help Or use the first Value to fetch the details from SAP table and populate the same in 2nd field.</i>

Regards,

Vishal

Read only

0 Likes
403

there is no actual coding to retrieve the value from any table becoz after clicking on the search help, it does not go into any PBO so i dun think its possible to select from table after the selection.

Read only

0 Likes
403

Here's an answer I used for a similar question the other day:

I think you should look at function module DYNP_VALUES_UPDATE (or CALL METHOD c_dynpro_handler=>set_dynp_values which calls this function). There are lots of examples in SAP's code but basically this allows you to push values back onto the screen from within an F4 request.

I've used it, for example, for filling in the name and address details on the screen after the user has selected a customer number from the searchhelp.

You will need to trigger the searchhelp yourself inside your screen e.g.

process on value-request. 
   field gs_9900-my_field
   module d9900_f4_my_field.

and then

module d9900_f4_my_field input.
  perform d9900_f4_my_field.
endmodule.       

and then something along the lines of


form d9900_f4_my_field.
 
  data:
    l_dynpprog          like sy-repid,
    l_dynpnr            like sy-dynnr,
    lt_dynpfield        like dynpread,
    lt_dynpfield        like dynpread   occurs 10.
 
  l_dynpprog    = sy-repid.
  l_dynpnr      = sy-dynnr.
 
  call function 'F4IF_FIELD_VALUE_REQUEST'  "trigger your search help
     exporting
        ...
     importing
        ...
*
* use the results from 'return_tab-fieldval' to get the other data you want on the screen
* build up lt_dynpfield with the field names and values for the screen e.g.
* 
  clear: ls_dynpfield.
  concatenate 'GS_' l_dynpnr '-CUSTOMER_NAME'
    into ls_dynpfield-fieldname.
  ls_dynpfield-stepl      = 0.
  ls_dynpfield-fieldvalue = kna1-name1.
  ls_dynpfield-fieldinp   = space.
  append ls_dynpfield to lt_dynpfield.
* etc etc 
* then call the function that updates the screen
  call function 'DYNP_VALUES_UPDATE'  "update the screen fields
    exporting
      dyname     = l_dynpprog
      dynumb     = l_dynpnr
    tables
      dynpfields = lt_dynpfield
    exceptions
      others     = 0.
 
endform.

Let me know how it goes - and if you need any more specific sample code.

Note that there's also function DYNP_VALUES_READ which is handy for reading other screen field values from within a value request... so you can make your searchhelp limit the displayed values based on something else the user just keyed on the screen e.g. a company code.

cheers

jc