Hi all,
I've been looking a lot into HANA pretty much since the launch in 2012. Also i am very interested in how to make SAP a better place for the users. I personally think that NWBC and the use of powerlists is helping the usability in SAP a lot.
I have tried to look into how the HANA fits into the powerlist framework, and for now i have only seen that the powerlists can be cached in odata services. But this does doesn't really help us, who wants to use NWBC as the usual frontend.
SAP have posted blogs about how easy it is to create an ALV list based on a HANA view, and that is very cool. (If you are interested look here: How to use the SAP List Viewer (ALV) with Integrated Data Access on SAP HANA - YouTube )
However my blog today will be about how to expose a HANA view into the powerlist framework.
So first of all this is created on a suite on HANA system, so I don't need to access any other databases. I have an attribute view created in my HANA modeler which simply joins KNA1 and T005T. From this view I output the customer, name, city, postalcode, countrycode and country name.
From HANA studio ABAP perspective we can publish this view as a data dictionary view to be consumed in ABAP.
The view is an external view
Now this view is available in SAP ECC. So I can go to SE11 and view the data in it.
However the descriptions isn't copied to the table view. We will solve this problem for our powerlist by creating a structure with the same data
We are now ready to create our feeder class for the powerlist. Go to SE24 and create a class. Add the CL_02C_POWL_ABSTRACT_CLASS as a superclass
Now there are four methods we are going to reimplement in this tutorial, its the:
But first we will specify some attributes in our private section.
Here i am reusing my structure created before, this is much easier than declaring all the variables once again.
private section.
types: begin of gy_result.
include type ZSAT_KNA1_POWL.
TYPES end of gy_result.
types: BEGIN OF ty_ls_seltab.
types sign TYPE char1.
types option TYPE char2.
types low TYPE char4.
types high TYPE char4.
types END OF ty_ls_seltab .
types:
ty_lt_seltab TYPE STANDARD TABLE OF ty_ls_seltab .
types: gx_result TYPE STANDARD TABLE OF gy_result WITH NON-UNIQUE DEFAULT KEY .
data: mt_result type gx_result.
data MT_ACTIONS type POWL_ACTDESCR_TTY .
data MT_SELCRITERIA type POWL_SELCRIT_TTY .
data MT_FIELDCAT type POWL_FIELDCAT_TTY .
data MT_CRITERIA_DEFAULT type RSPARAMS_TT .
Afterwards i implement my get_object_definition with the following code
method IF_POWL_FEEDER~GET_OBJECT_DEFINITION.
e_object_def ?= cl_abap_tabledescr=>describe_by_data( mt_result ).
endmethod.
Then i specify my selection criteria to be used for selecting the fields. In this example i will only specify the customer number
method IF_POWL_FEEDER~GET_SEL_CRITERIA.
DATA: ls_selcrit TYPE powl_selcrit_sty,
ls_criteria_default TYPE rsparams.
IF mt_selcriteria IS INITIAL.
* LFA1-LIFNR
CLEAR ls_selcrit.
ls_selcrit-selname = 'KUNNR'.
ls_selcrit-kind = 'S'. " select option
ls_selcrit-param_type = 'I'. " input field
ls_selcrit-selopt_type = 'I'. "M & I " Select-option with interval and multi-selection
ls_selcrit-quicksearch_crit = 'X'.
ls_selcrit-datatype = 'KUNNR'.
ls_selcrit-ref_table = 'KNA1'.
ls_selcrit-ref_field = 'KUNNR'.
ls_selcrit-ddic_shlp = ''.
ls_selcrit-allow_admin_change = 'X'.
APPEND ls_selcrit TO mt_selcriteria.
e_selcrit_defs_changed = 'X'.
e_default_val_changed = 'X'.
c_selcrit_defs = mt_selcriteria.
c_default_values = mt_criteria_default.
ELSE.
c_selcrit_defs = mt_selcriteria.
c_default_values = mt_criteria_default.
e_selcrit_defs_changed = 'X'.
ENDIF.
CLEAR c_default_values.
endmethod.
Now i am ready to create my field catalog, which represents the columns in my list
method IF_POWL_FEEDER~GET_FIELD_CATALOG.
DATA: ls_fieldcat TYPE powl_fieldcat_sty,
ls_dfies TYPE dfies,
ls_fcat TYPE lvc_s_fcat,
l_seqnr TYPE int4.
DEFINE add_colpos.
add 1 to l_seqnr.
ls_fieldcat-colpos = l_seqnr.
END-OF-DEFINITION.
IF mt_fieldcat IS INITIAL.
CLEAR ls_fieldcat.
ls_fieldcat-colid = 'KUNNR'.
* ls_fieldcat-text_ref = ''. "Link-Action Reference
add_colpos.
ls_fieldcat-fixed = 'X'.
ls_fieldcat-display_type = 'TV'.
ls_fieldcat-col_visible = 'X'.
ls_fieldcat-technical_col = ''.
ls_fieldcat-enabled = 'X'.
ls_fieldcat-allow_filter = 'X'.
ls_fieldcat-allow_sort = 'X'.
ls_fieldcat-header = 'Customer number'.
ls_fieldcat-width = 16.
INSERT ls_fieldcat INTO TABLE mt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-colid = 'NAME1'.
* ls_fieldcat-text_ref = ''. "Link-Action Reference
add_colpos.
ls_fieldcat-fixed = 'X'.
ls_fieldcat-display_type = 'TV'.
ls_fieldcat-col_visible = 'X'.
ls_fieldcat-technical_col = ''.
ls_fieldcat-enabled = 'X'.
ls_fieldcat-allow_filter = 'X'.
ls_fieldcat-allow_sort = 'X'.
ls_fieldcat-header = 'Name'.
ls_fieldcat-width = 16.
INSERT ls_fieldcat INTO TABLE mt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-colid = 'ORT01'.
* ls_fieldcat-text_ref = ''. "Link-Action Reference
add_colpos.
ls_fieldcat-fixed = 'X'.
ls_fieldcat-display_type = 'TV'.
ls_fieldcat-col_visible = 'X'.
ls_fieldcat-technical_col = ''.
ls_fieldcat-enabled = 'X'.
ls_fieldcat-allow_filter = 'X'.
ls_fieldcat-allow_sort = 'X'.
ls_fieldcat-header = 'City'.
ls_fieldcat-width = 16.
INSERT ls_fieldcat INTO TABLE mt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-colid = 'PSTLZ'.
* ls_fieldcat-text_ref = ''. "Link-Action Reference
add_colpos.
ls_fieldcat-fixed = 'X'.
ls_fieldcat-display_type = 'TV'.
ls_fieldcat-col_visible = 'X'.
ls_fieldcat-technical_col = ''.
ls_fieldcat-enabled = 'X'.
ls_fieldcat-allow_filter = 'X'.
ls_fieldcat-allow_sort = 'X'.
ls_fieldcat-header = 'Postcode'.
ls_fieldcat-width = 16.
INSERT ls_fieldcat INTO TABLE mt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-colid = 'LAND1'.
* ls_fieldcat-text_ref = ''. "Link-Action Reference
add_colpos.
ls_fieldcat-fixed = 'X'.
ls_fieldcat-display_type = 'TV'.
ls_fieldcat-col_visible = 'X'.
ls_fieldcat-technical_col = ''.
ls_fieldcat-enabled = 'X'.
ls_fieldcat-allow_filter = 'X'.
ls_fieldcat-allow_sort = 'X'.
ls_fieldcat-header = 'Country code'.
ls_fieldcat-width = 16.
INSERT ls_fieldcat INTO TABLE mt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-colid = 'LANDX'.
* ls_fieldcat-text_ref = ''. "Link-Action Reference
add_colpos.
ls_fieldcat-fixed = 'X'.
ls_fieldcat-display_type = 'TV'.
ls_fieldcat-col_visible = 'X'.
ls_fieldcat-technical_col = ''.
ls_fieldcat-enabled = 'X'.
ls_fieldcat-allow_filter = 'X'.
ls_fieldcat-allow_sort = 'X'.
ls_fieldcat-header = 'Counrty'.
ls_fieldcat-width = 16.
INSERT ls_fieldcat INTO TABLE mt_fieldcat.
e_visible_cols_count = l_seqnr.
e_default_technical_col = 'X'.
e_fieldcat_changed = 'X'.
e_visible_rows_count = 10.
c_fieldcat = mt_fieldcat.
ELSE.
c_fieldcat = mt_fieldcat.
ENDIF.
endmethod.
Then its time for my get objects, which fetches the data from my HANA view
method IF_POWL_FEEDER~GET_OBJECTS.
DATA: lt_selcrit TYPE rsparams_tt,
ls_selcrit TYPE rsparams.
DATA: ls_seltab_kunnr TYPE ty_ls_seltab,
lt_seltab_kunnr TYPE ty_lt_seltab.
DATA: lt_result TYPE gx_result,
ls_result type gy_result.
FIELD-SYMBOLS: <lf_kunnr> TYPE gy_result.
LOOP AT i_selcrit_values INTO ls_selcrit.
CASE ls_selcrit-selname.
WHEN 'KUNNR'.
ls_seltab_kunnr-sign = ls_selcrit-sign. "'I'.
ls_seltab_kunnr-option = ls_selcrit-option. "'BT'.
ls_seltab_kunnr-low = ls_selcrit-low.
ls_seltab_kunnr-high = ls_selcrit-high.
APPEND ls_seltab_kunnr TO lt_seltab_kunnr.
endcase.
endloop.
select kunnr, name1, ORT01, pstlz, land1, landx into CORRESPONDING FIELDS OF TABLE @lt_result from ZAT_KNA1_POWL where kunnr in @lt_seltab_kunnr.
LOOP AT lt_result ASSIGNING <lf_kunnr>.
MOVE-CORRESPONDING <lf_kunnr> TO ls_result.
INSERT ls_result INTO TABLE me->mt_result.
ENDLOOP.
E_RESULTS = me->mt_result.
endmethod.
Ok we are done with the coding. Now its time to create our powerlist. Go to transaction POWL_COCKPIT.
On the initial screen press F8 and go to change mode afterwards.
Go to the bottom of the list and input the name of your powerlist application
Afterwards click the maintain type button
Then click new entries
Give your powerlist type a name and then input the feeder class, this is the name of your newly created ABAP class.
Afterwards we are ready to link the powl type to our application. Go back to the application maintanence and click register type
Now click new entries once again and add the name of your powerlist application and powerlist type (NB: Mine are called the same in this example)
Now we are ready to register our query, that will use our powerlist type.
Go back to the application maintenance and click register query
and then maintain query
Now give your query a name and then add the powerlist type you just created
Save and go back to the register POWL query list and then press new entries
Add the powerlist application and the query you have just created (NB: Once again i'm showing my lazy side and have named it the same)
Now everything is done!
We are now ready to test our hard work.
Go to your test client and Make sure that your customizing requests are copied to your test client
Then enter the transaction POWL_COCKPIT once again. Mark the line of your newly created powerlist application and then press launch powl
Now the power of HANA is unleashed in the powerlist framework
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
5 | |
5 | |
5 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 |