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: 

drop down lists using VRM_SET_VALUES

Former Member
0 Kudos

Hello All ,

i am calling VRM_SET_VALUES for drop down list, by exporting the ID and VALUES.

total i am passing 6 values, so first time when i am in selection screen , it is displaying 6 values. fine ia m happy with this.

after executing the selection screen , if i come back, and see the drop down list , now this contains 7 values, the extra 7th value is what i selected first time. (so what i selected first time is now coming again, this entry is duplicated, now this entry is displaying at the bottom of the list , in capital letters). i dont want this extra entry, can some tell a way how to remove this.

P.S. i searched SDN , i dint find any problem releated this

Thanks in advance.

Best Regards,

Amarender Reddy B.

7 REPLIES 7

Former Member
0 Kudos

Hi,

Try clearing the variables to be passed to the FM 'VRM_SET_VALUES ' at end-of-selection event.

Regards,

Mansi.

Former Member
0 Kudos

make sure of clearing the variables before passing to FM. I think you might have not done it and getting duplicate values.

I355602
Advisor
Advisor
0 Kudos

Hi,

Refer code:-


TABLES : Y_MOVIE.
 
TYPE-POOLS: VRM.
 
TYPES : BEGIN OF MOVIE,
        YR LIKE Y_MOVIE-YR,
        CATEGORY LIKE Y_MOVIE-CATEGORY,
        WINNER LIKE Y_MOVIE-WINNER,
        NOTES LIKE Y_MOVIE-NOTES,
        END OF MOVIE.
 
DATA: NAME TYPE VRM_ID,
      LIST TYPE VRM_VALUES,
      VALUE LIKE LINE OF LIST,
      MOVIETAB TYPE STANDARD TABLE OF MOVIE INITIAL SIZE 10 WITH HEADER LINE.
 
PARAMETERS: CATEGORY(10) AS LISTBOX VISIBLE LENGTH 10.
 
AT SELECTION-SCREEN.
  IF CATEGORY EQ ''.
    MESSAGE E006.
  ENDIF.
 
AT SELECTION-SCREEN OUTPUT.
 
  NAME = 'CATEGORY'.
 
  VALUE-KEY = 'PIC'.
  VALUE-TEXT = 'PIC'.
  APPEND VALUE TO LIST.
 
  VALUE-KEY = 'MAL'.
  VALUE-TEXT = 'MAL'.
  APPEND VALUE TO LIST.
 
  VALUE-KEY = 'FEM'.
  VALUE-TEXT = 'FEM'.
  APPEND VALUE TO LIST.
 
  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      ID     = NAME
      VALUES = LIST.
 
START-OF-SELECTION.
 
  WRITE : / 'Category Selected :', CATEGORY.
 
  ULINE.
 
  SELECT *
  FROM Y_MOVIE INTO CORRESPONDING FIELDS OF TABLE MOVIETAB
  WHERE CATEGORY = CATEGORY.
 
END-OF-SELECTION.
 
  WRITE : /1 'Year', 6 'Category', 16 'Winner', 50 'Notes'.
  ULINE.
 
  LOOP AT MOVIETAB.
 
    WRITE : /1 MOVIETAB-YR, 8 MOVIETAB-CATEGORY, 16 MOVIETAB-WINNER, 50 MOVIETAB-NOTES.
    ULINE.
 
  ENDLOOP.
 
  IF SY-SUBRC  0.
    MESSAGE I005.
  ENDIF.

Hope this helps you.

Regards,

Tarun

Former Member
0 Kudos

HI,

Have you written the code this way

TYPE-POOLS : vrm.

PARAMETERS p_TEST(3) AS LISTBOX VISIBLE LENGTH 5 DEFAULT 'YES'.

DATA: g_name TYPE vrm_id,
      g_list  TYPE vrm_values,
      g_value LIKE LINE OF g_list.

AT SELECTION-SCREEN OUTPUT.

  CLEAR: g_value, g_list.
  g_value-key = 'YES'.
  g_value-text = 'YES'.
  APPEND g_value TO g_list.

  g_value-key = 'NO'.
  g_value-text = 'NO'.
  APPEND g_value TO g_list.


    CALL FUNCTION 'VRM_SET_VALUES'
      EXPORTING
        id     = 'P_TEST'
        values = g_list.

Former Member
0 Kudos

AT SELECTION-SCREEN OUTPUT.

*******Just Clear your Value List,

Clear LIST[].

NAME = 'CATEGORY'.

VALUE-KEY = 'PIC'.

VALUE-TEXT = 'PIC'.

APPEND VALUE TO LIST.

VALUE-KEY = 'MAL'.

VALUE-TEXT = 'MAL'.

APPEND VALUE TO LIST.

VALUE-KEY = 'FEM'.

VALUE-TEXT = 'FEM'.

APPEND VALUE TO LIST.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = NAME

VALUES = LIST.

in case if problem is not solve please post your code so we will solution soon

p190355
Active Contributor

Hi,

Basically you must code must have

1) A Select Statement that populates values to an internal table (lit_table)

2) Set values to display with :


DATA  lit_values TYPE vrm_values WITH HEADER LINE.
 REFRESH lit_table, lit_values. "important
  LOOP AT lit_table INTO ls_line. 
    lit_values-text   =   ls_line-text. 
    lit_values-key    =   ls_line-skey. 
    APPEND lit_values. 
 ENDLOOP. 

* Set corresponding values 
  CALL FUNCTION 'VRM_SET_VALUES' 
    EXPORTING 
      id              = 'screenfield reference'
      values          = lit_values[] 
    EXCEPTIONS 
      id_illegal_name = 1 
      OTHERS          = 2.

Cheers,

Remi

0 Kudos

If the above issue is solved, Can you tell me what you have done for this?