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.
Showing results for 
Search instead for 
Did you mean: 

how to fetch the field names in update statement

0 Kudos

hi ,

i have a requirement where i have to scan a report and check whether a update statement is used to update the keyfields of the DB table.

lv_stat will have each line of the report.


IF lv_stat CS 'UPDATE'.

CHECK lv_stat+0(6) = 'UPDATE'.

SPLIT lv_stat AT space INTO lv_str_1 lv_str_2 lv_str_3.


EXPORTING tabname = lv_str_2

TABLES dfies_tab = it_field.

next , i have to compare the fields in it_field with the field used in the update statement. But there are many ways of writing update statement ! . can anyone suggest how i can fetch the field names used.



Active Contributor

Hello vijayashri

Have a look at class CL_ORA_ACTION_JSEL and its method PARSE_SQL_STATEMENT. It might help you (or give a hint) with parsing of the SQL statement.

You could also search for the key fields of the table in the UPDATE statement. If these are found then these are updated.

Kind regards,

Active Contributor

Definitely use the output of parsed / tokenised code rather than the source code itself. it's MUCH easier.

See this blog

Active Contributor
0 Kudos

Of what I know, there is only one way to update the key fields (I guess from the primary key), other UPDATE variants can't update the key fields:

UPDATE tablename 
    SET keyfield1 = ..., keyfield2 = ..., other fields ...
    WHERE ...

It seems pretty easy to parse. Can you explain what is your issue?

Hi Sandra ,

Thanks for the help. I was thinking if the key fields are updated through work area but it is not possible. The issue is resolved.