ABAP UNIT by example

I’m reading Ken Beck’s “Test-Driven Development by example” (a review when I’ll finish it) and I tried to find if there’s a way to adapt it to ABAP.

Yes, it does. Mainly because SAP launched ABAP Unit, a test environment appliable to both programs and classes.

In programs is easy to implement: you must just define a local class FOR TESTING and go on.

In classes… it’s the same, but a bit trickier: take a look at this link from SAP

Let’s try it.
Continue reading

Advertisements

How to send a mail through SAP and not to die trying it

Update: I’ve wrote a function module that allows you to send VERY SIMPLE mails (no attachments, no weird things) here.

Long time ago, before becoming a tuly idiot, I’ve had to face a little trouble: I had to send a mail with an attachment through SAP, and was not able to find by myself how to do it.

I’ve searched around the net (basically SAPFans :P) and managed how to do it.

I’ve posted there (in SAPFans, I mean) how to do it, but from time to time, someone re-asks the same question, and I’m tired of use the search button in SF. Today I did it again (the search, I mean… I’m not enough lucky) and though “why not to put it in the club’s page? I will save some time in the future…” or something like that.

The link here: http://sapfans.com/forums/viewtopic.php?p=543631
And the post itself after the jump ๐Ÿ˜›
Continue reading

MAP2E_IMSEG_TO_BAPI… and why I hate it (4.6c)

The function module MAP2E_IMSEG_TO_BAPI2017_GM_ITE helps the coder to find a faster way to transfer data from IMSEG structure to its BAPI equal. But the FM’s code in 4.6c doesn’t check the IMSEG’s fields’ types and/or if they are full.

Then, you call this module happily, and when you call the BAPI_GOODSMVT_CREATE you get an absurd error about PS_PSP_PNR is wrong. And you ask yourself “When I tried to fill this freaky field?”

Never. You didn’t. But that weird FM does. And a NUMC initial field when MOVE’d to a C field delivers its zeroes to the character field. And the BAPI checks if that C field is initial, taking ‘00000000’ as a valid value.

I will not use this FM in my system for now. It’s pure crap, and its original coder needs to learn some things about the MOVE sentence. Sometimes I hate BAPIs ๐Ÿ˜ฆ