2006 Nov 07 9:46 AM
hello there,
How to get a drop down list box in selection screen and in module pools.
explain also, how to populate some data into that.
2006 Nov 07 9:55 AM
2006 Nov 07 9:48 AM
use the function module <b>VRM_SET_VALUES</b>
data: NAME type VRM_ID,
LIST type VRM_VALUES,
VALUE like line of LIST.
first of all change the field attribute to drop down list in the screen painter in SE51, where u can set the field attribute as drop down. <b>LISTBOX with Key</b>
NAME = Field name for which u wnat the drop down list.
loop at IT_TAB into IS_TAB.
IT_TAB contains the values which u want in drop downlist.
VALUE-KEY = IS_TAB-FIELD.
append VALUE to LIST.
clear IS_TAB.
endloop.
call function 'VRM_SET_VALUES'
exporting
ID = NAME
VALUES = LIST.
clear LIST.
Regards
- Gopi
2006 Nov 07 9:52 AM
&----
*& Report ZSREE_DROP *
*& *
&----
*& *
*& *
&----
REPORT ZSREE_DROP .
TABLES : LFA1,EKKO,EKPO.
TYPE-POOLS : VRM.
DATA I1 TYPE I VALUE 0.
DATA : BEGIN OF WA_LFA1,
LIFNR TYPE LIFNR,
NAME1 TYPE NAME1,
END OF WA_LFA1.
DATA IT_LFA1 LIKE TABLE OF WA_LFA1.
DATA : BEGIN OF WA_EKKO,
EBELN TYPE EBELN,
END OF WA_EKKO.
DATA IT_EKKO LIKE TABLE OF WA_EKKO.
DATA : BEGIN OF WA_EKPO,
EBELP TYPE EBELP,
END OF WA_EKPO.
DATA IT_EKPO LIKE TABLE OF WA_EKPO.
DATA : BEGIN OF WA_VRM,
KEY(40) TYPE C,
TEXT(80) TYPE C,
END OF WA_VRM.
DATA IT_VRM LIKE TABLE OF WA_VRM.
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
module USER_COMMAND_0100 input.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'PDOC'. "fctcode for first list box
CLEAR IT_EKKO.
SELECT EBELN INTO TABLE IT_EKKO FROM EKKO WHERE LIFNR = LFA1-LIFNR.
CLEAR IT_VRM.
LOOP AT IT_EKKO INTO WA_EKKO.
WA_VRM-KEY = WA_EKKO-EBELN.
WA_VRM-TEXT = WA_EKKO-EBELN.
APPEND WA_VRM TO IT_VRM.
CLEAR WA_VRM.
ENDLOOP.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'EKKO-EBELN'
VALUES = IT_VRM
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.
WHEN 'PITEM'. "fctcode second listbox
CLEAR IT_EKKO.
SELECT EBELP INTO TABLE IT_EKPO FROM EKPO WHERE EBELN = EKKO-EBELN.
CLEAR IT_VRM.
LOOP AT IT_EKPO INTO WA_EKPO.
WA_VRM-KEY = WA_EKPO-EBELP.
WA_VRM-TEXT = WA_EKPO-EBELP.
APPEND WA_VRM TO IT_VRM.
CLEAR WA_VRM.
ENDLOOP.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'EKPO-EBELP'
VALUES = IT_VRM
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.
ENDCASE.
*
*
endmodule. " USER_COMMAND_0100 INPUT
**&----
**
**& Module STATUS_0100 OUTPUT
**&----
**
text
**----
**
module STATUS_0100 output.
SET PF-STATUS 'ZSREE'.
SET TITLEBAR 'ZSREE'.
endmodule. " STATUS_0100 OUTPUT
&----
*& Module SELECT_LIST OUTPUT
&----
text
----
module SELECT_LIST output.
CLEAR IT_LFA1.
SELECT LIFNR NAME1 INTO TABLE IT_LFA1 FROM LFA1.
CLEAR IT_VRM.
LOOP AT IT_LFA1 INTO WA_LFA1.
WA_VRM-KEY = WA_LFA1-LIFNR.
WA_VRM-TEXT = WA_LFA1-LIFNR.
APPEND WA_VRM TO IT_VRM.
CLEAR WA_VRM.
ENDLOOP.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'LFA1-LIFNR'
values = IT_VRM
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.
endmodule. " SELECT_LIST OUTPUT
Bye Murthy
2006 Nov 07 9:53 AM
Hi,
Select values that has to passed into the List Box.
Then use VRM_SET_VALUES and pass the Key and Values to the Exporting Parameter.
Thanks,
Prashanth
2006 Nov 07 9:55 AM