Application Development 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: 

How to display the listbox values based on the other parameter in the selection screen

Former Member
0 Kudos

Hi  Experts,

I have to change the listbox values based on the other parameters value in the selection screen.like in my report there is two parameters in the selection screen as p_whr ( parameter) and p_query (Parameter as list box).When we change the value of p_whr then the logic should trigger automatically and get display the corresponding values in the list box

Could you please help what even I have to use to changes the listbox values based on the other parameter or share any examples for the same scenario.

Thanks in advance

Krishna

2 REPLIES 2

Former Member
0 Kudos

Hi Ram,

By using AT SELECTION-SCREEN ON VALUE REQUEST event it is possible. You can change p_whr

value by clicking on F4 function key. Based on p_whr vale you can change p_query list box values.

An SAP Consultant: ABAP - F4 help - DYNP_VALUES_READ

http://www.saptechnical.com/Tutorials/ABAP/F4/Page2.htm

Hopes it helps you.

Thanks,

Ashok.

gabmarian
Active Contributor
0 Kudos

Hi Krishna,

Here is a code piece for it:

Listbox parameter P_LB is filled up with values from 1 up to X, where X is the value what you specified in other parameter P_NUM.

The important thing is setting MODIF ID for P_NUM, so in case of change selscreen PAI (AT SELECTION SCREEN event), an afterwards PBO will be triggered.

Then, in AT SELECTION SCREEN OUTPUT event, you can use  FM VRM_SET_VALUES to fill the listbox with the proper values.

DATA:
  gt_status_values TYPE TABLE OF vrm_value,
  gs_status_value TYPE vrm_value.

PARAMETERS:

  p_num TYPE i MODIF ID mod,
  p_lb  AS LISTBOX VISIBLE LENGTH 10.

AT SELECTION-SCREEN OUTPUT.

  CLEAR gt_status_values.

  DO p_num TIMES.

    gs_status_value-key  = sy-index.
    gs_status_value-text = sy-index.

    APPEND gs_status_value TO gt_status_values.

  ENDDO.


  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id     = 'P_LB'
      values = gt_status_values
    EXCEPTIONS
      OTHERS = 1.



AT SELECTION-SCREEN.