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: 

Selection from Drop down list in abap

0 Kudos
7,133

Hi everyone,

I have a requirement where I need to create a drop list as below.

A-related

B-not related

C- worngly related scenario.

I have created the drop down list code.

But the hard part i am facing is that when user select any of the above option. It should appear in the field as A (if A-related) is selected or B or C.

I need to show the full description in drop down list but when selected then it should show only alpahebet related to that selection.

Please help me out with this.

Thanks in advance

SR

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor
0 Kudos
3,518

A drop-down list box can only show either a text, or key + text, and its width is equal to the input field width.

Consequently, you cannot use such a list box to display text if the input field is one-character wide.

Instead, display a search help or use F4IF_INT_TABLE_VALUE_REQUEST or ...

8 REPLIES 8

ArthurParisius
Contributor
3,518

It might help if you share your code, so we can see where you might be doing something wrong.

dev_parbutteea
Active Contributor
3,518

Hi, Try changing the following setting in your SAP GUI options for drop down lists:

SAP GUI options --> Visualization1 --> check 'show keys within dropdown lists'.

FredericGirod
Active Contributor
0 Kudos
3,518

Check example in BIBS transaction

0 Kudos
3,518

I have just made domain for the drop down list with the below value-

A-Accepted

B- Rejected due to in correct data

C-on hold due to wrong information

.

.

. So on till H.

Now i have used it in my selection screen which I have created and named as 1000.

Now in this I have used the i/o box and make it as drop down list with keys.

But when executing the transaction code. I should select any value from the above mentioned drop down values but it should get filled like below.

A

B

C

So on.

Rather it is getting filled as full value such (A-accepted.) which is wrong as my requirement is if (A-accepted -) is selected from drop down then field should be populated by (A).

What should I do for that. I am not able to write the code for that. Is it possible or not.

0 Kudos
3,518

I have just made domain for the drop down list with the below value-

A-Accepted

B- Rejected due to in correct data

C-on hold due to wrong information

.

.

. So on till H.

Now i have used it in my selection screen which I have created and named as 1000.

Now in this I have used the i/o box and make it as drop down list with keys.

But when executing the transaction code. I should select any value from the above mentioned drop down values but it should get filled like below.

A

B

C

So on.

Rather it is getting filled as full value such (A-accepted.) which is wrong as my requirement is if (A-accepted -) is selected from drop down then field should be populated by (A).

What should I do for that. I am not able to write the code for that. Is it possible or not.

p244500
Active Contributor
0 Kudos
3,518

Hi,

Without your code we cant say anything . but jut try bellow code .

REPORT ztest.
PARAMETERS: p_drp AS LISTBOX VISIBLE LENGTH 30 MODIF ID pdf.
* Filling the list box
AT SELECTION-SCREEN OUTPUT.

DATA: lv_id     TYPE vrm_id,
      lv_values TYPE vrm_values,
      lv_value  LIKE LINE OF lv_values.

  CLEAR lv_value.
  APPEND lv_value TO lv_values.

  lv_value-key    = 'A'.
  lv_value-text   = 'Related'.
  APPEND lv_value TO lv_values.

  lv_value-key    = 'B'.
  lv_value-text   = 'Not related'.
  APPEND lv_value TO lv_values.

  lv_value-key    = 'C'.
  lv_value-text   = 'Wrongly related scenario'.
  APPEND lv_value TO lv_values.
  lv_id = 'P_DRP'.

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id              = lv_id
      values          = lv_values
    EXCEPTIONS
      id_illegavrm_id = 1
      OTHERS          = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

START-OF-SELECTION.
  IF sy-subrc = 0.
    write:/ p_drp.
  ENDIF.

Sandra_Rossi
Active Contributor
0 Kudos
3,519

A drop-down list box can only show either a text, or key + text, and its width is equal to the input field width.

Consequently, you cannot use such a list box to display text if the input field is one-character wide.

Instead, display a search help or use F4IF_INT_TABLE_VALUE_REQUEST or ...

RaymondGiuseppi
Active Contributor
0 Kudos
3,518

Define the domain/data element as type character of length 1, when creating values of domain give 'A' as value and a text as 'Accepted' or 'A-Accepted'.

Also if you define the field display with a short visible length (4 or 5 to reserve space for the dropdown icon) you screen should only display the leading character, but when the dropdown icon is pressed, the full text will be displayed during selection.

NB: Whatever visible length value is used, the field passed to program will be 1 character length from domain definition.

PARAMETERS: test4 TYPE aeclt AS LISTBOX VISIBLE LENGTH 4.
PARAMETERS: test20 TYPE aeclt AS LISTBOX VISIBLE LENGTH 20.

START-OF-SELECTION.
  WRITE:  / test4,
          / test20.