Skip to Content
Author's profile photo Craig Cmehil

How I started with SAP Web development…

I’ve been doing online development since the BBS days and now I’ve found myself in the world of SAP, I have to admit I was a bit hesitant before.  SAP was not exactly what I’d call an easy to pick up software package. In fact after about a year I consider myself mediocore with the BC module and a bit better with the SSM 3.1 module.  


So here is the first I hope in a series of “a web developer integrating into SAP“.


Application 1, the User List – Platform Java/SAP/Apache Web Server.


The first major problem I faced was, which platform do I use to develop with? Most of my applications were written as JSP applications or stand alone Java applications.  So the most obvious course of action for me was to use the SAP JCo. JCo is the Java Connector provided by SAP for connecting Java to SAP systems. Seemed to be perfect, until of course I had to actually get data from an SAP system. Here in lies the first programming related problem, the Java side turned out to be just the nice little pretty GUI side and nothing more. The real programming tasks came to getting the right data out of the system.


OK, before I loose you let me lay out the first application I had to create and take you through it step by step.


The task:

List all users in a system and when they last logged in, classifying them into categories of less than 6 weeks, 6 weeks to 3 months and more than 3 months.


The output:

A web page with a list showing the user name, date and a status symbol showing which category they fell into.


So the task of course was very very simple. Normally I would access the table, do an SQL and output the table rows in a while loop inside of a JSP page (no need for a bean on such a simple process).  Of course this is also where I sat and said – “How do I access the table? I mean I can’t connect to the database directly can I?”, nope of course not. The answer I got – “It’s against our company policy to connect directly to the database, you’ll need to find another way”. So where does this leave me? A BAPI! A BAPI was the answer to my needs, simply find a BAPI that does what I want and call it.  I’ve read all over the internet about how there are so many standard BAPI’s that do just what I’ll need, simply call it with Java and you are done.


So, how do I find the BAPI? After a few questions to co-workers I went to the BAPI Explorer and started looking. No help, I went to the web and searched for SAP message forums. It was there, in a forum post somewhere, I found what I wanted; a BAPI,well really a Function Module called “RFC_READ_TABLE”. It was a standard Function Module style=”text-decoration:line-through”>BAPI and I was able to call it with Java. I proceeded to figure out the parameters and what I had to pass to the function and how to read the export parameters. This of course being no simple task, as I was the first person in the company trying to connect SAP with a JSP page, I did get it though!!


Triumphently I displayed my now finished JSP page for my boss and co-workers, very proud to have finished my first ever SAP Web Application. The result, “hey that’s only one client, where are the others”.


All of my celebrating came to a screeching halt and I was left struggling to figure out why the standard Function Module style=”text-decoration:line-through”>BAPI didn’t do what I wanted?


After playing around with the RFC destination and calling the Function Module style=”text-decoration:line-through”>BAPI from Java I realized that this standard Function Module style=”text-decoration:line-through”>BAPI was only accesing the client specificed in the RFC destination I was using. So I now my next problem, how do I get the information from all the clients on the system?


I can create a seperate RFC destination for each client. Yes that would solve my problem. This of course led to the next problem, we have 34 productive SAP systems with anywhere from 2 to 4 clients each not including 000 and 066; add that to the 38 Development systems and 50 test systems. That’s alot of RFC Destinations to create. No, this would not be acceptable, I mean I’m not lazy but there’s got to be an easier way.



Here is the solution I found to solve all my troubles, worries and woes. What I did was go into one of our development systems and create a copy of the Function Module style=”text-decoration:line-through”>BAPI “RFC_READ_TABLE”, I called it “ZRFC_READ_TABLE_NOCLIENT” and I modified the SQL and added the term “CLIENT SPECIFIED”. Therefore, when I call the Function Module style=”text-decoration:line-through”>BAPI now I pass in the where statement and just tell it “MANDT = 100” or “MANDT <> 000”, thus returning the data from the client or clients I needed. Combine that with a loop checking to be sure the user wasn’t a batch user, communication user, a standard SAP user or one of our support users I had all the data I needed to complete the list. An extra loop or two and a few checks for the date and whether the user was still a valid user the list turned out to be in top shape. My next showing of the finished product went over much better than the first and we saw that we had several users that could be deactivated as they hadn’t been on in a very long time, so all in all everyone was happy (especially me!!).


This entire process from start to finish in what (without SAP tables) would have been about a 2 hour process; took me over 2 weeks. Most of which was spent trying to figure out how to create the new BAPI and get it to the systems I needed to look at.


At this point I figured the score was…

Web Developer 0

SAP                1

Of course, now it’s been in use and I’ve been developing more and learning more, the new task — turn the JSP into a BSP. This of course I will cover in the next Weblog. Needless to say that was also a fun little task 😉 

Follow up How I Started with SAP Web Development, Cont’d.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      As far as I know this function module is not a BAPI, only an RFC enabled FM.
      Author's profile photo Former Member
      Former Member
      Hi, actually a BAPI is defined as "method of a SAP Business object" and according to this PDF document "the BAPIs in the R/3 are currently implemented as function modules". Of which have the following features: Supports RFC, assigned as a method to a SAP Business Object in the BOR, is processed without returning any screens or dialogs.

      These are the general definitions we've found for BAPIs and what they are, perhaps, I've wrongly mislabeled the BAPI/FM I used in the application?

      Author's profile photo Former Member
      Former Member

      BAPI - Standardized programming interface enabling external applications to access business processes and data in the R/3 System.

      Therefore, you are correct and I have incorrectly stated I used the BAPI - "RFC_READ_TABLE" and instead I should have stated the Function Module. I will correct this in the next weblog.

      Thank you for pointing that out.

      Author's profile photo Thomas Jung
      Thomas Jung
      You might want to mention OSS note 382318 where SAP tells customers not use use function module RFC_READ_TABLE. The following is from that OSS note:
      The scope of function module RFC_READ_TABLE is very restricted. E.g.,
      due to the fixed maximum row size only smaller tables can be accessed.
      There are several data types that cannot be handled, and also there are
      doubts regarding the Unicode compatibility of the function module.
      However, all this is quite immaterial, because the function is not meant
      to be publicly used anyway. It was only created to be used as a sample
      in various training courses, and is clearly flagged as "not released for
      Do not use function module RFC_READ_TABLE in the first place!
      Author's profile photo Former Member
      Former Member
      ...and most "standard" users will not be authorized to call this RFM since they don't have the right to call transaction SE16 (if i'm not wrong, the required rights/roles are identical).

      Best regards