POWL(Personal Object Worklist) for Web Dynpro
Summary
This document illustrates how to make personnel object work list, Feeder class and how to integrate POWL with WD ABAP.
Author: Rohan Sanjay Uphade
Company: NTT DATA India EAS Ltd.
Created on: 12 December 2012
Author Bio
Rohan is SAP certified Consultant and works in NTT DATA, He has work experience in SAP ABAP , Dynamic programming,
WebDynpro ABAP, POWL , Smart forms , Adobe forms and so on.
Main Steps Involve in creating POWL Feature.
- Create Feeder class
- Implement Feeder class method
- Define Application id, Type, Role and queries
- Integrate POWL with our WebDynpro application
- Test POWL
1. Create Feeder class.
- For our example, we need to create tables for Data selection
- Create a table name: YEMPLOYEE, presented in Fig. 2.
- Create Table entries for above table for references.
- Create Table Type : YTT_YEMPLOYEE ,presented in Fig.3
Fig. 2 Database table used for our example
Fig. 3 Table type for database table YEMPLOYEE.
- Now go to T.Code: SE24 and create a class with following interface, presented in Fig.4
- Class Name : YPOWL_CLASS.
- Interface Name : IF_POWL_FEEDER.
Fig. 4 YPOWL_CLASS is made and is using the interface IF_POWL_FEEDER.
- Now create attribute for same class, presented in Fig.5
- Attribute Name:
MT_RESULT Type YTT_YEMPLOYEE.
MT_FIELDCAT Type POWL_FIELDCAT_TTY
MT_SELCRITERIA Type POWL_SELCRIT_TTY
MT_CRITERIA_DEFAULT Type RSPARAMS_TT
Fig. 5 Attribute for YPOWL_CLASS is made.
- Implemented Feeder class has various methods as shown in Fig 6.
Fig.6 Interface Implemented methods.
NOTE: It is not necessary to use all methods provided by interface from the start.
There are 2 mandatory methods and 6 optional ones.
GET_OBJECTS and GET_OBJECT_DEFINITION are two mandatory methods, rest are optional.
Method description:
1.GET_ACTIONS: In this method, we can define the buttons and their action which can be handle in
Method HANDLE_ACTION. Method GET_ACTION properties defined in structure POWL_ACTDESCR_STY like text, tooltip, index etc.
2.GET_ACTION_CONF: In this method, one can fire a confirmation dialog window on the click of button, it will ask user whether to delete
the entries or not or similar.
3.GET_SEL_CRITERIA: In these method selection criteria is defined for this particular feeder. I.E Fields which appear in POWL selection screen.
4.GET_FIELD_CATALOG: This method describes the field catalog to be used for query results table and the UI properties of the particular fields.
- Various properties can be set here: Column position, column header, column visible, column color etc.
- Structure use: POWL_FIELDCAT_STY.
5.GET_OBJECT_DEFINITION: This method is used to define the container (e.g. specify field types) where the selected data gets stored.
6.GET_OBJECTS: This method is used to retrieve data from the backend system. Data retrieval can be done via simple select query or by
using a function module. Selected data is passed to E_RESULTS which is exporting parameter of this method
7.GET_DETAIL_COMP:Enable the detail component feature.
8.HANDLE_ACTION: In this, all the actions for the buttons are defined and also we can control enable/disable property of buttons here.
Control can be transferred from class to portal via firing a event using :
- E_portal_actions-fire_wdevent = abap_true.
2. Implement Feeder class method.
NOTE: Please implement/Activate all method of feeder class, otherwise system will generate dump saying ‘Implementation is missing’.
- Method GET_ACTIONS
METHOD IF_POWL_FEEDER~GET_ACTIONS.
DATA:WA_POWL_ACTIONS TYPE POWL_ACTDESCR_STY,
IT_POWL_ACTIONS TYPE TABLE OF POWL_ACTDESCR_STY.
WA_POWL_ACTIONS-ACTIONID = ‘POWL_LEAD_SEL’.
*WA_POWL_ACTIONS-CARDINALITY = C_FEEDER_ACTION_SEL_REQ.
*WA_POWL_ACTIONS-PLACEMENT = C_FEEDER_ACTION_TOOLBAR.
WA_POWL_ACTIONS-ENABLED = ‘X’.
WA_POWL_ACTIONS-PLACEMENTINDX = 1.
*WA_POWL_ACTIONS-
WA_POWL_ACTIONS-TEXT = ‘TEST’.
APPEND WA_POWL_ACTIONS TO IT_POWL_ACTIONS.
E_ACTIONS_CHANGED = ‘X’.
C_ACTION_DEFS = IT_POWL_ACTIONS.
ENDMETHOD.
- Method GET_ ACTION_CONF
- Method GET_SEL_CRITERIA
METHOD IF_POWL_FEEDER~GET_SEL_CRITERIA.
DATA: LS_SELCRIT TYPE POWL_SELCRIT_STY,
LS_CRITERIA_DEFAULT TYPE RSPARAMS,
LS_DEFAULT TYPE RSPARAMS.
IF MT_SELCRITERIA IS INITIAL.
LS_SELCRIT TO MT_SELCRITERIA.
LS_SELCRIT-SELNAME = ‘SALARY’.
LS_SELCRIT-KIND = ‘S’.
LS_SELCRIT-PARAM_TYPE = ‘I’.
LS_SELCRIT-SELOPT_TYPE = ‘A’.
LS_SELCRIT-ALLOW_ADMIN_CHANGE = ‘X’.
LS_SELCRIT-DATATYPE = ‘YEMPLOYEE-SALARY’.
APPEND LS_SELCRIT TO MT_SELCRITERIA.
CLEAR LS_SELCRIT.
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.
CLEAR C_DEFAULT_VALUES.
ENDMETHOD.
- Method GET_FIELD_CATALOG
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.
* 1. MANDT
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COLID = ‘MANDT’.
ADD_COLPOS.
LS_FIELDCAT-HEADER_BY_DDIC = ‘X’.
LS_FIELDCAT-FIXED = ‘X’.
LS_FIELDCAT-H_ALIGN = ‘L’.
LS_FIELDCAT-COL_VISIBLE = ‘ ‘.
LS_FIELDCAT-EDITABLE = ‘ ‘.
LS_FIELDCAT-WIDTH = 1.
INSERT LS_FIELDCAT INTO TABLE MT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COLID = ‘EMP_ID’.
ADD_COLPOS.
LS_FIELDCAT-HEADER_BY_DDIC = ‘X’.
LS_FIELDCAT-FIXED = ‘X’.
LS_FIELDCAT-H_ALIGN = ‘L’.
LS_FIELDCAT-ALLOW_SORT = ‘X’.
LS_FIELDCAT-COL_VISIBLE = ‘X’.
LS_FIELDCAT-EDITABLE = ‘ ‘.
LS_FIELDCAT-WIDTH = 4.
INSERT LS_FIELDCAT INTO TABLE MT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COLID = ‘EMP_ID’.
ADD_COLPOS.
LS_FIELDCAT-HEADER_BY_DDIC = ‘X’.
LS_FIELDCAT-FIXED = ‘X’.
LS_FIELDCAT-H_ALIGN = ‘L’.
LS_FIELDCAT-ALLOW_SORT = ‘X’.
LS_FIELDCAT-COL_VISIBLE = ‘X’.
LS_FIELDCAT-EDITABLE = ‘ ‘.
LS_FIELDCAT-WIDTH = 4.
INSERT LS_FIELDCAT INTO TABLE MT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COLID = ‘EMP_NAME’.
ADD_COLPOS.
LS_FIELDCAT-HEADER_BY_DDIC = ‘X’.
LS_FIELDCAT-FIXED = ‘X’.
LS_FIELDCAT-H_ALIGN = ‘L’.
LS_FIELDCAT-ALLOW_SORT = ‘X’.
LS_FIELDCAT-COL_VISIBLE = ‘X’.
LS_FIELDCAT-EDITABLE = ‘ ‘.
LS_FIELDCAT-WIDTH = 4.
INSERT LS_FIELDCAT INTO TABLE MT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COLID = ‘DESIGNATION’.
ADD_COLPOS.
LS_FIELDCAT-HEADER_BY_DDIC = ‘X’.
LS_FIELDCAT-FIXED = ‘X’.
LS_FIELDCAT-H_ALIGN = ‘L’.
LS_FIELDCAT-ALLOW_SORT = ‘X’.
LS_FIELDCAT-COL_VISIBLE = ‘X’.
LS_FIELDCAT-EDITABLE = ‘ ‘.
LS_FIELDCAT-WIDTH = 4.
INSERT LS_FIELDCAT INTO TABLE MT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COLID = ‘MANAGER’.
ADD_COLPOS.
LS_FIELDCAT-HEADER_BY_DDIC = ‘X’.
LS_FIELDCAT-FIXED = ‘X’.
LS_FIELDCAT-H_ALIGN = ‘L’.
LS_FIELDCAT-ALLOW_SORT = ‘X’.
LS_FIELDCAT-COL_VISIBLE = ‘X’.
LS_FIELDCAT-EDITABLE = ‘ ‘.
LS_FIELDCAT-WIDTH = 4.
INSERT LS_FIELDCAT INTO TABLE MT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COLID = ‘SALARY’.
ADD_COLPOS.
LS_FIELDCAT-HEADER_BY_DDIC = ‘X’.
LS_FIELDCAT-FIXED = ‘X’.
LS_FIELDCAT-H_ALIGN = ‘L’.
LS_FIELDCAT-ALLOW_SORT = ‘X’.
LS_FIELDCAT-COL_VISIBLE = ‘X’.
LS_FIELDCAT-EDITABLE = ‘ ‘.
LS_FIELDCAT-WIDTH = 4.
INSERT LS_FIELDCAT INTO TABLE MT_FIELDCAT.
ELSE.
C_FIELDCAT = MT_FIELDCAT.
ENDIF.
ENDMETHOD.
- Method GET_ OBJECT_DEFINITION
METHOD IF_POWL_FEEDER~GET_OBJECT_DEFINITION.
E_OBJECT_DEF ?= CL_ABAP_TABLEDESCR=>DESCRIBE_BY_DATA( ME->MT_RESULT ).
ENDMETHOD.
- Method GET_OBJECTS
METHOD IF_POWL_FEEDER~GET_OBJECTS.
DATA: R_EMP_ID TYPE RANGE OF YEMPLOYEE-EMP_ID,
R_EMP_NAME TYPE RANGE OF YEMPLOYEE-EMP_NAME,
R_SALARY TYPE RANGE OF YEMPLOYEE-SALARY,
X_BOOK_ID LIKE LINE OF R_EMP_ID,
X_EMP_NAME LIKE LINE OF R_EMP_NAME,
X_SALARY LIKE LINE OF R_SALARY.
FIELD-SYMBOLS: <LFS_PARAMS> TYPE RSPARAMS,
<LF_RESULT> TYPE YEMPLOYEE.
“FILL THE RANGE TABLES
LOOP AT I_SELCRIT_VALUES ASSIGNING <LFS_PARAMS>.
CASE <LFS_PARAMS>-SELNAME.
WHEN ‘EMP_ID’.
MOVE-CORRESPONDING <LFS_PARAMS> TO X_BOOK_ID.
INSERT X_BOOK_ID INTO TABLE R_EMP_ID.
WHEN ‘EMP_NAME’.
MOVE-CORRESPONDING <LFS_PARAMS> TO X_EMP_NAME.
INSERT X_EMP_NAME INTO TABLE R_EMP_NAME.
WHEN ‘SALARY’.
MOVE-CORRESPONDING <LFS_PARAMS> TO X_SALARY.
INSERT X_SALARY INTO TABLE R_SALARY.
ENDCASE.
ENDLOOP.
REFRESH ME->MT_RESULT.
SELECT * FROM YEMPLOYEE INTO TABLE ME->MT_RESULT
WHERE EMP_ID IN R_EMP_ID
AND EMP_NAME IN R_EMP_NAME
AND SALARY IN R_SALARY.
E_RESULTS = ME->MT_RESULT.
ENDMETHOD.
- Method GET_OBJECTS
METHOD IF_POWL_FEEDER~GET_DETAIL_COMP.
E_DETAIL_COMP = ‘YEMPLOYEE_POWL_WD’.
ENDMETHOD.
- Method GET_DETAIL_COMP
METHOD IF_POWL_FEEDER~GET_DETAIL_COMP.
E_DETAIL_COMP = ‘YEMPLOYEE_POWL_WD’.
ENDMETHOD.
- Method HANDLE_ACTION
METHOD IF_POWL_FEEDER~HANDLE_ACTION.
DATA: LS_PARAMETER TYPE POWL_NAMEVALUE_STY.
DATA : X_RESULT TYPE YEMPLOYEE ,
V_INDEX TYPE RSTABIX,
V_INDX(2) TYPE C.
CASE I_ACTIONID.
WHEN ‘POWL_LEAD_SEL’.
CLEAR:X_RESULT,V_INDX.
READ TABLE C_SELECTED INTO V_INDEX INDEX 1.
IF SY-SUBRC = 0.
V_INDX = V_INDEX-TABIX.
READ TABLE C_RESULT_TAB INTO X_RESULT INDEX V_INDX.
IF SY-SUBRC = 0.
E_PORTAL_ACTIONS-FIRE_WDEVENT = ABAP_TRUE.
LS_PARAMETER-KEY = ‘EMP_ID’.
LS_PARAMETER-VALUE = X_RESULT-EMP_ID.
APPEND LS_PARAMETER TO E_PORTAL_ACTIONS-PARAMETERS.
LS_PARAMETER-KEY = ‘EMP_NAME’.
LS_PARAMETER-VALUE = X_RESULT-EMP_NAME.
APPEND LS_PARAMETER TO E_PORTAL_ACTIONS-PARAMETERS.
LS_PARAMETER-KEY = ‘SALARY’.
LS_PARAMETER-VALUE = X_RESULT-SALARY.
APPEND LS_PARAMETER TO E_PORTAL_ACTIONS-PARAMETERS.
ENDIF.
ENDIF.
ENDCASE.
ENDMETHOD.
3. Define Application id, Type ,Role and queries
- After a feeder is developed, it needs to be made visible to the roles. Basically, this means we need to register the feeder under a specific APPLID, define a POWER List type and introduce it to the roles .
Step 1.Create an Application ID
- Transaction code: FPB_MAINTAIN_HIER
- Click on Change->Display button and then on New Entries button
- Give application id name:YEMPLOYEE_APPLID
- Presses SAVE , it will ask for transport request. Give/Create transport request and save it.
- Now u can see your entry (YEMPLOYEE_APPLID) in the list as shown below figure.
Step 2.Create a POWL TYPE
- Now u can see your entry (YEMPLOYEE_TYPE) in the list.
Step 3.Role assignment for POWL TYPE
Here we connect the APPLID with the POWL Type and make it visible to the role.
Step 4.Query for POWL
Here we define default queries for power list. A query id is made which is connected to POWL type.
NOTE: you can define one or more queries.
- Transaction code :POWL_QUERY
- Click on New Entries button and enter details as shown in figure.
- Press SAVE, and give transport request.
- After this, we can create/see the query parameters and the query settings with the help of the corresponding buttons:
- On clicking Query Parameter, you could see following screen, with field declare in feeder class.
- On clicking Query setting, one can enable different feature like quick search for fields.
Step 5.Map APPLID & QUERYID for POWL
Here if several queries are defined then sequence of tabs can be controlled via this transaction.
4. Integrate POWL with WD application
PARAMETER NAME TYPE
APPLID STRING
FORALLQ POWL_XFLAG_TY
QNAME POWL_QUERY_TY
QSELPARA STRING
REFRESHQ POWL_XFLAG_TY
SRVGROUP POWL_XFLAG_TY
- In the methods Tab of Windows , write the code in Handle Default Event handler to fire the outbound plug to Powl_Master View :
METHOD HANDLEDEFAULT .
DATA: LV_INBOX_QUERY TYPE STRING,
LT_QUERY_PARAMS TYPE RSPARAMS_TT,
LWA_PARAM TYPE RSPARAMS.
DATA LV_QNAME TYPE POWL_QUERY_TY.
LV_QNAME = ‘YEMPLOYEE_QUERY1’.
CALL FUNCTION ‘POWL_ENCODE_SELPARA’
EXPORTING
I_SELPARA = LT_QUERY_PARAMS
I_ESCAPE = ‘\’
IMPORTING
E_SELPARA_STRING = LV_INBOX_QUERY.
WD_THIS->FIRE_OUT_PLG(
APPLID = ‘YEMPLOYEE_APPLID’
QNAME = LV_QNAME
FORALLQ = ‘X’
QSELPARA = LV_INBOX_QUERY
REFRESHQ = ‘X’
* REFRESHA = ‘X’
SRVGROUP = ‘X’ ).
ENDMETHOD.
5. Test POWL.
Now create WD application and activate the whole program and run the application.
Here, You can
- Define New query (Define New query)
- Change Query (Change Search condition)
- Personalize (Set Layout , Remove query , Set default query etc)
Best Regards,
Rohan Uphade
š
great document.
Thanks jitendra
Hi Rohan,
Very good document. Very clear steps.
Regards,
Mahidhar.
Hi Rohan,
Really good document with clear steps and procedure. I was puzzled on the posiblity on creation of custom POWL. You provided a great guidance.
Thank you,
Regards,
Arun.K.P
Thanks Mahidhar & Arun. š
Great job Rahan, its very good one , usefull one, for those who dont know about POWL. i am also one of the person. Now i really i understood what is powl.
Thank You Very Much
Raju
Hi rohan,
The blog is very useful for beginers.
Thanks a lot.
Venkat
nice work!
Thanks for the blog. I don't know much about POWL, but it seems like a lot of effort to just get list of employees in WebDypro.
Why wouldn't you just use selection criteria and an ALV table in WebDynpro? Or was this example just for illustration purposes..?
thanks
Paul B
Paul the personalization of queries based on role and user is the main feature which the POWL provide you.
You can different set of BO's or Objects at a same time using different queries.
Great source of information. Thank you. As Paul mentioned could you please tell us the difference between having POWL and having an ALV with selection criteria to make different queries.
Hi Paul / Sudhanshu,
The Above article illustrates the steps on how to implement POWL in WD App. and List of employee output is provided for illustration purpose.
There is already a generic work list tool offered in Enterprise Portal, called the Universal Work list (UWL), in this special need for user-definable work lists is not satisfied.
This is because the UWL has just an opposite paradigm: the user is shown those objects he is obliged to process or to notice. E.g.: Selection criteria with ALV as output.
The creation of a custom query that delivers a list of objects for the respective user is merely
Interested in or he has to select on its own for his daily work which is therefore not in scope of the UWL.
This is where the Personal Object Work List (POWL) comes in: It is aimed at providing the user with a portal-based interface that he can use to define (and optionally store) queries in a similar way as he is used to do from R/3 selection screen variants. Moreover, it is possible to flag such queries as “activated” so their results are immediately visible when navigating to a portal page/work set containing the respective POWL iView. This way, the user has its custom “workload” right at hand (as it is the case in UWL with the user’s mandatory, externally “pushed” workload).
For example , using POWL you can call a work list with
1. Incomplete sales orders or a work list with
2. Sales orders that are blocked for delivery by clicking the define query and result is just a click away.
In General,
Regards,
Rohan
helpful
Dear Rohan,
Thanks for the above steps. It has so many information.
Could you kindly guide me to achieve the below mentioned scenario.
We are using SAP SRM 7.0
We are having RFx list screen which has few fileds in the selection conditions.
Now, the requirement is I need to add/hide few fields in the selection condition.
Because, by using the existing condition field our customers cannot control the required data.
As a beginner, I could not exactly find the solution and also having little fear to handle standard WD component.
Here is the component and View details.
WD Component: POWL_UI_COMP
View: MASTER_CONTENT
Kindly provide me if you have any documents or any related materials.
Thanks in advance.
Madhavan.R
Hello Madhavan,
You First Need to application ID for your application.
This you can find by putting a breakpoint in cl_POWL_MODEL-> Initialize method.
Form application ID, find the powl Type in POWL_TYPE transaction, from there you will get feeder.
In feeder get_sel_crit method, you can do all this.
Best regards,
Rohit
Hello!
Thanks for share your knowledge.
I am implementing your step by step guide and I found a mistake.
Method GET_OBJECTS was write as GET_DETAIL_COMP. Is It the same code?
Best regards.
METHOD IF_POWL_FEEDER~GET_DETAIL_COMP.
E_DETAIL_COMP = 'YEMPLOYEE_POWL_WD'.ENDMETHOD.
METHOD IF_POWL_FEEDER~GET_DETAIL_COMP.
E_DETAIL_COMP = 'YEMPLOYEE_POWL_WD'.
ENDMETHOD.
Hi Rohan,
Great Document to go through, easy step by step document.
Never before, POWL was so clear to me !
thanks for Sharing !
Keep Posting such helpful Documents !
Regards,
Saurabh
Hi Rohan,
thanks for the guideline, however I don't get something:
How do you create a text field on Web Dynpro and pass it as selection parameter to POWL?
I did create text field and in the action method do encode the parameter and pass the to POWL like this:
CALL FUNCTION 'POWL_ENCODE_SELPARA'
EXPORTING
i_selpara = lt_query_params
i_escape = '\' "_line
IMPORTING
e_selpara_string = lv_inbox_query.
wd_this->fire_out_plg(
applid = 'CL_GT_AC_USERCONN' "
qname = lv_qname "
forallq = 'X' "
powldeltarendering = ''
qselpara = lv_inbox_query
refreshq = 'X'
refresha = 'X'
srvgroup = '' "
).
The Problem is, that the selection parameter (encoded and passed tp POWL) don't land in the get variable I_SELCRIT_VALUES of the Method GET_OBJECTS of the POWL Feeder Class... There I only have the paramtere defined in POWL.
Whats missing?
Thanks in advance
Pourang
Hi,
I followed all the steps indicated above and instead of database table I used a DSO table.
But I am not getting the search panel i.e the panel where
"Here, You can
Also my requirement is to build a POWL screen where data can be manually entered and saved.
This is my first time POWL and WD integration. Can anyone please help me.
Thank you in advance.
Hi In MethodĀ IF_POWL_FEEDER~GET_OBJECTS
Iam getting error
The field "MT_RESULT" is unknown, but there is a field with the similar name "E_RESULTS".
Please suggest me
good one for bignners.. Thank you