Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

PROBLEM IN USING VRM SET VALUE FM

Former Member
0 Likes
3,102

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,623

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.

11 REPLIES 11
Read only

ferry_lianto
Active Contributor
0 Likes
1,623

Hi,

Please check demo program RSDEMO_DROPDOWN_LISTBOX for sample codes.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
1,623

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

Read only

Former Member
0 Likes
1,624

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.

Read only

0 Likes
1,623

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?

Read only

0 Likes
1,623

please be more clearer....

Read only

0 Likes
1,623

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.????

Read only

0 Likes
1,623
  
  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

Read only

0 Likes
1,623

I suspect , you might have missed out to refresh/clear the itab you are using .

Regards,

Ranjita

Read only

0 Likes
1,623

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 ?

Read only

0 Likes
1,623

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

Read only

former_member196299
Active Contributor
0 Likes
1,623

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