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

dynamic select-options using parameter

Former Member
0 Likes
576

Hi experts,

It the user selects one value from dropdown list, it should generate one select-option using that name. Is it possible?

for example, (pls see my code).

If user selects 'Malek' from parameter, <b>and press 'ENTER'</b>

<b>select-option should display with that name</b> like

Malek malek-low malek-high

And if user selects some other like 'Amran'. It should generate(and append)

Malek malek-low malek-high

amran amran-low amran-high

and so on....


report c.

data: t_return like ddshretval occurs 0 with header line.
data: begin of t_names occurs 0,
       name like usr01-bname,
      end of t_names.

parameters : i_inspec like usr01-bname.

at selection-screen on value-request for i_inspec.
  perform get_names.

form get_names.

  t_names-name = 'Malek'.
  append t_names.
  t_names-name = 'Amran'.
  append t_names.
  t_names-name = 'Ow CC'.
  append t_names.
  t_names-name = 'titbit'.
  append t_names.


  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
      retfield    = 'T_NAMES-NAME'
      dynpprog    = sy-cprog
      dynpnr      = sy-dynnr
      dynprofield = 'I_INSPEC'
      value_org   = 'S'
    tables
      value_tab   = t_names.

  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno with
    sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.
  read table t_return index   1.

endform.                    "GET_NAMES

Reward guaranteed,

thanks

kaki

5 REPLIES 5
Read only

Former Member
0 Likes
546

Use At selection-screen output,use screen internal table..

  • User Dynamic Selection

at selection-screen output.

select single * from t000md.

loop at screen.

case screen-group1.

when 'REL'.

if not p_old is initial.

screen-input = '0'.

screen-required = '0'.

screen-invisible = '1'.

endif.

modify screen.

when 'BEL'.

if not p_new is initial.

screen-input = '0'.

screen-required = '0'.

screen-invisible = '1'.

endif.

modify screen.

when 'ARB'.

if p_new is initial.

screen-input = '0'.

screen-required = '0'.

screen-invisible = '1'.

endif.

modify screen.

when 'MTA'.

if p_new is initial.

screen-input = '0'.

screen-required = '0'.

screen-invisible = '1'.

endif.

modify screen.

endcase.

endloop.

Read only

Former Member
0 Likes
546

Hi Kaki,

Plz check the code which is in bold.

<b>tables : usr01.</b>
data: t_return like ddshretval occurs 0 with header line.
data: begin of t_names occurs 0,
       name like usr01-bname,
      end of t_names.

parameters : i_inspec like usr01-bname.
<b>select-options:  s_option for usr01-bname modif id m1.</b>

at selection-screen on value-request for i_inspec.
  perform get_names.

<b>at selection-screen output.
 LOOP AT SCREEN.
    IF i_inspec <> ' '.
      IF screen-group1 = 'M1'.
        screen-active = '1'.
        MODIFY SCREEN.
      ENDIF.
    else.
     IF screen-group1 = 'M1'.
        screen-active = '0'.
        MODIFY SCREEN.
      ENDIF.

    ENDIF.
  ENDLOOP.
s_option-low = i_inspec.
append s_option.</b>
form get_names.

  t_names-name = 'Malek'.
  append t_names.
  t_names-name = 'Amran'.
  append t_names.
  t_names-name = 'Ow CC'.
  append t_names.
  t_names-name = 'titbit'.
  append t_names.


  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
      retfield    = 'T_NAMES-NAME'
      dynpprog    = sy-cprog
      dynpnr      = sy-dynnr
      dynprofield = 'I_INSPEC'
      value_org   = 'S'
    tables
      value_tab   = t_names.

  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno with
    sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.
  read table t_return index   1.

endform

plz reward points if helpful

Thanks,

Suma.

Read only

0 Likes
546

Hi suma,

After executing your code, can you see it..!!!

In the place of <b>s_option</b> i need name of the parameter value ( for ex: Malek).

If i select parameer 2 times,

It shoud display 2 values....

Malek selection range

Amran selection range

Thanks

kaki

Read only

Former Member
0 Likes
546

Hi

I believe the easier solution is to create a selection-screen with all select-options u can need, and after user selection u should decide which select-options has to be active.

Max

Read only

0 Likes
546

Hi Max,

But problem is i have 151 fields

kaki