‎2007 May 19 6:19 AM
Dear Frds,
Can anybody tell me how can i display values from the listbox???
Explain me the procedure how can i achieve that???
Thanks in advance,
Warm Regards,
Nirav Parekh
‎2007 May 19 6:32 AM
Hi
See this example:
Input : p_char = 'J'.
Press: enter
List Box of Month = January, June , July.
REPORT ZLIST_VALUES.
TYPE-POOLS vrm.
tables:
spfli.
parameters: p_char type c.
parameters:
p_month(12) as listbox visible length 20,
p_year as listbox visible length 20 .
DATA:
t_table TYPE STANDARD TABLE OF vrm_value,
t_table1 TYPE STANDARD TABLE OF vrm_value,
vrm_values1 LIKE LINE OF t_table.
DATA:
t_year TYPE STANDARD TABLE OF vrm_value.
data: w_year(4) type n value '2000'.
*****************
at selection-screen output.
vrm_values1-key = 'a'.
vrm_values1-text = 'January'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'p'.
vrm_values1-text = 'February'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'q'.
vrm_values1-text = 'March'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'r'.
vrm_values1-text = 'April'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 's'.
vrm_values1-text = 'May'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 't'.
vrm_values1-text = 'June'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'u'.
vrm_values1-text = 'July'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'v'.
vrm_values1-text = 'August'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'w'.
vrm_values1-text = 'September'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'x'.
vrm_values1-text = 'October'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'y'.
vrm_values1-text = 'November'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'z'.
vrm_values1-text = 'December'.
APPEND vrm_values1 TO t_table.
t_table1[] = t_table.
delete t_table1 where text+0(1) <> p_char.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'p_month'
values = t_table1
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
do 10 times.
add 1 to w_year.
vrm_values1-key = sy-index.
vrm_values1-text = w_year.
APPEND vrm_values1 TO t_year.
enddo.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'p_year'
values = t_year
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
start-of-selection.
write: p_month.
Reward points if useful
Regards
Anji
‎2007 May 19 6:21 AM
Hi,
You have to use the FM VRM_SET_VALUES.
Check this example..
TYPE-POOLS: vrm.
PARAMETERS: p_test TYPE char4 AS LISTBOX VISIBLE LENGTH 10.
DATA: t_data TYPE vrm_values.
INITIALIZATION.
DATA: s_data TYPE vrm_value.
s_data-key = 'ABCD'.
s_data-text = 'First four'.
APPEND s_data TO t_data.
s_data-key = 'EFGHI'.
s_data-text = 'Second four'.
APPEND s_data TO t_data.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'P_TEST'
values = t_data
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.
START-OF-SELECTION.
WRITE: / p_test.
Thanks,
Naren
‎2007 May 19 7:37 AM
Dear Narendra sir,
Thanks for reply....
But could you say me how one can have value in the list box without using
coding... i mean to say ... by applying specific process on database tables....
Warm Regards,
Nirav Parekh
‎2007 May 21 8:22 AM
Dear Naren,
Your coding really works... Thanks for ur kind attention....
but still i am getting a problem ... it is that i can see the all values while cliking on the listbox drop down button but i can not select a value from the listbox....
I guess further code is required to sustain that selected value from the list box....
Thanks & Regards,,,
Nirav Parekh
‎2007 May 19 6:32 AM
Hi
See this example:
Input : p_char = 'J'.
Press: enter
List Box of Month = January, June , July.
REPORT ZLIST_VALUES.
TYPE-POOLS vrm.
tables:
spfli.
parameters: p_char type c.
parameters:
p_month(12) as listbox visible length 20,
p_year as listbox visible length 20 .
DATA:
t_table TYPE STANDARD TABLE OF vrm_value,
t_table1 TYPE STANDARD TABLE OF vrm_value,
vrm_values1 LIKE LINE OF t_table.
DATA:
t_year TYPE STANDARD TABLE OF vrm_value.
data: w_year(4) type n value '2000'.
*****************
at selection-screen output.
vrm_values1-key = 'a'.
vrm_values1-text = 'January'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'p'.
vrm_values1-text = 'February'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'q'.
vrm_values1-text = 'March'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'r'.
vrm_values1-text = 'April'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 's'.
vrm_values1-text = 'May'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 't'.
vrm_values1-text = 'June'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'u'.
vrm_values1-text = 'July'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'v'.
vrm_values1-text = 'August'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'w'.
vrm_values1-text = 'September'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'x'.
vrm_values1-text = 'October'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'y'.
vrm_values1-text = 'November'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'z'.
vrm_values1-text = 'December'.
APPEND vrm_values1 TO t_table.
t_table1[] = t_table.
delete t_table1 where text+0(1) <> p_char.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'p_month'
values = t_table1
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
do 10 times.
add 1 to w_year.
vrm_values1-key = sy-index.
vrm_values1-text = w_year.
APPEND vrm_values1 TO t_year.
enddo.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'p_year'
values = t_year
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
start-of-selection.
write: p_month.
Reward points if useful
Regards
Anji
‎2007 May 19 7:38 AM
Dear Anjir,
Thanks for reply....
But could you say me how one can have value in the list box without using
coding... i mean to say ... by applying specific process on database tables....
Warm Regards,
Nirav Parekh
‎2007 May 19 7:40 AM
MODULE dropdown_rshft INPUT.
DATA: BEGIN OF x_rshft,
rshft TYPE zpprp-rshft,
END OF x_rshft.
DATA: itab_rshft LIKE STANDARD TABLE OF x_rshft WITH HEADER LINE.
IF itab_rshft[] IS INITIAL.
itab_rshft-rshft = 'I'.
APPEND itab_rshft.
itab_rshft-rshft = 'II'.
APPEND itab_rshft.
itab_rshft-rshft = 'III'.
APPEND itab_rshft.
itab_rshft-rshft = 'Gen.'.
APPEND itab_rshft.
ENDIF.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'RSHFT'
value_org = 'S'
TABLES
value_tab = itab_rshft
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
ENDMODULE. " dropdown_rshft INPUT
‎2007 May 19 7:45 AM
Hi Nirav,
If you want to display the field as a list box on the screen then you can achieve this by changing the screen parameters of that field.
There is no need to do it by doing coding in ABAP but some changes are required to be done on screen painter.
Hope you understood.
Revert back if you require further explaination.
Reward points if helpful.
Regards,
Atish
‎2007 May 21 8:22 AM
Dear Anji,
Your coding really works... Thanks for ur kind attention....
but still i am getting a problem ... it is that i can see the all values while cliking on the listbox drop down button but i can not select a value from the listbox....
I guess further code is required to sustain that selected value from the list box....
Thanks & Regards,,,
Nirav Parekh
‎2007 May 19 8:08 AM
Hi,
In the screen painter input field attributes to say Drop down list..But I believe still you have to do some coding to get the values in the list box..
Thanks
Naren
‎2007 May 19 2:26 PM
search for a program called 'Demo_*_Listbox'. will be very useful
‎2007 May 19 10:12 PM
Hi Nirav,
if the parameter field is connected to a check table, no populating is reqired:
PARAMETERS:
p_auart type vbak-auart
as listbox visible length 20.
This is all for the listbox.
Regards,
Clemens
‎2007 May 21 8:26 AM
Hi
Use VRM type-pool.
It's similar like SLIS type-pool.
Go thru the VRM type-group so that u can get the sample code there.
Regards,
Sreeram Kumar.M
‎2007 May 21 8:31 AM
Hi Nirav,
If u have fixed values in ur domain just give that field as listbox that entries will automatically come as drop down. and dont forget to click from dictionary.
Hope this helps
regds
Seema
‎2007 May 21 8:50 AM
just go through these programs
<b>DEMO_DYNPRO_DROPDOWN_LISTBOX
DEMO_DROPDOWN_LIST_BOX</b>
and take a look at this link
<b>https://forums.sdn.sap.com/click.jspa?searchID=1235922&messageID=2951115</b>