ABAP log

November 3, 2008

SAP NetWeaver in the comfort of your home

Filed under: ABAP, SAP — abaplog @ 6:41 pm

I always wanted to try running SAP at home, but my PC was too old to try. I could probably run the very first SAP for Linux (4.6), but I did’t even have disk space to install appropriate Linux version. It needed some very old SuSe version, while I had Ubuntu as my primary OS. Now that’s changed. After getting one of the cheap Toshiba Satellite laptops, I am able to run the latest SAP Basis on this $600 machine.

First I planned to try installing real OpenSuSe and even downloaded almost everything. Strangely, SAP requires a special JDK and the link to it can be found only through SAP OSS system – obviously not 100% free for enthusiasts to try. But there’s much better way.

One of the first things to install on my new laptop was VMware Player, to be able to run Linux inside of a virtual machine, to surf Web sites without risking my primary OS. It’s amazing technology, and it was even more amazing to find that SAP, together with Novell, is offering the latest NetWeaver trial version to be run inside a VM!

It took some time to download everything over my 6 Mbit DSL line, and a couple of hours more to extract the RAR archives. When ready, I started the VM and in less than an hour I had everything running. In short, the steps are: download, unpack, start the OS, start the SAP, request the license and install it – ready. The details are described at SDN:



It definitely helps if you have some experience to Linux or UNIX, but it’s really easy for everyone. My own impressions so far:

I have dual core 1.86 Mhz Intel with 3 GB RAM. I guess that CPU speed is important, but RAM and disk speed are the key. Linux and SAP itself need about 1.5 GB. The VM comes with 1.5 GB preconfigured. This way you can run SAP but with SAPGUI added (it needs about 400 MB RAM), your VM doesn’t run well. I tried to increase VM memory to 2 GB. With no noticeable improvement in performance, my host OS – Vista – was half dead. I believe that having 4 or 6 GM memory will be nice, but disk speed limitations will remain. Guest OS disks, unlike CPU and RAM, are emulated as files in your Windows system and that seems to be a bottleneck. Even if you increase VM memory to 2.5 GB (I think it’s maximum allowed by VM Player), it won’t be enough to cache all SAP data in memory minimizing disk access. Perhaps running with VM Server, which is also free now, can help, but you will never get the best of your hardware, as you would if you ran “real” Linux.

Note: 32-bit Vista supports only 4 GB, and even with 4 GB Windows doesn’t always use all 4. See Microsoft KB 929605.

To improve the performance I tried to put the number of SAP processes down, but it was not successful – I am not a Basis specialist. It has to be pretty easy but those RZ04 and RZ10 transactions didn’t work for me. The good thing, however, is that if anything happens, you can always restore your virtual system by copying or unpacking the original files.

What I decided to do was running SAPGUI on my host OS. You can only get Java version for free (not as OSS download) and it’s really memory hungry. Running it on VM is a waste of resources if I can do that “directly” in Windows. The only problem was to configure the connection to virtual machine. The above mentioned Web log gives some hints at how to do that, but the key for me was peeking at SAPGUI configuration in the VM. Normally you won’t have SAP Logon configuration files that will have SAP gateway information, but luckily, I tried to look at the extended configuration tab in SAP Logon, and the mysterious connection string that I found there worked for me.

June 16, 2008

Recoding document numbers

Filed under: ABAP, APO, SAP — abaplog @ 7:57 pm

For one of our external systems we collect the data from both R/3 and APO and last week I had an interesting problem of potential conflict between document numbers. The planned orders that are created in APO but not published to R/3 are (hopefully) guaranteed to have different document numbers than those existing in R/3. I guess you can configure the systems so that they will be using the same number range. So, if you are transferring R/3 and APO planned orders, there should not be any problems in mixing documents.

Now, imagine we have to transfer the material reservations of the planned order. If not all BOM components are known to APO, R/3 does the BOM explosion when the APO order gets published into R/3. If the order is not published, I have to make the BOM explosion in R/3 myself. How do I assign reservation numbers in a safe way? My first idea was to simply use the planned order number as reservation number abd the BOM position and the reservation position number. Wrong way. This does not ensure that the reservation numbers you “simulate” this way differ from real ones from the RESB table, because planned orders and reservations use different number ranges.

What saved me was that the reservation number for my external system doesn’t have to be purely numeric. Actually, even in R/3 itself it’s defined as “character” of length 10, and it’s only number range logic that results in numeric reservation numbers. How can we encode the numbers easily so that they will be distinct? I started looking at hexadecimal encoding. I needed to squeeze ten decimal positions into less, to save at least one position to use it as a prefix, something like “A” at the beginning, to make the resulting number (ok, not the number but “identifier”) 100% distinct. For if left just hexadecimal, we can easily have a hexadecimal number consisting just of digits, and we may end up with conflicting document numbers again.

If we split the maximum document number into two parts, i.e. two of 99999, each part can be represented with a hex number of 1869F. Same five positions! But the first one needs only one bit, it’s either zero or one! Thus, taking last four positions of both parts, and combining first two positions together into one hex digit, I can encode the whole thing into exactly nine positions, leaving one for my prefix. For example, 9999999999 will be coded like 03869F869F, and the external system will get something like A3869F869F.

The rest is the ABAP code that does the encoding:

form encode_via_hex
  using pf_char10
  changing pf_char10_out.
    lf_num51(5) type n,
    lf_hex4(4)  type x,
    lf_num1(1)   type n,
    lf_char8(8 ) type c.
  pf_char10_out = '0000000000'.
* first part
  lf_num51 = pf_char10(5).
  lf_hex4 = lf_num51.
  write lf_hex4 to lf_char8.
  lf_num1 = lf_char8+3(1) * 2.
  pf_char10_out+6(4) = lf_char8+4(4).
* second part
  lf_num51 = pf_char10+5(5).
  lf_hex4 = lf_num51.
  write lf_hex4 to lf_char8.
  lf_num1 = lf_num1 + lf_char8+3(1).
  pf_char10_out+2(4) = lf_char8+4(4).
  pf_char10_out+1(1) = lf_num1.

May 2, 2008

SAP APO Simsessions cleanup

Filed under: ABAP, APO, SAP — abaplog @ 6:56 pm

As I wrote last week, we had some problems with data not being released when making a call from R/3 to APO via RFC. I expected the data – the sumulation sessions of APO liveCache – to be cleaned up as soon as the RFC call is getting back into R/3, but they remained in memory as long as our dialog transaction on R/3 side was kept open. This was a kind of concern for our team as a problem potentially affecting liveCache performance, though in liveCache monitoring (LC10), the memory consumed by those simsessions looked quite innocent in comparison with others.

So, what was that? Whenever we want to read some liveCache data, we need to open a “session” first, for it is a required parameter to most of APO functions reading data from or writing to liveCache. Exceptions are of course BAPIs, that are dedicated to be called easily from outside. And if you are in some user exit of BADi, you don’t need the session because normally you are given one as a parameter.

So, before we start, we usually create a new session with the function /SAPAPO/RRP_SIMSESSION_CREATE. If it’s being done in a “short-living” fashion, like a report that is run and then exited, one’s sessions are gone very soon. But ours was kept open by some users, sometimes for hours. LiveCache deletes the sessions that it finds to be too old (as defined in customizing), but we wanted them to go away faster. In the same function group as CREATE function, there is the function /SAPAPO/RRP_SIMSESSION_LEAVE, but I found it to be slightly suspicious, for it is used by SAP itself only at couple of places. In addition, the code I had to fix could be calling CREATE function several times. Do I have to call LEAVE every time right after? Or are there any other ways?

I decided to search on OSS. There are many notes dealing with sessions that remain open, and I looked at how SAP solved the problem. They did it better than just calling LEAVE. Instead, before calling CREATE, they try to find any existing session created earlier in the program by calling /SAPAPO/RRP_SIMSESSION_GET. If it fails, they create a new one and set a flag (a global variable) indicating that they have to release the created session. I decided to use the same logic, so the whole sequence looked like:

*   Try to get an existing session first
    call function '/SAPAPO/RRP_SIMSESSION_GET'
        ev_simsession = lv_simsession.
    if lv_simsession is initial.
*     Create a new simsession
      call function '/SAPAPO/RRP_SIMSESSION_CREATE'
          iv_simid       = ls_params-simversion
          iv_change_mode = gc_false
          ev_simsession  = lv_simsession.
      gf_sims_created = gc_true.

* ..... now depending on program conditions,
*       follow more GET/CREATE blocks, with GET
*       most likely returning the session created earlier

* And now, cleanup:

* Did we create any sessions?
  if gf_sims_created = gc_true.
*   Check if there are any sessions still open
*   (who knows - maybe they are deleted already)
    call function '/SAPAPO/RRP_SIMSESSION_GET'
        ev_simsession = lf_simsession.
    if not lf_simsession is initial.
      call function '/SAPAPO/TSIM_SIMULATION_CANCEL'
          others = 0.
      gf_sims_created = gc_false.

Update: as our practice has shown, this way of releasing APO SIM sessions is good only if your program does exactly one RFC call to APO. If you do two, the second one will fail because APO will try to reuse the old session which is already destroyed – the result of APO keeping the data and program state from the first call and therefore some global variable not being initialized. So, in this case the right way is calling the /SAPAPO/RRP_SIMSESSION_LEAVE.

April 25, 2008

Rappers with SAP OSS, anyone?

Filed under: ABAP, APO, SAP — abaplog @ 7:49 pm

After having built rather complex logic of reading some data from APO and bringing it into R/3, we’ve got some unexpected behaviour. As long as R/3 transaction remains open (this is a dialog transaction), it seems that the RFC “session” on the APO side is not completely closed, and its data, including APO liveCache simulation sessions, is not released (consuming memory).

I’ve spent some time in debugger, then on OSS, browsing through many OSS notes. I hope we have a solution now, we still got to test it. And the time I spent in OSS was not wasted. Imagine you are looking for OSS notes on liveCache and you find a note whose title begins with “liveCache 7.5 crash”! I mean, it rhymes so perfectly that I wonder whether there were any rappers at SAP Support who created this one! (This is the note 946768 by the way). 🙂

April 19, 2008

And ABAP be still as bright.

Filed under: ABAP, APO, SAP — abaplog @ 7:29 pm

Let’s start again after a long pause, with a shorter post (carrying some good news)…

Three weeks ago, when I was back from vacation during which we’ve experienced some almost scary things, SAP guys visited my company office with a long-waited-for presentation. The topic was, as you may expect from a technical-oriented presentation, the new possibilities that the latest NetWeaver release brings to a developer. It was nice, stuffed with information, six hour session. Well, I would strip it of some things that normally are useful only for SAP sales. What was interesting is that on that day, it was the very first time that I’ve heard some statement about the role of ABAP in the future.

The question is being asked again and again, since we’ve been in dotcom and Java hype: are we going to see ABAP obsoleted and replaced by Java or something else? If you try to look for some “roadmap”-type documents on SAP site, you will never find it. SAP is pushing SOA and “classic” ABAP is in a deep deep shadow now. So we’ve asked the question one more time. And heard a clear answer. Now guess: do you believe they are going to dump it and start it over? Do you think we customers are going to accept testing and debugging the brand new code. No way. The whole R/3, plus APO, plus many other “core” apps will be powered by ABAP. (And personally, I doubt that any of those guys operating machine tools at the factory floor will ever see “the cool cool benefits of SAP portals, whatever”.) I regret now that I did not write it down to have it signed by SAP representative. But it looks like “ABAP will still as bright.”

PS. If I made you think that Web apps are repulsive to me, you are mistaken. Go visit my personal site (link is on the right).

February 23, 2008

Ten years of… ummm… Nevermind.

Filed under: ABAP, SAP — abaplog @ 9:47 pm

I was thinking how will I name this article. “Ten years of ABAP” is kind of selfish but well, here I say that anyways. “Ten years of fun” is not true, for SAP can be very stress-inducing. So, nevermind, let me tell the story.

Ten years ago, on a cold February morning we got off the train to Moscow and rushed to subway to be on our first ABAP training on time. We were six, a newly formed team of a software services company, to get prepared to do technical SAP work. Just one of us knew something about SAP from practice, and the rest, including myself, didn’t have a clue. The week before I was sitting in front of Visual C++, the most advanced development environment then and now, and could not imagine downgrading to simple tools that SAP then offered. I decided to quit my job and take another one, to try this fancy business software.

In 1998, SAP was a hot skill in computer industry and my company (my new company) already had many people with SAP skills. But they were to busy to switch to a new project, so the management decided to take a risk hiring inexperienced people and investing into training. Somehow, when they called SAP Russia to arrange an on-demand training in ABAP, SAP folks got very excited, mostly because they wanted to know who the hell are we, if we are not SAP clients. In my small native country, there was exactly ONE client of SAP at that time. But the potential revenue prospects dissolved all their doubts (not that I’ve heard of widely going piracy of R/3) and they offered a BC400 on demand and then BC415/BC425 from the official schedule.

Moscow never stops offering surprises to its visitors. Enormous city with so many things going on. Just couple of weeks before, I was visiting the office of my (previous) company in Provence, Southern France and it was quite a fun to see the price tags in Moscow easily translated to French Francs, for things easily comparable like McDonald’s, for exchange rate was 1 to 1. The crash of Russian market several months later has corrected that. So, we took the subway, then a bus, both considerably cheaper than in France, and got off in some high-rise residential area to look for the office of SAP Consult CIS. SAP Russia was a company selling software, and SAP Consult did consulting and training. Because of some stupid law or may be for tax convenience, SAP decided to split into two companies there.

SAP Consult was (and maybe still is) located in a former kindergarten that they’ve bought and completely renovated. They didn’t have those small desks and chairs, no. They had nice classrooms with the latest equipment and a broadband connection to SAP Germany. Though SAP already announced the R/3 4.0, we were trained on 3.1, to start our work with 3.0 then, transitioning to 3.1 one year later.

We all were impressed by the training. The second week (we did that two weeks later actually) was not as good because it was with different instructor. But BC400 was impressive. I did not have a much of specialized training and this was the first one then, but this guy who gave it was outstanding. And he wasn’t even a professional educator! His main job was consulting and we had several years of SAP experience. (I wonder when did SAP start its business in Russia).

Back from our training, we continued slowly. Fortunately for us, we worked on a project of IBM Storage Systems Division, where they have extremely well organized processes and lots of competent and ready to help folks. So, after maybe one year, we could say that we understand something in SAP or ABAP world. 🙂 The SAP instance we were working on was by that time one of the biggest and it that was a well known project, even mentioned by SAP itself in one of their “success stories”.

Working was fun. I could not imagine that I will have a chance to use my (almost dead) knowledge of mainframes on this project that I still had from university. But then, R/3 3.x still had this good old ABAP editor where you had to type a command to get more empty lines to write your code, or to paste your text (ok, there were some keyboard shortcuts too, but not for everything). And in addition to standard corporate mail on Lotus Notes, we all got to learn simple things in the same mainframe environment that comes with OS/360 and its descendants. IBM used it as a backup and for some internal applications. Funny, I still had some “tricks” in my head like “if your screen is stuck and reacts strange to anything you type, which means you got out of normal command environment, type IPL PTS and then you’ll be fine”. SAP was considerably easier then, for it had a menu and was more intuitive in 1998.

Looking back I would say that working with on SAP implementation is not as appealing as developing a standalone software, what I did before jumping on ABAP. I’m tired of mentioning that SAP still doesn’t have any useful documentation that helps ABAPers to map business and technical sides of work. But it is nevertheless rewarding (not only from financial incentive point of view). And it’s good to feel how your single line of code can kick the multimillion multiterabyte system in the butt. Ten years didn’t change that – just try to trash your T000 table with DELETE and you’ll know what I mean.

February 19, 2008

Great SAP NetWeaver/ABAP presentations at SDN.

Filed under: ABAP, SAP, SDN — abaplog @ 6:43 pm

Yes, you read it right. I have criticised the quality of SDN content and it made us at sapfans.com many good laughs, but sometimes there are actually very valuable things. Several weeks ago the SDN newsletter brought me a link to a Thomas Jung blog entry about the latest features of ABAP Workbench and SAP NetWeaver tools. It took me some time to get them all because those are big files. They are not films though but a mix of presentations, screen recordings and background commentary, all built based on the workshop Thomas, SAP NetWeaver Product Manager (who looks like knowing the very details of stuff he is managing!), presented at the latest TechEd.

Here’s the link: https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/8126

Not everything is new there – Advanced ABAP part contains some older things, and I did not look at Web Dynpro yet – this has to be some older stuff too. But I highly recommend getting the presentations and investing some time to watch them. Even if you still work with some old SAP version, it’s very useful to know what is coming in the next years.

February 4, 2008

Scary SAP transactions.

Filed under: SAP — abaplog @ 7:02 pm

Sometimes SAP can be really scary. Just look what do they have in ERP 6.0 release:


A must transaction for every business traveller!

Or look at this list of possible employee dismissal reasons for some HR transaction in 4.6:


Would they please be so fair to declare unjustified dismissal?

The Data Dictionary also has some strange values list for the domain BEN_LNCOD that belongs to HR.

Value: Accidental Death or Dismemberment

ok, I understand this one, after seeing the machines used at our plants.

Value: Death and Dismemberment

When compared with the first value, do they mean now it’s a voluntary dismemberment or what, if it’s not accidental? Like a lizard throwing off its tail probably.

And finally:

Value: Supplemental Death and Dismemberment

Supplemental, you say?

January 28, 2008

Betting on SAP ESA. Part 2.

Filed under: ABAP, esa, SAP, soa — abaplog @ 9:31 pm

Today I am going to continue looking into the current SOA offer from SAP. As I wrote previously, I wanted to evaluate the ESA components in different modules of SAP ERP, and I am starting with master data.

Master data is obviously not the first candidate for extensive coverage with services. Most of it is pretty static and is loaded once, at the beginning of implementation or deployment of the system to new company divisions/plants. That’s why we didn’t have really good support of master data with BAPIs, and I don’t think it’s going to change with ESA. In this entry, it won’t be a review of a full set of every possible basic data piece that an enterprise would need, just several most useful and obvious to be supported by the enterprise services. Let’s have a look. I will be comparing the ESA offer with the current set of BAPI functions in my old 4.6C.

We start with basics. Materials – this is what all companies need to operate even if they  services oriented businesses. Why do we need to support materials with “official” functions and enterprise services? Imagine we are a manufacturing company. Most of them use external systems for product development and lifecycle management (those big systems from Parametrics or IBM/Dassault for example). If the products and their actual data are coming from such systems, we will most likely need to design interfaces, and those interfaces will have to support reliable live links into our SAP ERP. Good old BAPIs provided us with a full set of functions to manage materials. Currently, in the ES catalogue of SAP, I could find only read-only services: Manage Material In and Query Material In. Not that much.

Materials are bought and sold. So here come customers and vendors. Why the need for support here? Imagine some cool future system (SRM or CRM kind) where our business partners will be able to access some of their details, maybe even including possibility to change the data. You’ve heard about Plaxo? You change your data and all your contacts have the immediate access to updates. May be it sounds like a crazy idea, but what about our customer having a way to update their address or contact details without waiting for our company employees to do that? For me it sounds reasonable, so I wanted to check whether we have services for customers and vendors.

For customers, we had full set of BAPIs.  ESA offer: Manage/Query Customer In. There is no “create” service/method, but at least we can find and change things.

For vendors, we have a limited set of BAPIs, mainly for reading. ESA goes the same way today: Manage Supplier In, Query Supplier In – both read only. NOTE: there is probably a difference between “supplier” and “vendor” – I won’t dig deeper here. I did not find anything about “vendors” in ESA directory.

The BAPIs in 4.6C have an object “Vendor price catalogue”, that may be useful to us. ESA: offers no such thing today. Perhaps they have obsoleted it.

Because of the similar background as in the case with materials, it would be great to have access to bills of materials and routings used in the production process. They can also be managed from external CAD/CAM/PDM/PLM systems.

For routings, we got “create” and “check” BAPIs; no read, no change. ESA offer: nothing.

BOMs – no BAPIs. ESA: Query Production Bill of Material In. AHA! That’s a progress! But still only read operations.

With the similar background, documents are a good candidate area. Those can be drawings from external systems. In this case, SAP offers a full set of BAPIs and a full of enterprise services, like Document Action In, Manage Document In.

One interesting BAPI set, related to master data, that I have found: Currency exchange rate. Currency rate data is normally delivered to companies via EDI, and to complement it, SAP offers BAPIs for create and change operations. However, I could not find any related enterprise services.

So, you see, we don’t have lots of exciting things for master data in ESA, but as I said, I would expect less for master data and more for dynamic data to work with the mechanics of business modules. Those areas are going to be covered in later entries of ABAPlog.

January 14, 2008

Betting on SAP ESA.

Filed under: ABAP, esa, SAP, soa — abaplog @ 9:31 pm

We’ve been waiting, and here we are! We are now in 2008, which means that 2007 is already in the past, and the end of 2007 was the magic date when all SAP applications, including mySAP Business Suite or ECC or whatever it’s called now, will be completely covered by SAP services architecture, SAP ESA. The first detailed announcements came as early as 2003, with SAP keeping on track through those four years.

I don’t believe anyone expected that we are going to get 100% coverage. It takes time. I was quite skeptical, after reading all exciting announcements of Open BAPI Network since 1997 and years later, still using illegal tricks to work with SAP, instead of published and SAP-blessed interfaces. When I checked the ESA services directory at SDN back in 2006, it looked even poorer than BAPI directory. A couple of months ago, though I did not write what have I found and what I haven’t in 2006, I could say that SAP did a significant progress.

My primary interest in their new offer is the possibility to shift from dirty database stuff, yet more dirty tricks with internal functions and the frustration with incomplete BAPIs to some well documented way of exploring and updating SAP data and of course, connecting SAP with other systems. From what I could read, we’ll soon be able to forget the syntax of SQL SELECTs, the knowledge paid with our sweat and our employers’ money.

While SAP was integrating the ESA support and the development of the ESA connections to SAP internal business logic was far away, companies could already use ESA/SOA to have SAP talking in SOA language to the systems that already expose business functionality through services. That means, as soon as you install NetWeaver, which has ESA support since, I think, 2003, you could, in your SAP programs (ABAP or Java-based), simply speaking, read or update data in your external system that exposes business logic as services. And in this other system you could call services exposed by your SAP as soon as you have implemented them yourself. If you wanted, say, read a sales order from your SAP system, you still had to do this with BAPIs or in some other way. You had to wait for 2008 to come to have both sides of story.

Now, the new era is coming. We can’t say it’s already here, even if it has to be according to press releases. The most important for us is to know the following:

1. What do we have with ESA today.

2. How good is the progress that SAP is having implementing their new architecture in each application.

In the next weeks I’m going to make some kind of analysis of SAP’s current offer, in terms of what business functionality is exposed today in the latest version of ESA. I don’t need to have the latest version at work to do that because everything we need to know can be found at SAP SDN Enterprise Services Workplace. In the past ten years I had to do technical work with most of SAP R/3 modules, minus HR, plus SAP APO. (Those days it’s mostly production planning related). I’ll try to cover the areas where I have some general idea, so that at the end we could see whether we should rush buy books about the services jungle.

Stay tuned!

Older Posts »

Blog at WordPress.com.