2008 Feb 18 7:52 AM
How to populate list box in module pool program.
Please give me reply as soon as posible
regards,
Venu.
How to populate list box in module pool program.
Please give me reply as soon as posible
regards,
Venu.
2008 Feb 18 7:58 AM
2008 Feb 18 8:03 AM
use the following code
** field to which values needs to be set
WL_NAME = 'ZVSV_SCH_DATE-RCODE'.
** Values To be set in list box
WL_VALUE-KEY = 'Z01'.
IF SY-LANGU = 'F'. " French
WL_VALUE-TEXT = 'Modification Usine'.
ELSE.
WL_VALUE-TEXT = 'Factory Decision'.
ENDIF.
APPEND WL_VALUE TO WL_LIST.
*
WL_VALUE-KEY = 'Z02'.
IF SY-LANGU = 'F'.
WL_VALUE-TEXT = 'Modification Client'.
ELSE.
WL_VALUE-TEXT = 'Customer Request'.
ENDIF.
APPEND WL_VALUE TO WL_LIST.
** Calling the FM to Set the Values.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = WL_NAME
VALUES = WL_LIST.
Hope That Helps
Anirban M.
2008 Feb 18 8:05 AM
Hi,
use this
Use the below code.
TYPE-POOLS : VRM.
DATA : VAL TYPE VRM_VALUES.
DATA : DROPDOWN LIKE LINE OF VAL.
DROPDOWN-TEXT = 'Ticket Booking'.
APPEND DROPDOWN TO VAL.
DROPDOWN-TEXT = 'Electricity Bill Payment'.
APPEND DROPDOWN TO VAL.
DROPDOWN-TEXT = 'Telephone Bill Payment'.
APPEND DROPDOWN TO VAL.
DROPDOWN-TEXT = 'E-Shop'.
APPEND DROPDOWN TO VAL.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'CREDITUSAGE' /////// Your list box name.....
VALUES = VAL
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
reward if helpful,
kushagra
2008 Feb 18 8:23 AM
Hi Venugopal,
To populate the dropdown list use the below code.
__________________________________________________
TYPE-POOLS : VRM.
DATA : VAL TYPE VRM_VALUES.
DATA : DROPDOWN LIKE LINE OF VAL.
//DROPDOWN-KEY is a unique value in your dropdown list. While fetching the value from the dropdown list
//the key value will be obtained. So you can directly pass the text onto the key as shown below, this will be helpful while retrieving value from the drop down list.
//Note: For fetching the selected value from the dropdown list dynamically from your program,
//you have to set the Value List attribute to 'A' for the listbox (Screen Painter attribute)
DROPDOWN-KEY = 'Electricity Bill Payment'.
DROPDOWN-TEXT = ''.
APPEND DROPDOWN TO VAL.
DROPDOWN-KEY = 'Ticket Booking'.
DROPDOWN-TEXT = ''.
APPEND DROPDOWN TO VAL.
DROPDOWN-KEY = 'Telephone Bill Payment'.
DROPDOWN-TEXT = ''.
APPEND DROPDOWN TO VAL.
DROPDOWN-KEY = 'Shop Card'.
DROPDOWN-TEXT = ''.
APPEND DROPDOWN TO VAL.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'USED'
VALUES = VAL
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
_______________________________________________________
If you have any queries reply me.
Thanks
Anand D
2008 Feb 18 8:31 AM
Hi,
You can use the function module VRM_SET_VALUES.
Pls refer to the sample program demo_dynpro_dropdown_listbox to learn its usage.
Regards,
Renjith Michael.
2008 Feb 18 8:40 AM
Hi ,,
I have seen the Asnwe given by the user all are good and adovatable.
but I have one more seperate idea .But it is use full when you have item in list Box are fixed not change on the basic of user entry.
Create One Fieds domain for the fields and in the Fields domain there is one tabe Value range Define your fields there itself.
In the design of module pool there is one text box Name as List ,Select the type List box there .. it will work.
regards
Swati
2008 Feb 18 8:58 AM
hi,
go thrugh the folling code .
TABLES sdyn_conn.
DATA ok_code TYPE sy-ucomm.
Global data
TYPES: BEGIN OF type_carrid,
carrid type spfli-carrid,
carrname type scarr-carrname,
END OF type_carrid.
DATA itab_carrid TYPE STANDARD TABLE OF type_carrid.
&----
*& Processing Blocks called by the Runtime Environment *
&----
Event Block START-OF-SELECTION
START-OF-SELECTION.
CALL SCREEN 100.
Dialog Module PBO
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
ENDMODULE.
Dialog Modules PAI
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
*
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'SELECTED'.
MESSAGE i888(sabapdocu) WITH sdyn_conn-carrid.
ENDCASE.
ENDMODULE.
Dialog Module POV
MODULE create_dropdown_box INPUT.
SELECT carrid carrname
FROM scarr
INTO CORRESPONDING FIELDS OF TABLE itab_carrid.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'CARRID'
value_org = 'S'
TABLES
value_tab = itab_carrid
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
...
ENDIF.
ENDMODULE.
the following code should be included in flow logic of screen
process on value-request.
field scarr-carrname module create_dropdown_box.
in module pool select list box.
hope it is useful.
regards,
sreelakshmi.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |