‎2007 Dec 26 2:10 AM
Hi,can someone help me with this problem...
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 with the respective table fields 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.
Edited by: Evonne Gow on Dec 26, 2007 3:11 AM
‎2007 Dec 26 6:09 AM
Hai,
Use CASE and ENDCASE stament for that Reference Table parameter.
Get the Ref.Table name into a variable.
Now:
case reftabname.
when 'ZDM_A_CCO'.
perform select_database_values using reftabname field1 field2 ..
changing it_tabc.
when 'ZDM_B_CCO'.
perform select_database_values using reftabname field1 field2 ..
changing it_tabc.
endcase.
To build WHERE clause dynamically, use function module: DYNSQL_GENERATE_WHERE_CLAUSE
under each WHEN statement using Subroutine select_database_values by passing the Table name and field names as parameters.
Example:
CALL FUNCTION 'DYNSQL_GENERATE_WHERE_CLAUSE'
EXPORTING
fieldname_key_1 = 'AUART'
fieldname_key_2 = 'VKORG'
fieldname_value = 'ERDAT'
operator = '<='
TABLES
where_clause = dyn_sql
control_table = ztvara
all_values_key_1 = auart_all
values_key_1 = auart_teil
all_values_key_2 = vkorg_all
values_key_2 = vkorg_teil
EXCEPTIONS
dynsql_too_large = 1
wrong_entry_in_control_table = 2
key_values_inconsistent = 3
no_entry_found = 4
function_already_called = 5.
‎2007 Dec 26 6:13 AM
can u give examples of the function: DYNSQL_GENERATE_WHERE_CLAUSE and is it we jus need to type in the codes into the function only?