10-21-2015 8:29 AM
Hi Experts,
I need your help to fix the following scenario.
Scenario: I have more than 10 table and each table has different column names (column number also different). I need to check specific value is present in the 10 table. Its like a similar kind of find option.
Picture represent:
Ztable_01
Source_ 1 | Source_2 | Source_3 |
---|---|---|
1 | X | B |
2 | A | C |
3 | V | D |
Ztable_02
Source_ 1 | Source_ 2 | Source_3 | Source_ 4 |
---|---|---|---|
B | M | K | N |
C | Y | J | B |
D | Z | L | A |
For Example: I need to display the table Name if the table contains 'A' in any column. (Note we don't know the column name)
Please help me to fix this.
Note:
- I have tried where condition but for the where condition we need to know the column name.
- Just want to display the table name if contains specific value, no further action is required.
10-21-2015 8:38 AM
Hello Siva,
use the dictionary-tables DD02L and DD03L, I think you find what you Need.
Greeting Peter
10-21-2015 8:38 AM
Hello Siva,
use the dictionary-tables DD02L and DD03L, I think you find what you Need.
Greeting Peter
10-21-2015 11:24 AM
Hi Peter,
I have checked the given table and I got some idea. But do we have option to find the specific value in table?
10-21-2015 11:42 AM
Hi Siva,
If I understood your query correctly then I think you need to write the code as shown below for your given example.
you need to pass the where clause for all field of table since you don't know the field name.
select single * from Ztable_01 where source1 = 'A' or source2 = 'A' or source3 = 'A'.
if ay-subrc = 0.
write 'table name'.
endif.
you need to write the same code for Ztable_02...and so on...
Regards
Chudamani Gavel
10-21-2015 11:52 AM
Hi Chudamani,
Thanks for your reply,
I have more than 100 tables and each table has so many columns., that is the reason I asked, do we have option to find the specific value in Z table.
/Siva
10-21-2015 11:57 AM
Hi Siva,
Always will remain develop a Z program which creates a dynamic internal table for each Z table and check the values in.
In fact , there is a standar report that dones exactly that, or something very similar: TABLE_SCANNER
I've just discovered it, but in some systems is deprecated.
Hope helps,
regards
10-22-2015 6:59 AM
Hi Siva,
I have used the program TABLE_SCANNER named by Enrique.
This program is very useful for your wishes.
Please try it.
Greetings Peter