‎2014 Apr 24 9:11 AM
Hi Experts,
We want to implement utility for where used list for field value.
E.g. VKORG is the field and has value "US10" then program should give result with list of tables which have VKORG = "US10" value.
Any idea how can this be implemented?
Regards,
Sanjana
‎2014 Apr 24 10:21 AM
Hi Sanjana,
So in selection screen you will give field name and its value.
Use table DD03L to find all the tables which has specified field in it.[In to one internal table]
then do selection query on all tables[Do loop on table and for each table select query with where clause with value given in selection]
If value found; then collect those tables into one final internal table.
Thanks,
Dharmishta
‎2014 Apr 24 10:41 AM
Hi Sanjana,
Something like this (code snippet has several small bugs):
TABLES: dd03l.
PARAMETERS: p_field(30),
p_value(30).
START-OF-SELECTION.
DATA: lr_tab TYPE REF TO data.
DATA: l_where TYPE string.
FIELD-SYMBOLS: <ls_data> TYPE any,
<lt_data> TYPE ANY TABLE.
SELECT * FROM dd03l WHERE fieldname = p_field. "and is a table...
CONCATENATE dd03l-fieldname '= ''' p_value '''' INTO l_where. "there is a small error here
CLEAR lr_tab.
CREATE DATA lr_tab TYPE TABLE OF dd03l-tabname.
ASSIGN lr_tab->* TO <lt_data>.
SELECT * FROM (dd03l-tabname) INTO TABLE <lt_data> WHERE (l_where).
LOOP AT <lt_data> ASSIGNING <ls_data>.
WRITE: / dd03l-tabname. "and maybe key fields from <ls_data>
ENDLOOP.
ENDSELECT.