Saturday, October 5, 2013

Go HANA!

Greetings,

Unless you have been living under a rock, you have probably heard of HANA.
What you might not have heard yet is that you can try HANA for free:

http://scn.sap.com/docs/DOC-28197

Go forth and have fun.

What really made me interested in this technology is that you can code server-side JavaScript. I am not sure whether they use V8 or whether they run JS on top of the JVM, but either way this rocks!

Docs are here.

PS : When deciding which Java EE 6 Web Profile to download, go for the SAP HANA Cloud SDK for Java EE 6 Web Profile , this one has all the API's.

PPS : When deploying to Hana One your account is xxxtrial ( xxx being your regular SAP user id ), your userid is xxx. While this seems obvious, it had me stumped.

Monday, September 30, 2013

Ask Stackoverflow and Code Review

Greetings,

sometimes you just need a second pair of eyes to look at a problem, or a piece of code.

Enter stackoverflow.com, a question and answer site with some excellent folks answering almost every ABAP question.

For code review, there are not a lot of reviewers yet for ABAP code. But if you have doubts about your code, you are almost certain to get valuable feedback which you can take or leave.

Remember; your code should be DRY, blunt, boring and working.

Splitting strings to tabs

Greetings,

in my previous post you will find on help.sap.com some horrendous code to split a binary string into a internal table. Which is funny, since they provide this wonderful function:

    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer     l_binary_string
      TABLES
        binary_tab it_binary_content.


The function analyze the size of the table you provide and does all the heavy lifting.

The counterpart for regular strings to a text table is here:

    CALL FUNCTION 'SCMS_STRING_TO_FTEXT'
      EXPORTING
        text      l_text_string
      TABLES
        ftext_tab it_text_content.

Content Management and BSP

Greetings,

SAP has an answer for everything, including content management.
If you want to store a document in SAP via an HTTP interface, you can start here: 

http://help.sap.com/saphelp_nw04/helpdata/en/b9/e1623c046a9b67e10000000a11402f/content.htm

The code is fairly straightforward to follow, but does not work, at least not for me.
The reason is that SAMPLELOIO and SAMPLEPHIO are not real KW classes.

Instead you can decided to use KWN_GEN and KWN_GENSRC, you will get some errors then about missing properties which you can solve by adding those properties to loio_properties and phio_properties with some default value. The only exception to that is STORAGE_CATEGORY, I found that using the value DMS_C1_ST will do the trick.

I would suggest you store the class and the wa_phio-objid into a Z table for easy reference later. When you want to retrieve a stored file, you can simply use the code from here:

http://help.sap.com/saphelp_nw04/helpdata/en/74/a2623c2d6a1e66e10000000a11402f/content.htm


Tuesday, June 25, 2013

Repricing of a purchase order

Greetings,

it turns out that changing data in a purchase order which ought to impact pricing does not trigger re-pricing.

For that to work, you must know the following:

* You must set for the item ( bapimepoitem ) in question calctype to 'B'
* You must set for the corresponding itemx ( bapimepoitemx ) calctype to 'X'.
* Look at the domain values of KNPRS if you wish to not just 'Carry out new Pricing'


If you want to override the default pricing date, you can set it by changing bapimepoitem-pricedate.

Obviously, it would be bad practice to force re-pricing by default if you are concerned about system load and response times.

Hat tip to:
http://help-sap.blogspot.com/2012/07/po-re-price-issue-in-bapipochange.html

Zip files with ABAP

Greetings,

I've noticed that every project of sufficient complexity requires zipped files.

Whereas before we used to fiddle with command line zip programs and OS commands, we can now use the extremely simple CL_ABAP_ZIP. Simply create the object, add files by calling the method ADD, get the zip file in an XSTRING by calling SAVE.

Mass updating of anything

Greetings,

part of why I started this blog is because much of the knowledge I find with Google is stored on sites that have not been touched in years, so I jot down the things that took a longer time to find .

If you want to see whether you can mass update a business object ( purchase order in my case ), try the transaction MASS.


Choose your object, and Bob's your uncle.