Application Development 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: 

Listbox problem in Table control

Former Member
0 Kudos

Hi all,

I've a table control, that I fill with data from a table.

When the UI field in the table contains "SINGLE01", "SINGLE02", ... I will need to add a listbox to the tablecontrol.

01 for first listbox, 02 for second listbox, ...

It works but when I have more listboxes in 1 tablecontrol, I have 1 problem.

All the values (from Listbox 1, 2 and ...) will be visible in all listboxes.

I fill the listbox with FM CALL FUNCTION 'VRM_SET_VALUES'

Listbox field: ITAB_SINGLE_TEL-VALUE

I my example: I have 2 listboxes.

Reduction and promo, but all values are visible in the first listbox and in the second listbox.

[Example|http://www.verreydt.eu/listbox.jpg]

How can I make sure that I have only the values from listbox 1 (in table with UI field SINGLE01) in the first listbox and only the values from listbox 2 (in table with UI field SINGLE02) in the second listbox.

Remark: I don't know how many listboxes I will have when I create/start the program, It depends how many data is available in the table.

Kind regards,

Hans

1 ACCEPTED SOLUTION

Former Member
0 Kudos

vrm_values1-key = 'a'.

vrm_values1-text = 'sap'.

APPEND vrm_values1 TO t_table.

vrm_values1-key = '2'.

vrm_values1-text = 'testing'.

APPEND vrm_values1 TO t_table.

vrm_values1-key = '2'.

vrm_values1-text = 'java'.

APPEND vrm_values1 TO t_table.

vrm_values1-key = '4'.

vrm_values1-text = '.net'.

APPEND vrm_values1 TO t_table.

vrm_values1-key = '5'.

vrm_values1-text = 'vc++'.

APPEND vrm_values1 TO t_table.

vrm_values1-key = 'che'.

vrm_values1-text = 'chetta-ram'.

APPEND vrm_values1 TO t_table.

clear vrm_values1.

*clear t_table.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'single1'

values = t_table

EXCEPTIONS

ID_ILLEGAL_NAME = 1

OTHERS = 2.

vrm_values2-key = 'a'.

vrm_values2-text = 'sap'.

APPEND vrm_values2 TO t_table1.

vrm_values2-key = '2'.

vrm_values2-text = 'testing'.

APPEND vrm_values2 TO t_table1.

vrm_values2-key = '2'.

vrm_values2-text = 'java'.

APPEND vrm_values1 TO t_table1.

vrm_values2-key = '4'.

vrm_values2-text = '.net'.

APPEND vrm_values2 TO t_table1.

vrm_values2-key = '5'.

vrm_values2-text = 'vc++'.

APPEND vrm_values2 TO t_table1.

vrm_values2-key = 'che'.

vrm_values2-text = 'chetta-ram'.

APPEND vrm_values2 TO t_table1.

clear vrm_values2.

*clear t_table1.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'SINGLE2'

values = t_table1[]

EXCEPTIONS

ID_ILLEGAL_NAME = 1

OTHERS = 2.

5 REPLIES 5

Former Member
0 Kudos

vrm_values1-key = 'a'.

vrm_values1-text = 'sap'.

APPEND vrm_values1 TO t_table.

vrm_values1-key = '2'.

vrm_values1-text = 'testing'.

APPEND vrm_values1 TO t_table.

vrm_values1-key = '2'.

vrm_values1-text = 'java'.

APPEND vrm_values1 TO t_table.

vrm_values1-key = '4'.

vrm_values1-text = '.net'.

APPEND vrm_values1 TO t_table.

vrm_values1-key = '5'.

vrm_values1-text = 'vc++'.

APPEND vrm_values1 TO t_table.

vrm_values1-key = 'che'.

vrm_values1-text = 'chetta-ram'.

APPEND vrm_values1 TO t_table.

clear vrm_values1.

*clear t_table.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'single1'

values = t_table

EXCEPTIONS

ID_ILLEGAL_NAME = 1

OTHERS = 2.

vrm_values2-key = 'a'.

vrm_values2-text = 'sap'.

APPEND vrm_values2 TO t_table1.

vrm_values2-key = '2'.

vrm_values2-text = 'testing'.

APPEND vrm_values2 TO t_table1.

vrm_values2-key = '2'.

vrm_values2-text = 'java'.

APPEND vrm_values1 TO t_table1.

vrm_values2-key = '4'.

vrm_values2-text = '.net'.

APPEND vrm_values2 TO t_table1.

vrm_values2-key = '5'.

vrm_values2-text = 'vc++'.

APPEND vrm_values2 TO t_table1.

vrm_values2-key = 'che'.

vrm_values2-text = 'chetta-ram'.

APPEND vrm_values2 TO t_table1.

clear vrm_values2.

*clear t_table1.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'SINGLE2'

values = t_table1[]

EXCEPTIONS

ID_ILLEGAL_NAME = 1

OTHERS = 2.

0 Kudos

My function module:

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = 'ITAB_SINGLE_TEL-VALUE'

VALUES = VALUES2.

'ITAB_SINGLE_TEL-VALUE' = field from Table control.

My current code:

IF ITAB_CONF_ITEM IS NOT INITIAL.

LOOP AT ITAB_CONF_ITEM.

ITAB_SINGLE_TEL-DESCRIPTION = ITAB_CONF_ITEM-ZLABEL.

VALUE-KEY = ITAB_CONF_ITEM-VALUE.

VALUE-TEXT = ITAB_CONF_ITEM-DESCRIPTION.

APPEND VALUE TO VALUES2.

ITAB_SINGLE_TEL-ID = ITAB_CONF_ITEM-ID.

ITAB_SINGLE_TEL-UI_TYPE = UI_TYPE.

" To set default checked value from table

ID = ITAB_SINGLE_TEL-ID.

SHIFT ID LEFT DELETING LEADING '0'.

V_START = ID - 1.

IF PACK_TYPE IS NOT INITIAL.

READ TABLE ITAB_CONF_DFLT WITH KEY CFG_TYPE = P_CFG_TYPE PACK_TYPE = PACK_TYPE.

IF ITAB_CONF_DFLT-CONFIG_STRING+V_START(1) EQ 'X'.

ITAB_SINGLE_TEL-VALUE = ITAB_CONF_ITEM-DESCRIPTION.

ENDIF.

ENDIF.

" To set default checked value from table

APPEND ITAB_SINGLE_TEL.

ENDLOOP.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = 'ITAB_SINGLE_TEL-VALUE'

VALUES = VALUES2.

ELSE.

EXIT FROM STEP-LOOP.

ENDIF.*

Edited by: Hans Verreydt on Oct 15, 2008 11:35 AM

0 Kudos

HAI,

IN PBO

with in loop at i.tab with controls <t.c.name>

module fill_listbox.

endloop.

in initilization event.

fill 2 different internal table (t_table1, t_table2) for field 1,2.

module fill_listbox.

**for first field**

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'P_MATKL'

values = t_table1[]

EXCEPTIONS

ID_ILLEGAL_NAME = 1

OTHERS = 2.

**for second field**

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'P_MATKL'

values = t_table2[]

EXCEPTIONS

ID_ILLEGAL_NAME = 1

OTHERS = 2.

endmodule.

0 Kudos

And what If I need 5 listboxes? or more?

Because I don't know how many listboxes I will have. 1 or 10? or?

It depends on the data in our Table. If I have data with UI field SINGLE03 or SINGLE04, 05, 06, ... I will have more then 2 listboxes

0 Kudos

hai,

as per my knowledge we have to declare sep for every list box........

shan.