12-26-2007 2:16 AM
I have this problem with my table control.
I have a Reference Table Input help and I need to populate the values from the selected table names(selected from the input help) into the table control's dropdownbox of my first column with the respective table fields of the selected table name displayed.
Refer to this diagram if unclear: [http://img166.imageshack.us/img166/1066/tablecontrolwt4.png]
Please give me sample codes.
thanks.
will reward marks if useful.
12-26-2007 5:12 AM
Hi,
1. Just make an internal table with all the fields reqired from diffrent tables and populate those into that table.
for eg,
Note: this is just to give you some clear idea.
&----
*& D A T A D E C L A R A T I O N F O R T Y P E P O O L V R M
&----
TYPE-POOLS: vrm.
*-- Structure that contains values for creating drop box
TYPES: BEGIN OF t_dd07t,
domname TYPE domname, "Domain name
ddlanguage TYPE ddlanguage, "Language Key
valpos TYPE valpos, "Domain value key
ddtext TYPE val_text, "Short text for fixed values
domvalue_l TYPE domvalue_l, "Values for Domains: Single Value / Upper Limit
END OF t_dd07t.
*-- Declaration of Internal table and work area for creating the drop down box,
*-- Declaration for screen fields purchase order number,purchase order details,
*-- Declaration for movement types,Special Stock Indicator.
DATA: it_dd07t TYPE STANDARD TABLE OF t_dd07t,
wa_dd07t TYPE t_dd07t,
The below is ver important structure which is useful in creating the listbox.
*-- Single Value in Value Set
TYPES: BEGIN OF vrm_value,
key(40) TYPE c,
text(80) TYPE c,
END OF vrm_value.
*-- Table of Values
DATA: vrm_values TYPE vrm_values." WITH HEADER LINE.
*-- Work area for Table of Values
DATA: wa_values TYPE LINE OF vrm_values
2. Now select all the required data into the internal table.
for eg,
SELECT SINGLE domname
ddlanguage
valpos
ddtext
domvalue_l INTO wa_dd07t
FROM dd07t
WHERE valpos = value
AND ddlanguage = 'EN'
AND domname = 'GOACTION'.
APPEND wa_dd07t TO it_dd07t.
3. Move those values into the vrm_values table and append.
for eg,
LOOP AT it_dd07t INTO wa_dd07t.
MOVE: wa_dd07t-domvalue_l TO wa_values-key,
wa_dd07t-ddtext TO wa_values-text.
APPEND wa_values TO vrm_values.
*-- clearing and refreshing the respective variables and internal tables
CLEAR: wa_dd07t,
wa_values.
ENDLOOP.
4. pass these values in the function module 'VRM_SET_VALUES'.
foe eg,
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'WA_VALUES-TEXT'
values = vrm_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.
4. Use the field 'WA_VALUES-TEXT' as the screen field of the first column of the table control you will get the exact output.
Edited by: jagannathan krishnan on Dec 26, 2007 6:19 AM
12-26-2007 5:32 AM
HI
can u little bit clear i am not getting u r questio i think i have the sample code of u r requirment if u explain it clealry i might help u
12-26-2007 6:04 AM
1. Select reference table (input help)
2. Populate the values inside table control
3. One of my column of my table control is dropdownlist and it will display the values of the fields of the value of my reference table
Post the codes if you can understand.