‎2006 Mar 01 3:32 AM
Hi all,
Simple question, editing screen in Layout,
i made a listbox, how to add items text into listbox?
the text values is fixed , not dynamic .
Thanks in advance.....
‎2006 Mar 01 3:34 PM
Hello Kokwei,
Please first activate the screen with the listbox in the Layout Editor.
Then to populate the listbox, the input field with the listbox needs to be declared in your program with a datatype in DDIC (transaction SE11) with a domain that has a value list ("single vals" under the tab "Value Range").
Then when you activate and run the program, the listbox is automatically populated (at runtime) with the values from the value list.
I just tested this with a domain of type INT4, restricted to the values 1, 2, 3.
Kind regards,
Michael Kraemer
‎2006 Mar 01 3:39 AM
use the fn module "VRM_SET_VALUES".
example:
DATA: NAME TYPE VRM_ID,
LIST TYPE VRM_VALUES,
VALUE LIKE LINE OF LIST.
REFRESH LIST.
NAME = 'ABC'.
MOVE: '1' TO VALUE-KEY,
'ABCD' TO VALUE-TEXT.
APPEND VALUE TO LIST.
MOVE: '2' TO VALUE-KEY,
'XYZS' TO VALUE-TEXT.
APPEND VALUE TO LIST.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = NAME
VALUES = LIST.
Message was edited by: Hymavathi Oruganti
‎2006 Mar 01 3:40 AM
Hi,
REPORT ZLIST.
TYPE-POOLS: VRM.
DATA: NAME TYPE VRM_ID,
LIST TYPE VRM_VALUES,
VALUE LIKE LINE OF LIST.
PARAMETERS: PS_PARM(10) AS LISTBOX VISIBLE LENGTH 10.
AT SELECTION-SCREEN OUTPUT.
NAME = 'PS_PARM'.
VALUE-KEY = '1'.
VALUE-TEXT = 'LINE 1'.
APPEND VALUE TO LIST. VALUE-KEY = '2'.
VALUE-TEXT = 'LINE 2'.
APPEND VALUE TO LIST.
CALL FUNCTION 'VRM_SET_VALUES' EXPORTING ID = NAME VALUES = LIST.
START-OF-SELECTION.
WRITE: / 'PARAMETER:', PS_PARM.Also Chek this link for a sample code:
You can use function module VRM_SET_VALUES for this.
Check the sample program: DEMO_DYNPRO_DROPDOWN_LISTBOX,
in SE51 with screen: 0100. and
RSDEMO_DROPDOWN_LISTBOX
http://help.sap.com/saphelp_46c/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/content.htm
A lot of examples are there in this link:
Best Regards,
Anjali
‎2006 Mar 01 3:49 AM
Hi,
Another example:
report ad_test.
type-pools: vrm.
data: it_val type vrm_values,
w_line like line of it_val.
parameters p_bukrs like t001-bukrs as listbox
visible length 25 obligatory.
initialization.
select bukrs butxt from t001 into (w_line-key, w_line-text).
append w_line to it_val.
check p_bukrs is initial.
p_bukrs = w_line-key.
endselect.
at selection-screen output.
call function 'VRM_SET_VALUES'
exporting
id = 'P_BUKRS'
values = it_val.
end-of-selection.
write: / 'Company Code:', p_bukrs.Best Regards,
Anjali
‎2006 Mar 01 4:15 AM
Hi Kokwei,
Take this simple example..
This is a simple eg. of Static List Box..
REPORT ZSATLISTBOX.
TYPE-POOLS: VRM.
DATA: NAME TYPE VRM_ID,
LIST TYPE VRM_VALUES,
VALUE LIKE LINE OF LIST.
PARAMETERS: PS_PARM(10) AS LISTBOX VISIBLE LENGTH 10.
AT SELECTION-SCREEN OUTPUT.
*populate the list with the value you want-------
NAME = 'PS_PARM'.
VALUE-KEY = '1'.
VALUE-TEXT = 'LINE 1'.
APPEND VALUE TO LIST. VALUE-KEY = '2'.
VALUE-TEXT = 'LINE 2'.
APPEND VALUE TO LIST.
*call the FM VRM_SET_VALUES-----------------------
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING ID = NAME
VALUES = LIST.
*print The selected one---------------------------
START-OF-SELECTION.
WRITE: / 'PARAMETER:', PS_PARM.regards
satesh
‎2006 Mar 01 4:54 AM
Hi Kokwei,
1. I suppose u are doing in module pool.
2. we have to do things :
a) write some code in pai
b) write some code in a module
3. in pai
PROCESS AFTER INPUT.
PROCESS ON VALUE-REQUEST.
field mylistab module abc.
(where mylisttab = field screen - listbox name)
and abc = module (where we will write code)
4. code for module abc.
MODULE abc INPUT.
DATA : BEGIN OF itab OCCURS 0,
bukrs LIKE t001-bukrs,
butxt LIKE t001-butxt,
END OF itab.
SELECT * FROM t001 INTO CORRESPONDING FIELDS OF TABLE itab.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'BUKRS'
value_org = 'S'
dynprofield = 'MYLISTTAB'
dynpprog = sy-repid
dynpnr = sy-dynnr
TABLES
value_tab = itab
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
ENDMODULE. " abc INPUT
regards,
amit m.
‎2006 Mar 01 5:23 AM
erm.... i am sorry to make you all misunderstood, what i mean is,
what s the way in adding items into list box, OTHER than using programming CODE ?
anyway ,,, thanks for the replies from you all...
thanks...
‎2006 Mar 01 5:24 AM
hi kokwei,
with out any code, how u can u expect to come it instantly?
i didnt get u, pls explain ur question in detail
‎2006 Mar 01 5:41 AM
Hi Kokwei,
Could u explain ur requirement more clearly....
A dropdown box offers the user a <b>predefined set of input values</b> from which to choose. It is <b>not possible to type a entry into a dropdown box</b>, instead, the user must use one of the values from the list.
Regards,
Anjali
‎2006 Mar 01 6:13 AM
Hi,
There is one way i just found. But not sure if this is ur requirement.
GO to screen painter, create an Input/output field.
In the attributes:
NAME: MARA-MTART
Dropdown: Listbox.
call this screen in ur program>
Eg:
report test.
Call screen 100.
Here, you will get all the entries in MARA-MTART.
Let us know if this is ur requirement.
Also, tell us what is it that u want in your list box.
Regards,
Anjali
‎2006 Mar 01 6:24 AM
HI
THERE IS A FM TO TRANSFER VALUES TO A LIST BOX.
<b>VRM_SET_VALUES </b>
Populates listbox parameter (like value 1 value 2 value 3 value 4 ) with values for selection
EXAMPLE
report z.
type-pools: vrm.
data: it_val type vrm_values,
w_line like line of it_val.
parameters p_bukrs like t001-bukrs as listbox
visible length 25 obligatory.
initialization.
select bukrs butxt from t001 into (w_line-key, w_line-text).
append w_line to it_val.
check p_bukrs is initial.
p_bukrs = w_line-key.
endselect.
at selection-screen output.
call function 'VRM_SET_VALUES'
exporting
id = 'P_BUKRS'
values = it_val.
end-of-selection.
write: / 'Company Code:', p_bukrs.
IF THIS FINDS USEFUL PLEASE REWARD POINTS.
REGARDS,
ANOOP.
‎2006 Mar 01 3:34 PM
Hello Kokwei,
Please first activate the screen with the listbox in the Layout Editor.
Then to populate the listbox, the input field with the listbox needs to be declared in your program with a datatype in DDIC (transaction SE11) with a domain that has a value list ("single vals" under the tab "Value Range").
Then when you activate and run the program, the listbox is automatically populated (at runtime) with the values from the value list.
I just tested this with a domain of type INT4, restricted to the values 1, 2, 3.
Kind regards,
Michael Kraemer