Application Development and Automation 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: 
Read only

Why are ABAP Programs stored in database?

former_member193023
Participant
0 Likes
2,123

I need to know Why are ABAP Programs stored in database? And when we execute a program from front end how the process goes on?

13 REPLIES 13
Read only

Former Member
0 Likes
1,875

Hi Parth,

Each ABAP program is an object in the DB and usually refers to plenty of other objects which also are stored the in db.  When a program is run from the frontend, it first checks the program buffer to see whether it is there.  If not, then it makes a db call to retrieve the program and store it in the program buffer.  (You should aim for  > 90% hit rate on the program buffer for performance reasons.)  Unless the transaction is passing data to the frontend, for example with a download to Excel, then the processing of the program runs on the server, not the client.  The client is there for presentation purposes..

Hope this helps

Graham

PS. As you are obviously new to SAP and this site: It's poilite on SCN to ask questions and sign your name. 

<< Advice for assigning points ( indirectly ) removed >>

Message was edited by: Kesavadas Thekkillath

Read only

0 Likes
1,875

Hi Graham,

Can you please elaborate the first line. I am still not clear with why is it needed to store the ABAP programs in DB not in hard drives.

Thanks,

Parth

Read only

0 Likes
1,875

Hi Parth,

SAP programs are OS and DB independent with a layer between the SAP environment and the OS/DB - basically the kernel.  Plus each program can and does call many other standard functions (code).  Accessing the 100,000 plus programs from the OS would also be slow and inefficient.  Putting this in the db helps here.  Plus programs are only compiled when if required or requested through SGEN transaction, so potentially saving db space.

This is a SAP feature, one you will get used to.

KR

Graham

Read only

former_member193023
Participant
0 Likes
1,875

Hi Graham,

Thanks for your solution.

Would like to reward you but couldn't find a way to do that. There's no option coming for me to do so.

Thanks,

Parth

Read only

0 Likes
1,875

Hi Parth,

Just mark the reply as 'correct answer' and that should do it.

thanks,

Graham

Read only

0 Likes
1,875

Hi Graham,

I am still not convinced why SAP Programs are stored in DB rather as external files as in case of c++ or java files.

My Point is - if you want to execute a program, it has to be brought into memory. If it resides in hard disk. it will be called into memory and execute as it happens in case of Java or c++ program. But in case of ABAP, we are making a DB call to refer to other functions modules and classes which is quite costlier than calling a program from hard disk level.

Please help me out here.

Thanks & Regards,

Naveen Goyal

Read only

0 Likes
1,875

You will only get a definitive answer from the people who developed SAP in the first place. All else is guess work.

SAP have obviously found that storing ABAP in the database is the most effective way of doing it, or at least "good enough", and/or not worth the effort to change. If there were serious performance issues, then it would have been addressed decades ago.

Regardless of where the programs are stored, they'll be buffered in memory, so it makes no difference.

Read only

0 Likes
1,875

Hi Mathew,

Thanks for answering it.

I am quite happy for your reply. But i still feel there must be definite architectural reason for doing this.

Regards,

Naveen Goyal

Read only

0 Likes
1,875

Hi Naveen,

Also bear in mind that ABAP programs are almost all DB and OS independent and user SAP SQL statements to access tables.  These SQL calls are then translated to DB-specific calls by the kernel programs.  Writing programs this way means that the developers do not need to take into account the specific SQL call needed for the DB in question - they are DB agnostic (in general).  This means that one set of code can be used on any and all systems (that's why you can import a SAP note to your system regardless of the OS/DB version you are running on). Otherwise, every program would have to have multiple versions depending on the DB it is running on.

The overhead of fetch a program from the DB if it is not already in the buffer is minimal when one considers the benefits.

Regards,

Graham

Read only

0 Likes
1,875

Hi Graham,

Thanks for your reply.

I agree that we are making open SQL statement which are DB independent. This must be the case even for the people who are writing program in C++ or Java, i mean they are also support DB and OS independent call. But, there must be some archtectural reason to store programs in DB.

Regards,

Naveen Goyal

Read only

ipravir
Active Contributor
0 Likes
1,875

Hi Parth,

If you analyze the ABAP programs like reports, FM, Class etc..you will get one thing is common for every programs, which is TR number.

Which is very much helpful to do compare with old changes of the Objects, it's kind of DATABASE and KEY combination, the TR number are like version of the objects.

how we compare information from two different kind of records?

that's the reason, SAP keeps program in DB tables for the further use.

for more analysis, you can check RSVRSRS1 and SVRS_GET_REPS_FROM_OBJECT program and FM.

Regards,

Praveer.

Read only

Former Member
0 Likes
1,875

TR number - do you mean Transport number?

Read only

ipravir
Active Contributor
0 Likes
1,875

Yes, TR (Transport number).