07-25-2007 4:26 PM
HI EXPERTS,
I AM USING VRM FM TO PUT VALUE INTO LIST BOX .THE VALUES ARE COMING BUT I CANNOT SELECT THE VALUES FROM THE LIST .WHAT MAY BE THE PROBLEM .
I AM USING THE BELOW CODE.
select POSNR from LIPS into corresponding fields of table i_pstyp WHERE VBELN EQ VBELN.
LOOP AT I_PSTYP .
W_DDLIST-TEXT = I_PSTYP-POSNR.
APPEND W_DDLIST TO POSNR.
CLEAR W_DDLIST.
ENDLOOP.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'POSNR'
VALUES = POSNR
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.
THANKS IN ADVANCE
MANI
07-26-2007 8:11 AM
I think you are not setting the "KEY", just the "TEXT" in your code ... see the example at:
<a href="http://help.sap.com/saphelp_46c/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/content.htm">http://help.sap.com/saphelp_46c/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/content.htm</a>
Maybe set KEY to the value of I_PSTYP-POSNR too.
07-25-2007 4:31 PM
Hi,
Please check demo program RSDEMO_DROPDOWN_LISTBOX for sample codes.
Regards,
Ferry Lianto
07-25-2007 4:33 PM
Check with below example code :
tables: tvdir.
Selection screento table View
selection-screen skip 2.
parameter p_tabnm(30) as listbox visible length 30 obligatory.
selection-screen skip 1.
selection-screen begin of block s1 with frame title text-001.
parameter: p_radio1 radiobutton group g1,
p_radio radiobutton group g1.
selection-screen end of block s1.
Add values to list box
at selection-screen output.
type-pools: vrm.
data: name type vrm_id,
list type vrm_values,
value like line of list.
name = 'P_TABNM'.
refresh list.
value-key = 'V_024'.
value-text = text-002. "'V_024-Purchasing Groups'.
append value to list.
value-key = 'V_T024D'.
value-text = text-003. "'V_T024D-MRP Controllers'.
append value to list.
value-key = 'ZT604'.
value-text = text-004. "'T604-Commodity Codes'.
append value to list.
value-key = 'T179'.
value-text = text-005. "'T179-Product Hierarchies'.
append value to list.
value-key = 'TVM1T'.
value-text = text-006. "'TVM1T-Business Manager'.
append value to list.
value-key = 'TVM2T'.
value-text = text-007. "'TVM2T-Division manager'.
append value to list.
value-key = 'TVM3T'.
value-text = text-008. "'TVM3T-Director'.
append value to list.
value-key = 'V_TVV2'.
value-text = text-009. "'V_TVV2-Customer Group 2'.
append value to list.
call function 'VRM_SET_VALUES'
exporting
id = name
values = list.
start-of-selection.
Get flag of corresponding table view
select single tabname flag from tvdir into tvdir
where tabname = p_tabnm.
Set flag of corresponding table view
if p_radio1 eq 'X'.
if tvdir-flag ne 'X'.
update tvdir set: flag = 'X'
where tabname = p_tabnm.
endif.
endif.
if p_radio eq 'X'.
if tvdir-flag eq 'X'.
update tvdir set: flag = ''
where tabname = p_tabnm.
endif.
endif.
Execute View/Table
call function 'VIEW_MAINTENANCE_CALL'
exporting
action = 'U'
view_name = p_tabnm
exceptions
client_reference = 1
foreign_lock = 2
invalid_action = 3
no_clientindependent_auth = 4
no_database_function = 5
no_editor_function = 6
no_show_auth = 7
no_tvdir_entry = 8
no_upd_auth = 9
only_show_allowed = 10
system_failure = 11
unknown_field_in_dba_sellist = 12
view_not_found = 13
others = 14.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
Reset flag of corresponding table view
update tvdir set: flag = tvdir-flag
where tabname = p_tabnm.
Thanks
Seshu
07-26-2007 8:11 AM
I think you are not setting the "KEY", just the "TEXT" in your code ... see the example at:
<a href="http://help.sap.com/saphelp_46c/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/content.htm">http://help.sap.com/saphelp_46c/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/content.htm</a>
Maybe set KEY to the value of I_PSTYP-POSNR too.
07-26-2007 8:26 AM
yes i have corrected it and it is woking now .
but when i select multiple entries the previous entries are also coming what to do for it?
07-26-2007 8:29 AM
07-26-2007 9:15 AM
hi ranjitha
i am using delivery doc number and in sy-ucomm whn enter
i am selecting the corresponding line item and material for it and saving .
when i am entering for the first time it is running correctly .without exiting if i enter some doc no the line items for the number comes along with the previous line items .so how to clear those values.????
07-26-2007 9:23 AM
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'POSNR'
values = posnr
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.
clear : posnr " use the clear to avoid repetetive values
Regards
Gopi
07-26-2007 10:09 AM
I suspect , you might have missed out to refresh/clear the itab you are using .
Regards,
Ranjita
07-26-2007 11:26 AM
thanx gopi and ranjitha
,,i have got it .hot to use table controls .
i have used it thru table control wizards is it advisible ?
in that method all the rows in the tables are displyed .if i want to filter it can i do ?
07-26-2007 11:34 AM
You are always welcome
Using table control wizard is not really advisable for a beginners level as, if you want any modifications then it will be difficult for understanding the system defined code and chaning them . So always try to create by your own codings.
Yes the filtering option can be added to table controls .
Regards,
Ranjita
07-26-2007 8:28 AM
hi ,
I think you might have not considered the VALUES-KEY and VALUES-TEXT fields of the ITAB VALUES . so , in your case fill the POSNR with the KEY and TEXT values and then use that in FM VRM_SET_VALUES . it should work ..
Regards,
Ranjita