10-22-2005 12:27 PM
hi,
i am using a table control to view data in a table, on a screen. one of the field(columns) needs to be a list box with only pre available data. how do i populate the listbox in the table.
can anyone help me here...
kiran
10-22-2005 12:32 PM
Hi,
You can use function module VRM_SET_VALUES for this.
Write the code in a PROCESS ON VALUE-REQUEST module in the screen for the field.
PROCESS ON VALUE-REQUEST.
FIELD <your field name> MODULE VALUES_SET.
Declare the TYPE-GROUP in the TOP include,
TYPE-POOLS VRM.
And then in the module write the following logic,
*********************
MODULE values_set.
DATA: t_values TYPE vrm_values WITH HEADER LINE.
t_values-key = '1'.
t_values-text = 'abc'.
APPEND t_values.
t_values-key = '2'.
t_values-text = 'syz'.
APPEND t_values.
t_values-key = '3'.
t_values-text = 'fst'.
APPEND t_values.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = <your field name>
values = t_values[]
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.
ENDMODULE.
Sri
Message was edited by: Srikanth Pinnamaneni
10-22-2005 12:32 PM
Hi,
You can use function module VRM_SET_VALUES for this.
Write the code in a PROCESS ON VALUE-REQUEST module in the screen for the field.
PROCESS ON VALUE-REQUEST.
FIELD <your field name> MODULE VALUES_SET.
Declare the TYPE-GROUP in the TOP include,
TYPE-POOLS VRM.
And then in the module write the following logic,
*********************
MODULE values_set.
DATA: t_values TYPE vrm_values WITH HEADER LINE.
t_values-key = '1'.
t_values-text = 'abc'.
APPEND t_values.
t_values-key = '2'.
t_values-text = 'syz'.
APPEND t_values.
t_values-key = '3'.
t_values-text = 'fst'.
APPEND t_values.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = <your field name>
values = t_values[]
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.
ENDMODULE.
Sri
Message was edited by: Srikanth Pinnamaneni
10-22-2005 12:48 PM
thanxs for replying srikanth,
but where does this process on value-request come...befor PAI or after...its saying i should loop the field...already i am loop it for modification...
pls advice..
kiran
10-22-2005 12:51 PM
Hi Kiran,
This is general Flow Logic,
PROCESS BEFORE OUTPUT.
MODULE ...
LOOP...
ENDLOOP.
PROCESS AFTER INPUT.
MODULE ...
LOOP...
MODULE ...
ENDLOOP.
.....
PROCESS ON VALUE-REQUEST.
FIELD <your field> MODULE values_set.
POV is always the last flow logic event..
Hope this helps..and please dont forget to award points like most others do..
Sri
Message was edited by: Srikanth Pinnamaneni
10-22-2005 12:58 PM
Hi
You should insert the module VALUES_SET in PBO process.
PROCESS PBO
MODULE VALUES_SET.
By screen painter you have to set the field attribut to display the data as list box.
Max
10-22-2005 1:03 PM
i tried your code..but it is not working...do i have to do some settings in the table...the field i needed to be a list box, i went and changed in the element list of the screen painter...isthere any other settings...
thanx for helping..
kiran
10-22-2005 1:05 PM
Hi kiran,
Is it possible for you to post your code here? Your Flow Logic code in the screen and also the MODULE values_set code.
I hope you have change the field attribute to Listbox as MAX suggested..
Sri
10-22-2005 1:10 PM
Hi
1. Go to screen painter, do double click on your field,
set the attribute DROPDOWN with 'LIST BOX'.
2. Create your PBO module to load tha data in list box:
MODULE LIST_BOX.
REFRESH T_VALUES.
t_values-key = '1'.
t_values-text = 'abc'.
APPEND t_values.
t_values-key = '2'.
t_values-text = 'syz'.
APPEND t_values.
t_values-key = '3'.
t_values-text = 'fst'.
APPEND t_values.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = <THE NAME OF SCREEN FIELD>
values = t_values[]
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.
ENDMODULE.
ENDMODULE.
Message was edited by: max bianchi
10-22-2005 1:12 PM
flow logic:
PROCESS BEFORE OUTPUT.
MODULE pf_status.
MODULE table_control_change_tc_attr.
LOOP AT itab
WITH CONTROL table_control
CURSOR table_control-current_line.
ENDLOOP.
MODULE table_control1_change_tc_attr.
LOOP AT itab1
INTO zguage1
WITH CONTROL table_control1
CURSOR table_control1-current_line.
ENDLOOP.
MODULE values_set.
PROCESS AFTER INPUT.
MODULE pai_100.
LOOP AT itab.
CHAIN.
FIELD itab-description.
FIELD itab-specification.
FIELD itab-observation.
FIELD itab-acc.
FIELD itab-remark.
MODULE table_control_modify ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
*PROCESS ON VALUE-REQUEST.
LOOP AT itab1.
CHAIN.
FIELD zguage1-calib_on.
FIELD zguage1-a.
FIELD zguage1-b.
FIELD zguage1-c.
FIELD zguage1-d.
FIELD zguage1-e.
FIELD zguage1-f.
FIELD zguage1-g.
FIELD zguage1-h.
FIELD zguage1-i.
FIELD zguage1-j.
FIELD zguage1-k.
FIELD zguage1-l.
FIELD zguage1-m.
FIELD zguage1-n.
FIELD zguage1-o.
FIELD zguage1-p.
FIELD zguage1-q.
FIELD zguage1-usage_dec.
FIELD zguage1-cal_by.
FIELD zguage1-next_due.
MODULE table_control1_modify ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
PROCESS ON VALUE-REQUEST.
FIELD zguage1-usage_dec MODULE values_set.
10-22-2005 1:13 PM
----
MODULE values_set INPUT
----
*
----
MODULE values_set INPUT.
DATA: t_values TYPE vrm_values WITH HEADER LINE.
t_values-key = '1'.
t_values-text = 'Accepted'.
APPEND t_values.
t_values-key = '2'.
t_values-text = 'Rejected'.
APPEND t_values.
t_values-key = '3'.
t_values-text = 'Modified'.
APPEND t_values.
t_values-key = '4'.
t_values-text = 'Rework'.
APPEND t_values.
t_values-key = '5'.
t_values-text = 'Not in Use'.
APPEND t_values.
t_values-key = '6'.
t_values-text = 'Engg. Changed'.
APPEND t_values.
t_values-key = '7'.
t_values-text = 'Stock'.
APPEND t_values.
t_values-key = '8'.
t_values-text = 'Scrap'.
APPEND t_values.
t_values-key = '9'.
t_values-text = 'Services'.
APPEND t_values.
t_values-key = '10'.
t_values-text = 'Sub-Contract'.
APPEND t_values.
t_values-key = '11'.
t_values-text = 'Lost'.
APPEND t_values.
t_values-key = '12'.
t_values-text = 'Broken'.
APPEND t_values.
t_values-key = '13'.
t_values-text = 'Others'.
APPEND t_values.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = zguage1-usage_dec
values = t_values[]
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.
ENDMODULE. "values_set INPUT
10-22-2005 1:15 PM
Hi Kiran,
Here is the mistake,
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
<b>id = zguage1-usage_dec -->wrong[/b>]
<b> Change this to
id = 'ZGUAGE1-USAGE_DEC'</b>
values = t_values[]
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.
Also no need to code in PBO and also in PROCESS ON VALUE-REQUEST.
Try removing it in PBO and just keep it in POV and see what happens...
so the correct code looks like,
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
<b>id = 'ZGUAGE1-USAGE_DEC'</b>
values = t_values[]
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.
Hope this helps..
Sri
Message was edited by: Srikanth Pinnamaneni
10-22-2005 1:16 PM
Hi
PROCESS BEFORE OUTPUT.
MODULE pf_status.
MODULE values_set. <----
MODULE table_control_change_tc_attr.
LOOP AT itab
WITH CONTROL table_control
CURSOR table_control-current_line.
ENDLOOP.
MODULE table_control1_change_tc_attr.
LOOP AT itab1
INTO zguage1
WITH CONTROL table_control1
CURSOR table_control1-current_line.
ENDLOOP.
************NO!!!!!!!!!!!!!!!!!!!!!!!!***************
****PROCESS ON VALUE-REQUEST.
*****FIELD zguage1-usage_dec MODULE values_set.
MODULE VALUES_SET.
REFRESH T_VALUES.
t_values-key = '1'.
t_values-text = 'abc'.
APPEND t_values.
t_values-key = '2'.
t_values-text = 'syz'.
APPEND t_values.
t_values-key = '3'.
t_values-text = 'fst'.
APPEND t_values.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'ZGUAGE1-USAGE_DEC'
values = t_values[]
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.
ENDMODULE.
Message was edited by: max bianchi
10-22-2005 1:20 PM
hurray its comming...thanxs a lot guys..
you ppl r Geniuses...am saved...spend a lot of time over today...u deserve all the points..
kiran
10-22-2005 1:39 PM
Hi Sri
I've never used your way, but I suppose it works.
I always manage a drpdown list in PBO (not in POV), probably becase I saw it.
Anyway all these two method are right see the program RSDEMO_DROPDOWN_LISTBOX.
Max
10-22-2005 1:49 PM
Hi Max,
Yes. Both the methods work.
I am used to coding it in POV always.
Also this demo program RSDEMO_DROPDOWN_LISTBOX is useful.
May be we should start suggesting this program from now onwards for posts on list boxes..
Good find !!
And THANKS !! Kiran for points..
Sri
Message was edited by: Srikanth Pinnamaneni