Git Product home page Git Product logo

abak's Introduction

(abaK is now in beta stage. It's mostly stable but its API can still change and more tests need to be done so please don't use it in a production environment yet. Wait for a non-beta release.)

abaK

A powerful yet simple ABAP library to manage constants.

Why

Nowadays, whenever a constant is needed in a program, it has to be hard coded, stored in a dedicated custom ZTABLE or, even worse, stored in the standard table TVARVC (or similar).

What

abaK aims to become the standard constants library that ABAP so desperately needs.

It's single design goal is to address most common needs while still being extremely easy to use, by both developers and functional people alike. And if its standard functionality doesn't cover your particular needs, you can easily extend it.

With abaK you can finally stop developing a new ZCONSTANTS table every time you need one. Or, even worse, stop storing your constants in obscure standard tables like TVARVC.

How

abaK offers a simple yet powerful and flexible way for any program to manage its constants. Advantages of using abaK:

  • decentralized: there is no monolithic table holding all the constants. One program can decide to have its own constants source.
  • easily customizable: a project can decide to have its constants maintainable directly in PRD while another may required them to be maintained in DEV and then transported;
  • multiple scopes: some constants can be used system-wide while others can belong to a single program and no one else will mess with them;
  • system-wide management: constant sources are registered in a central table so that it is easy to keep track of the existing data sources;
  • different formats: besides using a custom database table, the constants data can be formatted as CSV, XML or JSON;
  • different content locations: besides providing content directly inline, it can also be fetched from an URL, an SO10 standard text, a GS03 set, a server file or even another abaK instance in a remote SAP system via RFC;
  • extensible: if needed, new custom FORMAT/CONTENT classes can be created (ex.: to read legacy data in a specific data format).

Providing a well-defined API, abaK clearly separates the way it is used from the way the constants are stored.

Documentation in the wiki.

Requirements

  • ABAP Version: 702 or higher.
  • abapGit

FAQ

For questions/comments/bugs/feature requests/wishes please create an issue.

abak's People

Contributors

nununo avatar sdfraga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

abak's Issues

Allow for format type JSON

Similar to ZCL_ABAK_FORMAT_XML but expects an inline JSON format instead of XML.

Proposed format:

{
  "abak": {
    "name": "Project Z",
    "k": [
      {
        "ricef": "GLOBAL",
        "fieldname": "BUKRS",
        "context": "MAIN",
        "value": "1234"
      },
      {
        "ricef": "PROJZ",
        "fieldname": "WRBTR",
        "v": [
          {
            "sign": "I",
            "option": "EQ",
            "low": "1000"
          },
          {
            "sign": "I",
            "option": "BT",
            "low": "2000",
            "high": "3000"
          }
        ]
      }
    ]
  }
}

Replace Wiki with a documentation folder

Similar to how it's done in https://docs.abapgit.org/:

Lars explained:

GitHub pages are built and published automatically when there is a push to master, see https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/
And then GitHub also works with Jekyll, see https://help.github.com/articles/using-jekyll-as-a-static-site-generator-with-github-pages/
Its a lot of work to set up the first time, but after that it just works. You can also start out with simple html or markdown which will be published automatically.

Add validation rules to usage report

For each table found:

  • If FIELDNAME has more than one word this is a multi. In this case
    • we need one value per FIELDNAME word
      • OPTION must be EQ
      • SIGN must be I
      • LOW must be filled
      • HIGH cannot be filled
      • INDEX must be 1 (only 1 line allowed because no ranges possible)

Combine multiple fields?

What if we want to create constants which are comprised of more than one field? Like:

BUKRS WERKS
1111 AAAA
1111 BBBB
2222 CCCC

Currently abaK's API always focus on a single field. Which is the most common scenario and thus should remain the its main focus.

But... would it be possible to extend abaK's functionality to accomplish this without destroying its simplicity and clarity?

Implement ABAP Doc

Using the synchronized keyword to keep everything in sync with the old descriptions.

Would it be possible to get rid of ZABAK_XML_K?

The only reason for having a specific structure for the XML format is the fact that we can have a simplified value directly in the K node, avoiding the need to create specific K subnodes.

But maybe if a smarter XSLT transformation is used instead of the relatively limited ST... the XML could be directly converted into ZABAK_K structures. This would require creating a KV line every time the value was directly defined in the K node. This would probably also allow for testing if both inline value and V nodes exist and yield an error.

Wizard to create constants table

This is a report (ZABAK_CREATE_TABLE?) which asks:

  • Table name
  • Table type (Application/customizing/etc)
  • If the Maintenance view should be generated
  • Function group for the maintenance view
  • If it should be registered in ZABAK
  • ZABAK: with or without Shared Memory
  • Other relevant options?

And then:

  • Creates the table with the proper includes
  • Creates the maintenance view
  • Registers it in ZABAK

Simplify creating new custom FORMAT and CONTENT classes

Currently there are classes ZCL_ABAK_CONTENT_CUSTOM and ZCL_ABAK_FORMAT_CUSTOM. Their sole function is to set GET_TYPE() = CUSTOM. This doesn't do much. So I'll simplify things by getting rid of these.

So, in order to make a new _CONTENT one will inherit from abstract class ZCL_ABAK_CONTENT as all the other _CONTENT classes. And to make a new _FORMAT one will implement interface ZIF_ABAK_FORMAT as all the other _FORMAT classes.

Simpler is better.

Get rid of ZCL_ABAK_UNIT_TESTS and table ZABAK_UNITTESTS

Wouldn't it be more consistent to rely on DEMO data for the unit tests?

  • Create an autonomous way (report?) to generate the _DEMO data
  • Make all unit tests use the DEMO data instead of the UNITTESTS data
  • Stop using class ZCL_ABAK_UNIT_TESTS
  • Delete class ZCL_ABAK_UNIT_TESTS
  • Delete table ZABAK_UNITTESTS

Make new format to read constants from GS03 SETs

Sets are a good way to store constants. Why not integrate them with abaK also?

They're kind of complex because they allow for hierarchies but it should still be feasible.

I guess it can be called ZCL_ABAK_FORMAT_SET.

What is ZIF_ABAK_SOURCE~GET_TYPE() supposed to return for custom sources?

The return parameter is of type ZABAK_SOURCE_TYPE which is an internal type associated with a dictionary of a few fixed values. This doesn't make sense. It should either be fixed as CUSTOM or allow for free text.

And the same probably applies to `ZABAK_FORMAT~GET_TYPE() in the case of custom formats.

Should CONTENT be renamed to SOURCE?

This is kind of radical at this stage and yet not too late to consider and execute.

The current content flavours are all actually sources of information:

  • database;
  • file;
  • inline;
  • rfc
  • set
  • standard text (SO10)
  • url
  • mime repository (upcoming)

So it would probably be much more clear to call it what it is.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.