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

How to identify all Z or Y programs that update standard SAP tables?

0 Kudos

Hello SAP Experts,

Is there a way to find in an SAP system all customer programs (Z or Y) that update standard SAP tables?

Thanks in advance

D.

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor

I guess you are only talking about direct updates using SQL, i.e. you are not looking for all BAPI create, update or delete calls.

You could start by using the program RS_ABAP_SOURCE_SCAN to scan all your Z or Y programs, by using a regular expression. It's a case insensitive search. The big limit is that it will search only on one line, e.g. if you have INSERT INTO dbtab on distinct lines, it can't work. One strategy is to increase the scope to select also the lines with orphan INSERT or INSERT INTO (+ all other possibilities), then analyze manually.

Example of regular expression:

^(?!\*)(?! *") *((INSERT +INTO|UPDATE|DELETE +FROM) +[^YZ]|INSERT +[^YZ ][^ ].*+FROM)
  • ^(?!\*)(?! *") is to exclude commented lines (not starting with * or preceded with ")
  • | (pipe) means logical condition OR
  • space + means 1 or more spaces
  • [^YZ] means any character which is not among Y, Z
  • .* means any number of characters, whatever they are

ABAP documentation explains more about regular expressions.

4 REPLIES 4

Sandra_Rossi
Active Contributor

I guess you are only talking about direct updates using SQL, i.e. you are not looking for all BAPI create, update or delete calls.

You could start by using the program RS_ABAP_SOURCE_SCAN to scan all your Z or Y programs, by using a regular expression. It's a case insensitive search. The big limit is that it will search only on one line, e.g. if you have INSERT INTO dbtab on distinct lines, it can't work. One strategy is to increase the scope to select also the lines with orphan INSERT or INSERT INTO (+ all other possibilities), then analyze manually.

Example of regular expression:

^(?!\*)(?! *") *((INSERT +INTO|UPDATE|DELETE +FROM) +[^YZ]|INSERT +[^YZ ][^ ].*+FROM)
  • ^(?!\*)(?! *") is to exclude commented lines (not starting with * or preceded with ")
  • | (pipe) means logical condition OR
  • space + means 1 or more spaces
  • [^YZ] means any character which is not among Y, Z
  • .* means any number of characters, whatever they are

ABAP documentation explains more about regular expressions.

0 Kudos

Table modifications in customer namespaces would also match this pattern.

touzik_itc

If you mean names prefixed /NAMESPAC/, well it would be difficult to say which namespaces are for the client, which namespaces are for SAP partners (I guess we could consider that as standard), but we could adapt the regex to fit this requirement anyway.

Sandra_Rossi
Active Contributor

Simplest solution, and it works better, by using Code Inspector/ATC.

NB: I guess you are only talking about direct updates using SQL, i.e. you are not looking for all BAPI create, update or delete calls.

In the Search Functions, there are 2 possible checks:

  • Search DB operations. You may search only for UPDATE, DELETE, INSERT.
  • Find ABAP statement patterns. You may search EXEC SQL.