Friday, December 17, 2010
Use function module VRM_SET_VALUES at AT SELECTION-OUTPUT event if it is SE38 program or at PROCESS BEFORE EVENT if it is module pool program.

To get Drop Drown Box on screen .
Follow these steps.
1.Go to T.Code SE51 and Select Laypout for the Screen.
2.Double click on the field for which u want Dropdown box.
3.Then U will see Name ,Text ,DROPDOWN.Click on that and select List Box 
    or ListBox with key . Better to to select first one.
4.Save and Activate ur screen .
5.Enter the following piece of code in the PBO of the screen.(Change for ur
   requirement).

TYPE-POOLS :vrm.
DATA:
  i_natio TYPE vrm_values, "-->Table that is passed through FM vrm_set_values
  w_natio LIKE LINE OF i_natio.
DATA: 
BEGIN OF i_t005t OCCURS 0,
    land1 TYPE t005t-land1,
    natio TYPE t005t-natio,
END OF i_t005t.

IF i_t005t[] IS INITIAL.
  SELECT land1 natio
     FROM t005t
       INTO TABLE i_t005t
   WHERE spras = sy-langu.
  IF sy-subrc = 0.
    LOOP AT i_t005t .
      w_natio-key = i_t005t-land1.
      w_natio-text = i_t005t-natio.
      APPEND w_natio TO i_natio.
      CLEAR w_natio.
    ENDLOOP.
  ENDIF.
ENDIF.
CALL FUNCTION 'VRM_SET_VALUES'
  EXPORTING
    id              = 'I_IT0002-NATIO' "-->Field for which dropdown is needed.
    values          = i_natio
  EXCEPTIONS
    id_illegal_name = 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.
To get Drop Drown Box on Selection-screen for parameter.
1.define parameter.
   PARAMETERS: p_drop type pernr-pernr as listbox.
2.Write down the above code under AT SELECTION-SCREEN OUTPUT event.

2 comments:

  1. how to make one of the list values as default and that value should not be repeated twice in the list .because when I am trying to make it as a default , it is displayed twice in the list.

    ReplyDelete
  2. how to make one of the values of list as a default value and it should not be repeated twice in the list. kindly help me with this

    ReplyDelete

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.