Creating Custom Queries in Worklists for Service Parts Planning (SPP) with Navigation & detail component functionality
I have spent many hours in first analysing these things and then implemented them for specific requirement .
So I would like to share my knowledge here .
Worklists for SPP is based on POWL concept . Therefore adding new query requires to follow POWL procedure.
As Planner’s worklist in SPP uses its own standard web dynpro component, we don’t need to create web dynpro component
for displaying it. We just need to take care about feeder class . Detailed steps can be find as below :
1. Create a Feeder class ex : ZCL_FEEDER_PRE_FORECAST.
2. Inherit IF_POWL_FEEDER, IF_POWL_FEEDER_EXT and /SAPAPO/IWCI_PUIA_POWL_DETAIL interface in feeder class (refer below screenshot)
So you will get all methods of mentioned interfaces as shown in below fig.
3. For defining selection criteria for custom query, we need to write code in IF_POWL_FEEDER~GET_SEL_CRITERIA .
Here we must need to pass selection to changing parameter ‘C_SELCRIT_DEFS’ .
4. Field catalogue and logic for fetching data could be defined in IF_POWL_FEEDER~GET_FIELD_CATALOG and IF_POWL_FEEDER~GET_OBJECTS
as per POWL concept .
5. For defining various buttons in queries over Planner’s worklist, We can use method IF_POWL_FEEDER~GET_ACTIONS of feeder class as
shown below .
Action id will be assigned to button as defined in method IF_POWL_FEEDER~GET_ACTIONS .
for assigning action against particular button, we can write code in method IF_POWL_FEEDER~HANDLE_ACTION referring
respective action id.
For Navigation over the GUI tcode or URL we can write logic as shown below :
DATA : lt_tihttpnvp TYPE tihttpnvp,
ls_ihttpnvp TYPE ihttpnvp,
lv_url_l TYPE string,
lo_url TYPE REF TO cl_url,
lv_host_l TYPE string.
CREATE OBJECT lo_url.
* Pass paramerters
ls_ihttpnvp–name = ‘BALHDR-OBJECT’.
ls_ihttpnvp–value = ‘ZSPP_DM’.
APPEND ls_ihttpnvp TO lt_tihttpnvp.
CLEAR : ls_ihttpnvp.
CLEAR : lv_url_l.
* Create URL
CALL METHOD lo_url->its
transaction = ‘SLG1’ ” name of tcode
query_parms = lt_tihttpnvp
url = lv_url_l.
* Call the URL
IF lv_url_l IS NOT INITIAL.
CALL METHOD cl_nwbc=>url_launch
url = lv_url_l.
6. For defining UI components in feeder class, we can write code in method IF_POWL_FEEDER_EXT~GET_UI_PERIPHERALS .
As in given example, it is required to display another web dynpro component as a pop-up on action of button .
Other than pop-up, we can display web dynpro component in various ways. You can check this method for details.
In HANDLE_ACTION method, we can call this by writing below code against respective action id .
e_portal_actions–fire_wdevent = abap_true.
e_portal_actions–launch_editor = abap_true.
7. For showing detail component for particular record in POWL. It is required to give web dynpro component which will be used
for showing detailed structure . Standard details component is /SAPAPO/PUIA_POWL_DETAIL .
We can use it in method IF_POWL_FEEDER~GET_DETAIL_COMP as below code
e_detail_comp = ‘/SAPAPO/PUIA_POWL_DETAIL’.
8. After creation of feeder class, we need to create Powl type and assign it to standard application id for planner’s worklist
which is SPP_PLANNER .
We can create powl type through table POWL_V_TYPE (tcode : SM30) . While creating Powl type we need to provide feeder class.
In our example we will provide ZCL_FEEDER_PRE_FORECAST .
9. Then we will create query id. In query id, we will provide visible possibility of selection parameters and link powl type to query id .
10. In table POWL_V_TYPE_R, we can assign powl type id to application id & assign role to it (if required) .
11. As planner’s worklist have multiple queries, so either we need to create our own category for displaying query in planner’s worklist
or we can use existing categories . I will show difference in both later in this document .
In our example, we are creating new category from table POWL_V_CAT .
And we can map this category to planner’s worklist by using tcode POWL_QUERYR . Here we provide application id which is
SPP_PLANNER for planner’s worklist and our own powl query. Here we can also provide query sequence and other details .
12. Now for showing pop-up (already declared in feeder class ) we need to define a web dynpro component which we have provided in feeder
class. In our example it is ZWD_PRE_FORECAST_POP_UP .
For this create a web dynpro component. In our example we are showing alv list/ table as pop-up .
we must need to implement following components in our own web dynpro .
And also implement interface as shown below :
In component controller we need to create structure for alv list/table .
Then we will create nodes in context of main view and map it to component controller’s node .
And in view itself create table in layout table and bind it .
Create shown event for action in component controller .
write the code for populating table in method SET_SELECTED_DATA of component controller and in other method according to requirement .
we are writing in SET_SELECTED_DATA because we are getting values of selected rows over POWL in this method .
13. For displaying detail component over powl .
we need to do setting in customising using path :->
.-> -> ->
We can define detailed component structure and logic method to fill that structure and other settings here .
Now in that logic method we need to following parameters :
Here ES_RESULT is output structure which you have provided in SPRO path .
and in feeder class against that respective button, you need to write following code where <fs_results> is selected row over powl :
READ TABLE c_result_tab ASSIGNING <fs_results> INDEX i_action_index.
IF sy–subrc IS INITIAL.
* Buffer customizing
iv_applid = i_applid
iv_type = i_type
et_message = e_messages ).
IF e_messages IS NOT INITIAL.
* Set selection parameters for detail component
ls_selection–applid = i_applid.
ls_selection–type = i_type.
ls_selection–actionid = i_actionid.
ls_selection–keyfields–matnr = <fs_results>–matnr.
ls_selection–keyfields–locnofr = <fs_results>–locnofr.
ls_selection–keyfields–locnoto = <fs_results>–locnoto.
ls_selection–keyfields–vrsioex = space.
GET REFERENCE OF <fs_results> INTO ls_selection–selection.
/sapapo/cl_puia_powl_detail=>set_selection( is_selection = ls_selection ).
* Set lead selection
/sapapo/cl_puia_powl_detail=>set_lead_selection( EXPORTING iv_action_index = i_action_index CHANGING cs_selected = c_selected ).
e_selected_changed = abap_true.
* Update side panel selection after lead selection update
/sapapo/cl_puia_bcv_assistance=>set_selection( is_selection = ls_selection ).
For reference you can check standard class : /SAPAPO/CL_FEEDER_CRITICAL_PRD in this context .
14. Execution : transaction (/SAPAPO/SPP_PLN_LIST) .
Here in second query we can see DEMAND CLEANSING, it is coming from our own category and under this we have
mapped our powl query which is PRE FORECAST .
We can also map our custom query against standard category .
In the query, we can see various buttons we are coming from method IF_POWL_FEEDER~GET_ACTIONS from feeder
class and action for them is linked in method IF_POWL_FEEDER~HANDLE_ACTION .
One important thing to note is that Planner’s worklist (SPP) should always be executed through NWBC otherwise
itwill not come with its full functionality and could miss navigation property etc .
If we click on buttons for navigation .It will navigation to desired screen as defined against action id in handle_action method .
By clicking on button for pop-up, it will show the web dynpro component which we have developed for showing ALV .
Detailed Component will be shown like below :
In above mentioned methods and paths, there are many more options available . You can check in detail based on requirement .