Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SAP logical database includes macro implicitly. How?

Tags:

abap

We are writing a tool in Java that parses and transforms ABAP code. We therefore have no intention to write new ABAP code but our tool has to handle all of ABAP, even obsolete statements. Furthermore, I'm not an ABAP expert.

One object we see uses a macro begin_of_block that is defined in object RFDBRMAC. That include is loaded in case the logical database BRF is used; using another logical database as well as no logical database at all will not load it. But neither its corresponding object SAPDBBRF nor its includes mention RFDBRMAC. In particular, none of the former include the latter.

How does assigning the logical database BRF to a program makes it include RFDBRMAC?

Demo program using logical database BRF. The macro is known Demo program using logical database BRF. The macro is known

Demo program using a different logical database. The macro is unknown Demo program using a different logical database. The macro is unknown

like image 683
Ulrich Scholz Avatar asked Nov 21 '17 15:11

Ulrich Scholz


People also ask

What are logical databases in SAP?

Logical databases are special ABAP programs that retrieve data and make it available to application programs. The most common use of logical databases is still to read data from database tables and associate them with executable ABAP programs while defining the program contents.

How do you create a logical database in SAP?

The structure editor of the Logical Database Builder appears. On the left is the name of the root node, followed by a code for the node type: T for a database table, S for a ABAP Dictionary type, and C for a type from a type group. The new logical database now has a structure with a single node.

How do I view a logical database in SAP?

Double click the SAP logical database name to open the Display Logical Database SAP screen. ABAP developers can also use transaction code SE36 (tcode SE36) to display logical databases. Double click on the logical database name. Or you the transaction code SE36 for displaying logical database on the SAP editor.

What are SAP macros?

A macro is a summary of a statement list for internal reuse within a program between DEFINE and END-OF-DEFINITION. The statement list is included in another position in the program by specifying the macro name.


2 Answers

In transaction SE36 display the logical DB BRF. Then click the pushbutton 'Selections' (or Menu: Goto / Selections or Shift + F1). This will display the include DBBRFSEL, where the selection screen is defined for the logical DB. On the bottom of this include you'll find what you are looking for.

To generalize this for all logical DBs, the selection screen is named DBxxxSEL where xxx is the name of the logical database, and is automatically included in all programs which use this logical database.

like image 54
József Szikszai Avatar answered Nov 11 '22 02:11

József Szikszai


In addition to Jozsef's perfect answer I can add that you can utilize table D010INC which holds all include relations between programs and includes.

enter image description here

Thus it's very easy to find such includes programmatically.

like image 38
Suncatcher Avatar answered Nov 11 '22 04:11

Suncatcher