Liquid UI - Documentation - 4.07 Calling BAPIs and using ABAP Packed Structures in WS

4.07 Calling BAPIs and using ABAP Packed Structures in WS


Purpose

Web Services(WS) now support calling SAP BAPIs using Remote Function Calls (RFCs). When returning data BAPIs often use structures with components that may include packed BCD types, which can introduce invalid null characters. To properly handle these, a structured definition must be used to parse the return value.

Prerequsite

The function module must be remote callable, or Liquid UI cannot execute it via RFC.

ex: SAP_WAPI_COUNT_WORKITEMS
BAPI_MATERIAL_GET_ALL
ALM_ME_FUNCLOC_INSTALLED_EQUI
BAPI_ALM_ORDER_GET_DETAIL
BAPI_USER_GET_DETAIL
BAPISDORDER_GETDETAILEDLIST

By using this command with an additional structure object, different data types can be retrieved from the function module.

 

Note: This feature is available from WS version 1.2.326.0 or Server version 3.5.563.0 and above

 

Step 1: Confirm output structure according to the parameter

The structure of each output parameter needs to be specified individually. Its details can be referred from the SE37 transaction in SAP.

Using transaction SE37, we look at an FM like the following:

Here, we are considering BAPI_MATERIAL_GET_ALL and navigating you through the following steps below:

  1. Login to SAP navigate to SE37 transaction, enter BAPI_MATERIAL_GET_ALL, and click Display.
     
     
  2. In the Associated Type, you can see BAPI_MARA__GA. That is the return type for the Parameter, CLIENTDATA. Double-clicking on the BAPI_MARA_GA, will navigate you to the Dictionary: Display Structure, where you can view the components, as shown in the image below.
     
     

    This means, that the CLIENTDATA return value, will be returned in a stream of bytes, that corresponds to this ‘Structure’. Most of the ‘Components’ of this structure will be in text, and therefore carefully calling ‘substring’ with meticulously calculated value will often yield the correct answer. However, when the Component is of type ‘QUAN’, like ‘QTY_GR_GI below:


Can't find the answers you're looking for?