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

Set a parameter value using Search help exit

Former Member
1,815

Hi All,

I want a search help such as If I enter a warehouse number on my screen then search help for storage bins should have that warehouse number populated in selection dialog.

I guess i have to write some code in search help exit if CALLCONTROL-STEP = 'PRESEL'.

But I am not able to set the warehouse value to parameter.

Does any one have done something like this?

Thanks in Advance,

Shailly

1 ACCEPTED SOLUTION
Read only

MarcinPciak
Active Contributor
1,066

Yup, you should do like this



"in search help exit function
  DATA wa_shlp_selopt LIKE LINE OF shlp-selopt.

  "change default value before dialog box with value selection appears
  IF callcontrol-step = 'PRESEL'.
    wa_shlp_selopt-shlpname  = 'TRDIR'.
    wa_shlp_selopt-shlpfield = 'NAME'.
    wa_shlp_selopt-sign      = 'I'.
    wa_shlp_selopt-option    = 'CP'.
    wa_shlp_selopt-low       = 'Z*'.
    APPEND wa_shlp_selopt TO shlp-selopt.
    wa_shlp_selopt-shlpname  = 'TRDIR'.
    wa_shlp_selopt-shlpfield = 'NAME'.
    wa_shlp_selopt-sign      = 'I'.
    wa_shlp_selopt-option    = 'CP'.
    wa_shlp_selopt-low       = 'Y*'.
    APPEND wa_shlp_selopt TO shlp-selopt.

    "skip the dialog box
    callcontrol-step = 'SELECT'.
  ENDIF.

Regards

Marcin

3 REPLIES 3
Read only

MarcinPciak
Active Contributor
1,067

Yup, you should do like this



"in search help exit function
  DATA wa_shlp_selopt LIKE LINE OF shlp-selopt.

  "change default value before dialog box with value selection appears
  IF callcontrol-step = 'PRESEL'.
    wa_shlp_selopt-shlpname  = 'TRDIR'.
    wa_shlp_selopt-shlpfield = 'NAME'.
    wa_shlp_selopt-sign      = 'I'.
    wa_shlp_selopt-option    = 'CP'.
    wa_shlp_selopt-low       = 'Z*'.
    APPEND wa_shlp_selopt TO shlp-selopt.
    wa_shlp_selopt-shlpname  = 'TRDIR'.
    wa_shlp_selopt-shlpfield = 'NAME'.
    wa_shlp_selopt-sign      = 'I'.
    wa_shlp_selopt-option    = 'CP'.
    wa_shlp_selopt-low       = 'Y*'.
    APPEND wa_shlp_selopt TO shlp-selopt.

    "skip the dialog box
    callcontrol-step = 'SELECT'.
  ENDIF.

Regards

Marcin

Read only

0 Likes
1,066

Hey Marcin,

Thanks a lot. Problem is solved!

Read only

Former Member
0 Likes
1,066

Hi Shailly,

I don#t know if that will be the best option for you, but you can make use of the abap program event at value request for your parameter_id.

What you need is to insert a similar code like the one below:

at selection-screen on value-request for p_param

select fielda fieldb from storage bin table into gi_warehouse_bin

where warehouse = warehouse parameter.

delete adjacent duplicates from gi_zzdez comparing all fields.

call function 'F4IF_INT_TABLE_VALUE_REQUEST'

exporting

retfield = space

dynpprog = 'REPORT_NAME'

dynpnr = '1000'

dynprofield = 'P_BIN'

window_title = 'Text'

value_org = 'S'

tables

value_tab = gi_warehouse_bin

exceptions

parameter_error = 1

no_values_found = 2

others = 3

.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

Cheers,

Florin