Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
craigcmehil
Community Manager
Community Manager
0 Kudos

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.

 

Solution: 

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.

5 Comments