07-29-2008 5:15 AM
hi,
I had made a report in which i have to display the list box option in which there will be 3 options . i had searched about it but i am not able to have examples of it which fulfill my requierment.
Can anybody provide me examples of it as i had never used list box.
07-29-2008 5:16 AM
Hi
[Example|http://www.sap-img.com/ab012.htm]
[Function Module|http://www.sap-img.com/abap/fm-vrm-set-value-to-list-box.htm]
Regards
Pavan
07-29-2008 5:18 AM
Hi,
Please refer the code below:
PARAMETERS:
listbox(1) AS LISTBOX VISIBLE LENGTH 10 DEFAULT 'N'.
AT SELECTION-SCREEN OUTPUT.
DATA:
name TYPE vrm_id,
list TYPE vrm_values,
value TYPE vrm_value.
name = 'LISTBOX'. " Name should be in UPPER CASE
value-key = '1'.
value-text = 'Text 1'.
APPEND value TO list.
value-key = '2'.
value-text = 'Text 2'.
APPEND value TO list.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = name
values = list
EXCEPTIONS
id_illegal_name = 0
OTHERS = 0.
Thanks,
Sriram Ponna.
07-29-2008 5:18 AM
Hi Ricx,
Check this example:
http://www.sap-img.com/ab012.htm
http://sap-abapinfo.blogspot.com/2008/05/alv-list-display-sample-code.html
Regards,
Chandra Sekhar
07-29-2008 5:19 AM
http://help.sap.com/saphelp_nw70/helpdata/en/e3/00db4269b2f340e10000000a1550b0/frameset.htm
http://www.howforge.com/how-to-create-parameter-as-listbox-in-abap-4
http://sap.niraj.tripod.com/id38.html
List Box in ABAP Report
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.
Hope this ex will help u..
07-29-2008 5:19 AM
Hi,
Here is the steps to create list box....
You can create according to ur need.. i hope this will help u..-
LIST BOX
Drop down list box can be created in a dialog screen(SE51) as well as selection screen.
The sap list box allows to select a value from the list but we cannot enter our own value in the list box .The value list that will be displayed consists of two
fields TEXT field of TYPE 80(C) and internal KEY field of TYPE 40(C).
In screen painter to create a input/output field into list box we use
'L" as a value for dropdown attribute for the i/o field.
In screen painter to determine the type of method that will be used to fill the value
list we use the attribute value list.
If it is blank the value list will be filled by the first column of the input help assigned to the screen field.This input help can be defined in the ABAP Dictionary, on screen using SELECT,VALUES screen statements or in event POV (PROCESS ON VALUE-REQUEST ) and the input help that will be passed to the field should consists of 2 columns ,the key column is filled automatically by the system.SAP recommends value list field should be blank.
or
The value can be 'A' meaning that the value list will be filled in the event PBO(PROCESS BEFORE OUTPUT) or before the screen is displayed.In this method we use function module VRM_SET_VALUES to fill the values and pass it to the i/o field.
If a function code is attached to the list box the selection of a value triggers a PAI
otherwise PAI will not trigger.
LIST BOX in SELECTION SCREEN
List Box is created in selection screen using PARAMETERS staement
with AS LISTBOX addition other attributes like VISIBLE LENGTH (width of listbox)
can be specified with the declaration.
PARAMETERS name(n) AS LISTBOX VISIBLE LENGTH n.
Here n is an integer and name is the name of parameter.
To populate the value list we use the FM VRM_SET_VALUES and the
selection screen event AT SELECTION-SCREEN OUTPUT is used to write the code to fill it.
VRM_SET_VALUES
The function module VRM_SET_VALUES is used to fill the value list associated with a List Box .This FM uses types which are declared in type group VRM. So
we should declare TYPE-POOLS VRM before using this FM.
Some important types declared in the VRM type group are
VRM_ID
It refers to the name of the input/output field associated with list box
VRM_VALUES
It refers to the internal table consisting of two fields TEXT(80C) and KEY(40)C
that will be used to create the list values.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = name of screen element ,it is of TYPE VRM_ID
VALUES = internal table containing values,of TYPE VRM_VALUES
LIST BOX with value list from input help
In this example the screen element attribute value list is set to blank as such the value list will be filled with the 1st column of the input help,We use PROCESS ON VALUE-REQUEST event to pass the value list to the listbox.In the MODULE call used to fill the value list we can use FM like F4IF_INT_TABLE_VALUE_REQUEST to create input help as explained in the input help.The value of first column will be shown in the field when selected.
PROCESS ON VALUE-REQUEST
FIELD list MODULE fill_list_100
FIELD list MODULE fill_list_100 INPUT
SELECT f1 f2 FROM table INTO int
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'input/output screen field'
value_org = 'S'
TABLES
value_tab = itab "it contains 2 fields that will be shown in the list box
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
...
ENDIF.
ENDMODULE.
VALUE LIST CREATED IN PBO
In this method we set the value list attribute to 'A'.The value list will be filled in the PBO by using FM VRM_SET_VALUES .
TYPE-POOLS : VRM
DATA : field_id TYPE VRM_ID ,
values TYPE VRM_VALUES,
value LIKE LINE OF values.
PROCESS BEFORE OUTPUT
MODULE list_fill_100
MODULE list_fill_100 OUTPUT
SELECT f1 f2 f3 FROM tab WHERE condition.
value-KEY = f1.
value-TEXT = f2
APPEND value TO VALUES
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'i/o screen field'
values = values.
ENDMODULE.
LIST BOX with Selection Screen
For this the FM VRM_SET_VALUES is used to fill the value table and is passed to the parameter created with TYPE LISTBOX in the selection screen event
AT SELECTION-SCREEN.
PROGRAM zlist
TYPE-POOLS : VRM.
DATA: param TYPE vrm_id,
values TYPE vrm_values,
value LIKE LINE OF values.
PARAMETERS: p_name(10) AS LISTBOX VISIBLE LENGTH 10.
AT SELECTION-SCREEN OUTPUT.
param = 'P_NAME'.
value-key = '1'.
value-text = 'JOHN'.
APPEND value TO values.
value-key = '2'.
value-text = 'PETER'.
APPEND value TO values.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING id = param
values = values.
Thanks & Regards
Ashu Singh.
07-29-2008 5:20 AM
07-29-2008 5:20 AM
07-29-2008 5:21 AM
Hi
[http://www.sapabapsdmm.com/ABAPReportingPage24.htm]
Regards,
Sravanthi
07-29-2008 5:22 AM
hi,
Try this link.
http://help.sap.com/saphelp_nw04/helpdata/en/33/ae0d4113eff16fe10000000a1550b0/content.htm
http://sap.niraj.tripod.com/id38.html
Regards
Sumit Agarwal
07-29-2008 5:30 AM
Hi Ricx.
I would like to suggest a demo program for Drop down list box example - DEMO_DYNPRO_DROPDOWN_LISTBOX
I would like to suggest a couple of references, as it is similar to your case,
[SDN - Reference for Dropdown list display in module pool|;
[SDN - Standard Reference for How to use the List Box selector in Xcelsius |https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do]
[SDN - Reference for list box display on selection screen|;
[SDN - Reference for Drop Down list box for Select-Options|;
Hope that's usefull.
Good Luck & Regards.
Harsh Dave
07-29-2008 5:33 AM
Hi
Good
If you want to display the dropdown list box in your selection screen than below code will help you in that.
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.
Thanks
mrutyun^
07-29-2008 6:11 AM
hi,
i had tried to do it in my code but it is not working as when i execute it
it does not show any field text at time of output.
*Actually my logic is stored in the variables like P,F and T....which are there in the Switch statement i.e. when it is F the it will execute
whole output,if it is 'P' then it will display the 'minimum values output' and when it is 'T' then it will display maximum level out put' *
here 's d part of code for list box i am using :-
TYPE-POOLS: VRM.
DATA: NAME TYPE VRM_ID,
LIST TYPE VRM_VALUES,
VALUE LIKE LINE OF LIST.
data: p_mark type c.
PARAMETERS: PS_PARM(10) AS LISTBOX VISIBLE LENGTH 20.
AT SELECTION-SCREEN OUTPUT.
NAME = 'PS_PARM'.
VALUE-KEY = 'F'.
VALUE-TEXT = 'All Materials'.
APPEND VALUE TO LIST.
VALUE-KEY = 'P'.
VALUE-TEXT = 'Maximum Level'.
APPEND VALUE TO LIST.
VALUE-KEY = 'T'.
VALUE-TEXT = 'Minimum Level'.
APPEND VALUE TO LIST.
CALL FUNCTION 'VRM_SET_VALUES' EXPORTING ID = NAME VALUES = LIST.
start-of-selection.
WRITE: / 'PARAMETER:', PS_PARM.
plzz provide me guidelines is solving the problem.........
Edited by: ricx .s on Jul 29, 2008 7:55 AM
07-29-2008 7:49 AM
i had to close this thread as my requirement is not able to be full filled.