SAP NetWeaver Gateway : A Step-by-Step Guide for Beginners

By Guest Blogger Kenny Sutherland, SAP Technical Intern, DataXstream

In three-tier architecture, SAP Gateways make up the middle or application tier. This middle layer is essential for communication between the frontend and the backend. The use of multi-tier architecture to implement a data processing system adds a valuable level of modularity and flexibility to the system by being able to develop and maintain each tier individually.  The purpose of this tutorial is to create a Gateway that will extract data from the flight carrier database table, which will be accessed from the Gateway Client. The Gateway will be able to retrieve a list of carriers as well as individual carriers.  Let’s get started…

Creating a New Project

  • First, navigate to the Gateway Service Builder with the T-Code “SEGW”
  • Click the “Create Project” button

Screen Shot 2015-07-07 at 3.42.25 PM

  •  Give the Gateway project a name and a description
  • Save the project and assign it to the appropriate package. For the purpose of this demo the project will be saved as a local object ($TMP or click the button “Local Object). The Gateway project has now been successfully created

Screen Shot 2015-07-09 at 4.18.25 PM

Creating an Entity & Entity Set

  • What is an Entity and Entity Set?
  • An Entity is a structure that can be defined by the user or defined as an ABAP Data Dictionary structure.  An Entity Set is simply a collection or table of Entities.
  • Right click Data Model and select “Import” -> “DDIC Structure” to use an ABAP Data Dictionary structure

Screen Shot 2015-07-07 at 3.30.20 PM

  • Type “SCARR” for ABAP Structure and press enter. A list of properties should appear
  • Make “Carrier” the object name for the entity
  • Change the “Usage” of the property “MANDT” to “Ignore” and click the check mark at the bottom right


  • Double click the folder “Entity Sets”
  • Click “Insert Row” and name the Entity Set

Screen Shot 2015-07-07 at 3.42.25 PM

  • The naming convention is to either make the Entity Set name the plural form of the name of the entity or append “_Set” to the Entity name. For training purposes, name the entity set “Carriers” or “Carrier_Set”. “Carriers” will be used for the remainder of this tutorial
  • Use the Entity name, “Carrier”, for “Entity Type Name”. Make sure to save and the Entity and corresponding Entity Set have successfully created

Screen Shot 2015-07-07 at 3.47.51 PM

How to Generate ABAP Classes

  • Click on the “Generate Runtime Objects” button towards the top left of the IDE

Screen Shot 2015-07-07 at 3.40.44 PM

How to Activate Gateway Service

  • Navigate to the “Activate and Maintain Services” page, “/iwfnd/maint_service”, and click “Add Service”

Screen Shot 2015-07-09 at 9.47.43 AM

  • Set System Alias to “LOCAL” and Technical Service Name to the name of the Gateway

Screen Shot 2015-07-09 at 9.49.04 AM

  • Click “Local Object” and then the check button to save

Screen Shot 2015-07-09 at 9.52.08 AM

  • Go back to the “Activate and Maintain Services” page, click on the service name, and click on “Gateway Client”

Screen Shot 2015-07-09 at 10.08.45 AM

  • To test the service, verify the “HTTP Method” is set to “GET” and then click “Execute”. There should now be some auto-generated XML

Screen Shot 2015-07-09 at 10.22.04 AM

  • In order to view the entity and its properties add a URI option to the end of the URI. Click “Add URI Option” and use “$metadata” and “sap-ds-debug=true”

Screen Shot 2015-07-09 at 10.23.05 AM

  • Now we can see the Entity Type as well as its properties

Screen Shot 2015-07-09 at 10.25.49 AM

Congratulations! You have made a usable Gateway Service. Now the backend functionality of the Gateway must be coded in order to make it useful.

Implementing GetEntitySet

  • Navigate back to the gateway service builder, expand the “Service Implementation” folder, and expand the entity set. There will be a few auto-generated methods
  • Right click “GetEntitySet”, click “Go to ABAP Workbench”, and ignore the popup that follows. This will take bring up the Class Builder

Screen Shot 2015-07-09 at 10.34.41 AM

  • In the left menu, expand the “Methods” folder, right click on the “GET_ENTITYSET” method, and select “Redefine”

Screen Shot 2015-07-09 at 10.38.09 AM

  • Under “Signature”, what the method is exporting to the frontend service can be seen, “ET_ENTITYSET”. This exporting table needs to be populated with data from the backend database
  • It is generally bad practice to select all the records from a database table because it can be extremely inefficient and redundant so instead of using “SELECT *”, only select the first 100 records from the database using the following statement…
  • Activate the method
  • To debug this code, set an external breakpoint. Session breakpoints will not work using the Gateway Client. Now the method needs to be tested

Screen Shot 2015-07-09 at 10.55.42 AM

Testing GetEntitySet

  • Reenter the “Activate and Maintain Services” or if it is already in a window click “Refresh Catalog”
  • Open the service again using the Gateway Client
  • Append the name of the Entity Set to the end of the URI, verify “HTTP Method” is set to “GET”, and execute. There should now be multiple Carrier entries

Implementing GetEntity

  • To get an individual Carrier, the Get_Entity method must be implemented
  • In the Class Builder, right click CARRIERS_GET_ENTITY and select “Redefine”
  • Add the following code,
“DATA: ls_key_tab LIKE LINE OF it_key_tab.
    READ TABLE it_key_tab INTO ls_key_tab WITH KEY name = 'Carrid'.
    SELECT SINGLE carrid carrname currcode url FROM scarr
      WHERE carrid = ls_key_tab-value.”
  • The above code will select a Carrier using the Carrid that will be passed into the URI
  • Activate this method and open the Gateway Client one more time
  • Make sure HTTP Method is “GET”, type “/sap/opu/odata/sap/Z_GATEWAY_DEMO_SRV/Carriers(‘AF’)” for the URI, and press execute
  • There should now be an individual Carrier using the Carrid that was just passed in the URI


Congratulations! You have made your first Gateway Service.

Kenny Sutherland is a current Christopher Newport University student working towards a degree in Information Systems.

This summer, Kenny is focused on an individual learning assignment under the direction of a senior consultant that deals directly with DataXstream’s OMS+ Solution software. His work primarily focuses on the back-end payment functionality of OMS+. Kenny is showing true leadership skills and DataXstream is proud to extend an offer for full-time employment upon completion of his studies at CNU. Kenny brings a lot to the table, including skills in JavaScript, HTML, and several other programming languages. He recently took home first place at CNU’s Software Fair!

We welcome prospective interns to contact us about starting your journey at DataXstream!

Visit our Jobs page or email our Director of Human Resources for more information.


SAP ABAP/PI Developer Position

Location: US-Multiple Locations

DataXstream, an SAP focused organization, has experienced significant growth over the last 2 years.  We are currently seeking an SAP ABAP/PI Developer to add to the team.  This role will be critical and will include a diverse set of responsibilities over multiple areas of the business:

Technical Qualifications:

  • 7+ years of experience in ABAP/PI/XI Programming is required
  • Experience with EDI strategy and tools
  • Understanding of Object Oriented concepts
  • Experience with Data Dictionary, Function Modules (Remote Enabled), BAPIs, Web Services
  • Experience creating/modifying Adobe Forms
  • Proficiency with ALE/IDocs including error handling is desirable
  • Experience working with SAP ECC 6.0
  • Programming experience in various modules – MM, SD, FI
  • Work will primarily be remote, but could be potential for periodic travel to client sites

Additional Qualifications:

  • US citizens and those authorized to work in the US are encouraged to apply. We are unable to sponsor H1b candidates at this time.
  • Sharp, energetic consultants with an understanding of business processes
  • Self-starter
  • Ability to work both individually and as part of a team
  1. (required)
  2. (required)
  3. (valid email required)
  4. (required)
  5. (required)
  6. (required)
  7. (required)
  8. (required)
  9. (required)
  10. Captcha
  11. *By submitting this form you are agreeing to receive periodic communications from DataXstream. DataXstream will not share, sell or provide any of said information to a third-party for any reason. You can unsubscribe at any time by following the unsubscribe link at the bottom of all emails or sending an email to with the subject line “unsubscribe”.

cforms contact form by delicious:days


Enhancing SAP Lean Order Management for SAP Retail Part 3: Enhancement Framework

Creating Custom Views, Events, and Controlling the Visibility of Data Elements

In my previous two posts in this series, I discussed how to control field level help information and how to influence the look, feel and flow of the end user experience. In this entry, I will discuss some of the LOM capabilities for controlling what happens behind the scenes to manage technical events as well as screen content. For example, during transaction processing the system locks table entries to prevent other users from updating data while you are processing it. As in many technical endeavors, good housekeeping and cleaning up after yourself is always appreciated. To quote Roger Manifold, “Good manners don’t cost nothing”.

The enhancement framework concept is used to create custom views, handling of those custom views and dynamically controlling the visibility of different elements within Lean Order Management.

The FPM (Floor Plan Manager) with the Web Dynpro application interface provides you with methods to allow the application to participate in all FPM events that happen during the entire lifetime of the application.

Within the package ERP_SLS_LO_OIF, the main Web Dynpro component is LO_OIF_MAIN_COMP. Open this Web Dynpro application using transaction code SE80. The first step is to create an enhancement by clicking the enhance button or CTRL+F4 key. [Read more...]

Enhancing SAP Lean Order Management for SAP Retail Part 2: Configuring LOM

In the previous blog post, I discussed how to tailor the contents of field level help dropdown lists.  This kind of customizing is very specific, detailed and should always be thought through carefully.  In this post I discuss a higher level of customization of Lean Order Management, namely the look, feel and flow of the end user transaction screens.  This in turn influences the process flow and can be used to ensure the end user actions occur in the required sequence.

SAP often gets a bad rap for their GUI design, whereas other companies (can you think of a crisp, golden delicious fruit?) are lauded for their GUI design.  This doesn’t happen by accident and it isn’t easy.  “Intuitive” designs can be anything but intuitive and understanding your end user audience, their skills, expectations and willingness to learn is imperative when designing with LOM functionality.

In this regard, a recurring theme with LOM is to think it through before acting: LOM is a powerful tool and, to paraphrase, with that power comes responsibility.  Ideally, any LOM development work is preceded by detailed whiteboard sessions to map out the screen flow, the required buttons and actions, pop-up windows and possible responses, otherwise it is easy to end up doing basic design on the fly – and that rarely ends well.

Anyway, enough of the preamble – how do we make this magic happen in SAP? [Read more...]

Enhancing SAP Lean Order Management for SAP Retail Part 1

The objective of this series is to provide quick reference which may be used as a guide while enhancing Lean Order Management built with Web Dynpro and based on Floorplan Manager.

This is the first of three blog posts that discuss SAP LOM functionality. The first provides a high level introduction to LOM and how to modify the SAP table value help process to display available values. These are the value lists usually accessible using the F4 key in the SAP GUI.

The second post discusses how to configure LOM, and the third posting discusses the enhancement framework that allows you to build custom views and dynamically control screen content.

Enhancements in Lean Order Management

Before we start a discussion the technical aspects of SAP’s Lean Order Management (LOM) we need to understand the goal of order management itself.

Wider Goals of Order Management

  • To ensure or create coherence between tasks, organizations, functions and information systems (both manual and electronic) in the customer order flow
  • To ensure or create awareness of time consumption, bottlenecks, changes of responsibility and costs in the administration and at the shop floor
  • To remove non value-adding activities and non-value-adding information by reorganizing structures, tasks and systems towards lean principles

With order management is the necessity to simplify and streamline the process for taking an order from a customer. In my opinion, many companies spend more time (man-hours & lead-time) on order processes than production.

In many companies more time (man-hours & lead time) are spent on order processing than on production. [Read more...]

Five Tools all Junior SAP ABAP Developers Should Know

For those of you new to SAP, be you technical or functional, her are a five tools you need to know to successfully navigate through the SAP landscape.

*Disclaimer* These tools will not provide the answer to your problems, but they should give you insight and the ability to solve your problem.

[Read more...]

It’s SAP Upgrade Time! Do You Know Where Your Customizations Are? Part 2.

In my last post on this topic, I discussed two negative effects of customizations in an upgrade project – risk and cost.  I also discussed an obvious reason to eliminate unnecessary customization – the mitigation of risk and cost.

In this post, we will look at some of the customization areas which add risk and the cost to an upgrade project.

[Read more...]

SAP Data Migration – Dealing With Fallout (Part 3)

One of the inevitable aspects of data migration is dealing with fallout from automated data loads.  Typically, this process includes identifying the data that will not load, analyzing the error messages to determine the root cause, formatting a readable report that can be used as a tool in the cleanup process, and fixing the root cause of the problem so that it does not happen again.

Why the data will not load correctly.

There is a litany of reasons why some data records will load correctly while others will not.  Here is a list of some common root causes:


  1. Poor quality legacy data.
    Legacy systems which are not as tightly integrated as SAP, and are not under master data control allow the end user a bit of freedom when entering data.  A zip code may contain too little or too many characters; the email address is not properly formatted; numeric fields have transposed digits; various forms of abbreviations (especially in the city field), a quantity of zero (0) permitted by the legacy system and uploaded into a field where SAP will not accept a quantity of 0 and even simple misspellings  all can cause stringent validation checks to trigger an error and prevent the record from loading at all.  A more sinister type of error occurs when the data is functionally incorrect, but good enough to pass all of the SAP validity checks.  In this case, the data record will technically load into SAP, but will not be functionally correct.  Duplicate customers, duplicate vendors, and the data entry error for a quantity of 1000 instead of 100, and the wrong pricing condition applied to a sales order line are examples of this scenario.



  1. Functional configuration and supporting data effects.
    Many times I have watched the load statistics for a data object plummet from near 100% in the cycle two test load to near 0% in the cycle three test load.  This is very unnerving to the client because the cycle three test load is getting rather close to the go-live date, and “by the way, shouldn’t the statistics be getting better rather than worse?”  Functional configuration changes can wreak havoc on any data load.  Flipping the switch on a data field from optional to required; turning on batch management or serialization for materials for the first time; changes in the handling of tax, tax codes, and tax jurisdiction codes; that account determination entry that is missing or not set up correctly; a missing unit of measure or unit or measure conversion factor; the storage location in the upload file which does not exist in SAP – any of these can cause a load to drop mostly or completely onto the floor.While change is inevitable on any project, it is important to control and communicate the change so that the downstream impact can be recognized and understood.   Controlled change and communication always works better than total surprise.  Perhaps if we all know ahead of time about that data field that is now required, we can impose a requirement on the data extract side to make sure that the data field is populated before it enters the upload file.
  2. Additional data in the upload file.
    Inserting a new field in the middle of the upload file data structure might be necessary for the business to close a gap, but if that change is not communicated to the technical team so that appropriate adjustments can be made to the load object’s input structures and processing logic, the new data will surely never load, and may cause misalignment of the data fields which follow it in the upload structure.

[Read more...]

SAP Data Migration – Answering the Important Questions (Part 1)

It is data migration time on your SAP business project.  Whether your project is implementation, acquisition, or merger, the goal is pretty much the same: the seamless inbound acquisition of master and transactional data from one or more external data sources while ensuring that this activity has minimal impact on the rest of the business.  This is where we attempt to move years of neglected master and transactional data from a loosely structured, anything-goes legacy system into a very tightly integrated and highly structured SAP system.  You must consider the likelihood that the concept of master data management had not been invented yet when the legacy or source system providing your data was implemented.

How much data to move? How much data to leave behind? What to automate, and what to execute manually?  How to gracefully orchestrate and execute a data migration cutover from one system to another?  Where and how to fit the data migration plan into the overall business implementation plan?  How to continue to run the business during the data migration phase of the business project implementation? These questions are all part of the planning fun!

[Read more...]

Using Native SQL in an ABAP Proxy

Recently, I was looking at a requirements document to build an interface to an external system that wants to query customer master data by the customer first name and last name.  As I read this, there were a cacophony of thoughts, all demanding equal attention, racing through my head:

  • How will I ever match the inbound interface parameter “Tom” with “TOM”, or “tom”?
  • How will I ever match the inbound interface parameter “Smith” with “SMITH” or “smith”?
  • The ABAP WHERE clause is not case-INsensitive.
  • There could be hundreds of customers named Tom Smith.
  • KNA1-NAME1 and KNA1-NAME2 are not indexed fields.
  • And no, we are not storing any portion of either first or last name in an existing indexed field like SORTL.
  • There are well over one million customers in the database.
  • We have already decided to use PI for all interfaces.
  • I will have to buy the BASIS team a case of beer to get them to agree to create indices on the fields KNA1-NAME1 and KNA1-NAME2 in a table with over one million records.

I arrived at the conclusion that I need a case-insensitive database query, along with database indices created for the fields KNA1-NAME1 and KNA1-NAME2.

But, what is a case-insensitive WHERE clause?  A little research and help from colleagues revealed that many had gone before me, and this was nothing new.  To implement a case-insensitive WHERE clause in ABAP, you simply needed to use the native SQL UPPER() construct. The database system that is being used is Microsoft SQL Server, but the UPPER() function and its syntax is similar across different database platforms. This seemed like an easy nut to crack. But, as I soon found out, I actually had a lot to learn.
[Read more...]