GithubHelp home page GithubHelp logo

refusta / abap_fm_json Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cesar-sap/abap_fm_json

0.0 1.0 0.0 306 KB

JSON adapter for ABAP Function Modules.

Home Page: http://scn.sap.com/community/abap/connectivity/blog/2013/03/05/json-adapter-for-abap-function-modules

License: Apache License 2.0

abap_fm_json's Introduction

JSON Adapter for ABAP Function Modules

Welcome to the JSON adapter for ABAP Function Modules!! (or adaptor)

This adapter was first published in SAP SCN blog (http://scn.sap.com/community/abap/connectivity/blog/2013/03/05/json-adapter-for-abap-function-modules). The blog remains its main reference and discussion place.

This adapter is specific to SAP ABAP systems. It should work on any SAP release from 7.0 onwards, however some slight modifications may be needed for older SP levels.

The purpose of this adaptor is to allow calling ABAP function modules via HTTP and serializing the input and output in JSON format. This allows a very simple way to invoke ABAP functionality from HTML5 and AJAX or Jquery based applications.

How to install

In order to install this you need SAPLink. First install SAPLink in your ABAP server following the SAPLink installation instrucctions. Be sure to install the required SAPLink plugins. To minimize trouble, I recommend your installing the Nugget that contains all commonly used plugings.

This adaptor works with any ABAP version from 7.0 onwards. I have tested it in 7.31 and 7.40, which are the two releases where I can currently maintain it. If you are using any older release please contact me for indications.

As a rule, to make it work in any pre 7.31 release, you have to comment out all calls to the ABAP built-in JSON converter, that is, the calls to the methods SERIALIZE_ID and DESERIALIZE_ID in HANDLE_REQUEST and the code inside both methods. You cannot use them anyway in pre 7.31 releases.

ABAP Authorization

The module includes an AUTHORITY_CHECK call to a custom authorization object named Z_JSON that validates if the user can access the function module.

You must create and authorization object with the name Z_JSON and just one field named FNMANE as authorization objects are not yet transported with SAPLink. Use transaction SU21 for this.

The authorization object will be included in the corresponding user profile. An asterisk (*) will allow the user to access all function modules. It is very recommended that any user that is going to access function modules through this adaptor has a profile with just the functions that he is allowed to access.

How to invoke

Create ICF service

You must create a service in ICF to make an endpoint for the adaptor. Here goes an example in transaction SICF:

Define ICF service for the JSON adaptor

In this example, you will invoke the service using the following syntax:

http(s)://your_abap_server:<port>/fmcall/<function_module_name>?<parameters>

Function module parameters

You can pass as GET query string parameters any of the function IMPORT parameters that are defined and single data types (not structures or tables).

In order to pass structures or tables to the function module, use any of the HTTP methods that support a content body (POST or PUT mainly).

Some parameters exist as standard. Most notably:

format=<output_format set the format of the response, lowercase=X will show ABAP variable names in lower case, show_import_params=X will include the IMPORT parameters in the response, callback=<callback_name> wraps response in a JavaScript callback function.

Supported output formats

The adaptor can produce output in the following formats:

JSON:

XML:

YAML:

PERL: just for fun.

Session and logon support

Cross Site requests

Notes

ABAP based or transformation based serializers

Contact

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.