‎2008 Feb 11 9:44 AM
Hi all ,
I have taken text box on the screen and assigned dropdown option to it.
Now in drop down i want to give two values (Yes, No).
So how the values are assigned.
Please tell me with code if possible.....
Have your points.!!!!
‎2008 Feb 11 9:49 AM
Hi,
Here is the example code
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..[http://sap.niraj.tripod.com/id38.html]
Regards
Sudheer
‎2008 Feb 11 9:51 AM
hi,
Check the code in RSDEMO_DROPDOWN_LISTBOX program and u will find how to set the values in a list box. The same functionality can be written in u'r module pool program to set the values
reward if its useful
‎2008 Feb 11 9:51 AM
Hi,
In your report declare
TYPE-POOL : VRM.
DATA: ws_name TYPE vrm_id,
ws_list TYPE vrm_values,
ws_value LIKE LINE OF ws_list,
ws_name2 TYPE vrm_id.
Under PBO event.
ws_value-key = '1'.
ws_value-text = 'YES'.
APPEND ws_value TO ws_list.
ws_value-key = '2'.
ws_value-text = 'NO'.
APPEND ws_value TO ws_list.
ws_name = your list box field name .
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = ws_name
values = ws_list
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
Don't forget to reward if useful....
‎2008 Feb 11 9:52 AM
hi
good
this is the flow logiv under POV.*
process on value-request.
field wa_scr1-auart module create_dropdown_box1.
this is the code under the above mentioned module *
module create_dropdown_box1 input.
select distinct auart into corresponding fields of table it_auart from TVAK.
sort it_auart by auart.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'AUART'
value_org = 'S'
tables
value_tab = it_auart
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
IF sy-subrc 0.
...
ENDIF.
endmodule. " CREATE_DROPDOWN_BOX1
declaration of the it_auart. *
types: begin of t_auart,
auart type auart,
end of t_auart.
data: it_auart type standard table of t_auart.
*
What actually this code is doing is that we are declaring a module "create_dropdown_box1" under POV.
Whenever we do that ,the POV is triggered at PBO and the module is executed.
On the execution of the module,the function 'F4IF_INT_TABLE_VALUE_REQUEST' populates the drop-down with the values in the internal table it_auart here.
thanks
mrutyun^
‎2008 Feb 11 11:00 AM
hi,
first write this in screen's flow logic after PAI...
PROCESS ON VALUE-REQUEST.
FIELD ifmtp-form_type MODULE fm_drop.
MODULE fm_drop INPUT.
CLEAR ifmtp.
REFRESH ifmtp.
ifmtp-form_type = 'C'.
APPEND ifmtp.
ifmtp-form_type = 'F'.
APPEND ifmtp.
ifmtp-form_type = 'H'.
APPEND ifmtp.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'FORM_TYPE'
value_org = 'S'
TABLES
value_tab = ifmtp.
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. " fm_drop INPUT
here ifmtp-form_type is my field which i have declared as listbox....
this is my dexlaration in TOP Module
DATA : BEGIN OF ifmtp OCCURS 0,
form_type LIKE zform_track_mast-form_type,
END OF ifmtp.
reward if usefull......