‎2008 Apr 09 5:44 AM
Hi,
please can u provide the drop down list procedure for doing i have some 12 predefine reasons and other is their if user select others options users can enter their own reasons
Regarding
anil
‎2008 Apr 09 6:07 AM
Hi,
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).
The following logic needs to be written under PBO of the screen logic.
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.
Make it as per ur requirement..
Regards....
‎2008 Apr 09 7:29 AM
To get Drop Drown Box on screen .
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).
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 following code under the event
AT SELCTION-SCREEN OUTPUT.
6.Observe the above code and change as for ur requirement.
Regards,
Venkat.O
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.
‎2008 Apr 09 7:37 AM
Hi Anil,
You can use the prdefined values in the drop down directly if they are defined in "Values" tab of the domain and then by declaring the table control table field as a type of the domain...
Otherwise as suggested above you can bring values to the screen with the function module vrm values if it is from a source like a table .....
If the user needs to add a custom value in the dropdown..then a different functionality is to be considered..ie..we use drop down so that users cannot select extra other than those provided by us..
ie..if 1,2,3 ,4 are there in dropdown..user cannot enter 5 in dropdown.....if user wants 5 then it should be added manually to the domain values for the first case of it should be entered elsewhere maybe a table,internal table or another field on the same screen so that the vrm values function module can be used to display on the screen
so if there is an option like (1,2,3,4,others) are there in the drop down and when user selects "others"(we can do that by assigning function code to the drop down field in the screen painter) ...then an extra field can be shown where he can enter the remarks.....
regards
Byju