Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
martin_mayer
Advisor
Advisor

This blog is about how to replace the outdated function module in latest system using the Lightwight BICS API  (LBA)

function to be replaced

 

DATA lt_parameter TYPE  rrxw3tquery.
lt_parameter = VALUE #( ( name = 'VAR_LAND'  value = 'DE' ) ).

CALL FUNCTION 'RRW3_GET_QUERY_VIEW_DATA'
  EXPORTING
    i_query       = l_query
*   i_view_id     =
    i_t_parameter = lt_parameter
  IMPORTING
    e_axis_info   = lt_axis_info
    e_cell_data   = lt_cell_data
    e_axis_data   = lt_axis_data.
*   E_TXT_SYMBOLS

 

this call is showing an example for an analytical query with 1 query variable. Provide a query name and retrieve query resultset with table lt_cell_data. Depending on the use case additional information about axis and text symbols can fetched and need to interpreted by the caller.

replacing with LBA

using LBA the same query is called like this

 

DATA(lr_lba_query) = NEW cl_lba_std_query( i_query_name = l_query ).
Data(lt_varialbe_value) = VALUE cl_lba_std_query=>tn_t_values( ( name = 'VAR_LAND'  sign = 'I' opt = 'EQ' value_low = 'DE' ) ).
lr_lba_query->get_resultset( EXPORTING "i_t_requested_columns = 
                                       "i_t_filter_values     =
                                       i_t_variable_values   = lt_varialbe_value
                             IMPORTING e_t_column_catalog    = DATA(lt_column_catalog)
                                       e_r_resultset         = DATA(lt_resultset) ).

 

resultset comparision function module output and LBA output

martin_mayer_0-1707314594279.png
changing query desingtime setting at runtime

RRW3_GET_QUERY_VIEW_DATA has parameter i_view_id to overrule the query desingtime setting. A view_id contains other query resultset setting than the designtime with regards to dimension-& keyfigures selection and filter settings. The view_id need to be created before using it.

Overruling designtime setting with LBA works different , view_id's are not needed anylonger.

  • Instead dimension and keyfigure selection can be changed and set with each call dynamicly with i_t_requested_columns.
  • not providing or empty i_t_requested_columns means to select all available dimensions and keyfigures including dimension from free axis for resultset
  • Filters can be supplied with i_t_filter_values.

Further details are available with ABAPDoc in the code.

Also see this blog introducing LBA https://blogs.sap.com/2023/01/17/how-to-consume-an-analytical-query-bex-query-in-abap/

Release Info:  

Valid for all SAP_BW & BW/4 codelines equal or later than  SAP_BW 755 ( embedded BW 7.55 in S/4HANA 2009 ) and DW4CORE300 ( BW/4Hana 2021 )

1 Comment