‎2008 Feb 22 4:27 AM
hi,
I m working screens. i have to add listbox on
the screen with the possible entries like
HR, IT, SCM, MKT, ADMIN, SAP, Others etc. for the Department.
I have to add all these entries from ABAP program not from Dictionary.
how can i do this? Plz give me the steps...
thanks.
‎2008 Feb 22 4:32 AM
Create a domain for which u want to assign this list box. Go to value range and enter the values. Now assign this domain to data element to screen parameter for which list box is to be attached.
Hope it helps.
anya
‎2008 Feb 22 5:02 AM
Hi,
Decalre
TYPE-POOLS: vrm.
DATA: ws_name TYPE vrm_id,
ws_list TYPE vrm_values,
ws_value LIKE LINE OF ws_list,
ws_name2 TYPE vrm_id.
IN PBO module.
REFRESH : ws_list.
**--Assigning the values for Task Code
ws_value-key = '1'.
ws_value-text = 'HR'.
APPEND ws_value TO ws_list.
ws_value-key = '2'.
ws_value-text = 'IT'.
APPEND ws_value TO ws_list.
ws_value-key = '1'.
ws_value-text = 'SCM'.
APPEND ws_value TO ws_list.
ws_value-key = '2'.
ws_value-text = 'MKT'.
APPEND ws_value TO ws_list.
ws_name = INput field name of LISTbox .
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = ws_name
values = ws_list
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
‎2008 Feb 22 5:04 AM
hi,
In the PBO module of the screen u need to use the FM
'VRM_SET_VALUES'. below is an example of this,
Declaration in the top include:
type-pools vrm.
data : wi_vrm type vrm_values.
data :wa_vrm like line of wi_vrm.
CODE in PBO:
a = 0.
wa_vrm-key = 'CURRENT'.
wa_vrm-text = 'CURRENT ACCOUNT'.
append wa_vrm to wi_vrm.
wa_vrm-key = 'SAVINGS'.
wa_vrm-text = 'SAVINGS ACCOUNT'.
append wa_vrm to wi_vrm.
a = 1.
call function 'VRM_SET_VALUES'
exporting
id = 'zacc_master2-zacctype'
values = wi_vrm
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.
Here, wa_vrm-key is to give serial number or so and wa_vrm-text is the description for ur requirement it is HR IT SCM...etc
Hope this helps u,
Regards,
Arunsri
‎2008 Feb 22 5:08 AM
Anek,
Try like this,
itab-f1 = 'HR'.
itab-f1 = 'IT'.
itab-f1 = 'SCM'.
itab-f1 = 'ADMIN'.
itab-f1 = 'SAP'.
append itab.
move-corresponding : itab to p0009 screenfield ( strcure field )
Then call,
data: i0009 type p0009.
data : innnn like prelp.
*Get the screen data into structure i0009
call method cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
exporting
prelp = innnn
importing
pnnnn = i0009.
if sy-subrc = 0.
*Get the screen data into structure i0009
call method cl_hr_pnnnn_type_cast=>pnnnn_to_prelp
exporting
pnnnn = i9000
importing
prelp = innnn.
commit work.
endif.
Then it work.
Regards,
N.L.Narayana
‎2008 Feb 22 6:24 AM
Hi,
1. Create MPP program.
2. Create a screen.
3. Add a input box -> Double click -> Specify name (IO1) -> Select LISTBOX from the dropdown list -> A dropdown facility is added for the input field in the screen.
4. Create two pushbuttons (PRINT, EXIT).
5. In Top Include File, specify following code:
TYPE-POOLS VRM.
DATA IO1(20).
DATA A TYPE I.
DATA ITAB TYPE VRM_VALUES. * To create an internal table of an existing type
DATA WA LIKE LINE OF ITAB. * To create a temporary structure of same line type of internal table.
6. In PBO, specify following code:
IF A = 0.
WA-KEY = 'ABAP'.
WA-TEXT = 'ADVANCED PROGRAMMING'.
APPEND WA TO ITAB.
WA-KEY = 'BW'.
WA-TEXT = 'BUSINESS WAREHOUSING'.
APPEND WA TO ITAB.
WA-KEY = 'EP'.
WA-TEXT = 'ENTERPRISE PORTAL'.
APPEND WA TO ITAB.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'IO1'
VALUES = ITAB.
A = 1.
ENDIF.
7. In PAI, specify following:
CASE SY-UCOMM.
WHEN 'PRINT'.
LEAVE TO LIST-PROCESSING.
WRITE 😕 IO1.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
8. Create a Tcode -> Activate all -> Execute.
hope it will be useful.
Regards,
Priya.
‎2008 Feb 22 6:28 AM
Hi
Create a domain of ur required type.Then in the value range give the values u want to find in listbox.Then while defining attributes specify dropdown as listbox.Then the drop down will contain the desired value.
U can use VRM also.But creating the domain will be the easier way i suppose.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 22, 2008 6:09 PM