Friday 27 November 2009

Enterprise class hardware for Enterprise class software

We wanted to set up a portable LAMP server for a home project we are playing with and there it is :

Since the little monster uses two SD cards as hard drives, it takes around four minutes to boot, but once it does boot, then its 900MHz Celeron CPU with its 1GB of RAM can stand up against a multi-threaded Java program gathering information from the local Ethernet and a complete Apache, PHP and MySQL server accessed for reporting.

Only thing is that the book is almost three times thicker than the machine.

Thursday 26 November 2009

SAP: All the little text tables

Even after 5 years of tampering with ABAP, I still have problems getting used to the way SAP name their production tables. All those four letter German abbreviated names are explanatory enough to scare away any newcomer. Even the English descriptive texts that SAP provides along with each object are so Spartan, that I very seldom can make any good use out of them.

Luckily enough, I have just the right person available who seems to know all the four -- or five -- letter permutations that yield SAP table and field identifiers. (Thanks again Marilena), so today I am going to steal a few of her knowledge and give us code fragments that show how to get descriptive texts for various material and production related key's like material names, groups, blocking statuses, MRP controllers, etc.

We will start with the names of storage locations. The field and the data type for those are named lgode. The table that stores related info is t001l.

   DATA :
     storage_location TYPE lgort_d, 
     storage_location_name TYPE lgobe.

    " storage_location = '...'.
    SELECT SINGLE lgobe
      INTO storage_location_name
      FROM t001l
      WHERE lgort = storage_location.

The next one is easy. Even I know by heart how to get the material description given the material number, but I will put it down anyway. The thing to mention however, is that most SAP text tables are language dependent, so to get the text for the key, you also need to specify the language

    DATA :
      material TYPE matnr,
      material_descr TYPE maktx.

    " material = '...'.
    SELECT SINGLE maktx
      INTO material_descr
      FROM makt
      WHERE matnr = material
        AND spras = sy-langu.

Material types are stored in table t134t which is also language dependent.

    DATA :
      material_type TYPE mtart,
      material_type_descr TYPE mtbez.

    " material_type = '...'.
    SELECT SINGLE mtbez
      INTO material_type_descr
      FROM t134t
      WHERE mtart = material_type
        AND spras = sy-langu.

Our next table is t141t, that stores the various texts for the material blocking statuses.

    DATA :
      mat_blocking_status TYPE mstae,
      mat_blocking_status_descr TYPE mstb.

 " Material blocking status descriptions
    SELECT SINGLE mtstb
      INTO mat_blocking_status_descr
      FROM t141t
      WHERE mmsta = mat_blocking_status
        AND spras = sy-langu.

We wil now move to the inspiringly named t023t table, that provides access to the short and long names of material groups.

    DATA :
      material_group TYPE matkl,
      mat_group_short_descr type wgbez,
      mat_group_long_descr TYPE wgbez60.
    
    " material_group = "...".
    SELECT SINGLE wgbez wgbez60
      INTO (mat_group_short_descr, mat_group_long_descr)
      FROM t023t
      WHERE matkl = material_group
        AND spras = sy-langu.

Product hierarchy descriptions are found in in t179t.

    DATA :
      mat_hierarchy TYPE prodh_d,
      mat_hierarchy_descr TYPE vtext.

    " mat_hierarchy = '...'.
    SELECT SINGLE vtext
      INTO mat_hierarchy_descr
      FROM t179t
      WHERE prodh = mat_hierarchy
        AND spras = sy-langu.

Table t438t stores MRP type descriptions.

    DATA :
      mrp_type TYPE dismm,
      mrp_type_descr TYPE disbez.

    SELECT SINGLE dibez
      INTO mrp_type_descr
      FROM t438t
      WHERE dismm = mrp_type
        AND spras = sy-langu.

Last table for today's post will be t024d. this one contains MRP Controller descriptions and is not language but plant organized.

    DATA :
      plant TYPE werks_d,
      mrp_controller type idspo,
      mrp_controller_descr TYPE disnam.

    SELECT SINGLE dsnam
      FROM t024d
      INTO mrp_controller_descr
      WHERE dispo = mrp_controller
        AND werks = plant.

... and that is enough for one day.

Thursday 12 November 2009

The CakePHP manual in PDF

if anybody wants a PDF version of the entire CakePHP manual as it appears in http://book.cakephp.org/, the book is available from here.

I created this document by copying and pasting text from the book website into an OpenOffice text document, because I wanted to have something to print and browse like a normal book. I have also added a few Oracle specific instructions. It is therefore possible, that some things may have slipped me. I will try and change this document every time I find an error or add a correction. Please feel free to post any mistakes you may find.

Last uploading: January 5-2010