Hello friends and fellow members, It is been quite a while I’m working in SAP Webdynpro and floor plan manager or FPM as we call it. Needless to say we all face challenges and solve problems every day.  This time I thought to share one of problem and it’s solutions with my colleagues and members here at SCN.

So let me start explaining the problem first. We were working to develop a web based reporting tool for a client and part of requirement was to be able to save selection screen variant and list view (FPM_LIST_UIBB_ATS) as part of same variant in our ztable so that based on user preference we can get the variant and list view back once required. Let me explain this using few screen shots to make it easy. We have implemented FPM_OVP_COMPONENT to put in all our free style selection UIBBs and FPM_LIST_UIBB_ATS

So here is the screen shot for a typical report screen with bunch of selection screen trays and an output list which is an FPM_LIST_UIBB_ATS component.

Snapshot_1.PNG

Now hit the personalization button on top right side of list and “save as” a new view after removing few fields from the standard view.

Snapshot_2.PNG

Now select something from the selection screen.

Snapshot_3.PNG

Then hit the save button on top left of the main screen that should save the selection screen values and list view both in out ztable so that it can be retrieve later based on requirement. please see below screen shots for details

Snapshot_4.PNG

To achieve this we have no problem getting the selection screen values but for list view we need some kind of reference to personalization API like we get in classic Webdynpro ALV (why we are not using classic Webdynpro ALV? I’ll save that answer for my next blog). I tried to find the personalization api reference with no success. So I debugged and found a solution which is not simple but we achieved what we wanted to.’

First thing I did was implemented the IF_F PM_APP_CONTROLLER in one of the UIBBs (Webdynpro component) . This interface makes that’s component as main component or UIBB and you can catch all the events with in BEFORE_PROCESS_EVENT method of the interface.

Next thing I did was to put the break point in the method  BEFORE_PROCESS_EVENT to see what I get there. if you see the “locals” tab in the debugger you will find an internal table name IT_UIBBS just like one below.

Snapshot_5.PNG

double click the “IT_UIBBS” and we will get the what’s inside of table. If we look inside the table we will find that one of the row belongs to our LIST_UIBB_ATS component. Just double click and see what we have.

Snapshot_6.PNG

Snapshot_7.PNG

We get a reference to a local class CLF_COMPONENTCONTROLLER_CTR which obviously is not accessible to us in our program but if we click it to see what is inside we find something interesting there.

Snapshot_9.png

So we get a reference to the assistance class for LIST_UIBB_ATS. “Yummy”… If we click it we will find more meat in there. just look at it now.

an attribute in red means private name mo_personalization is what we need and it’s a reference to  a class name “CL_FPM_LIST_SETTING_CONTROL”.

That’s all we need and we will achieve what we want.  but work is not over yet. we still need to access that reference to CL_FPM_LIST_SETTING_CONTROL that mo_personalization.

1) Up till now whatever we have debugged we found two hurdles. There is a local class that we cannot reach CLF_COMPONENTCONTROLLER_CTR

2) Even after we get to local class and fetch the public attribute which refer us to assistance class of LIST_UIBB_ATS, personalization api that is reference to CL_FPM_LIST_SETTING_CONTROL is still a private attribute.

So Here is what we are going to do.

1) Try to get access to the local class using the technique describe in this blog :

http://wiki.scn.sap.com/wiki/display/ABAP/Accessing+the+Inacessible+-+Local+Classes+within+Global+Classes

As mentioned earlier we need to implement IF_FPM_APP_CONTROLLER in our main webdynpro component so that we get the method BEFORE_PROCESS_EVENT where we will implement our code to get the personalization object.

Here is our piece of code to access the using the type casting process describe here.

DATA:
lk_uibb            type FPM_S_UIBB_COMPONENT,
lr_list_assist     type ref to CL_FPM_LIST_UIBB_ASSIST_ATS,
lr_personalization type ref to IF_FPM_LIST_SETTINGS_CONTROL,
lr_current_variant type ref to IF_FPM_LIST_SETTINGS_VARIANT,
lv_variant_key     type string,
lr_super_assist    type ref to CL_FPM_GUIBB_ASSIST,
lr_render          type ref to CL_FPM_LIST_UIBB_RENDERER_ATS,
lo_obj             type ref to object,
ld_attr            type string.

FIELD-SYMBOLS:
<lfs_lcl>          type any.

*Read the LIST UIBB Instance


if io_event->mv_event_id = ‘FPM_SAVE’    .

read table it_uibbs into lk_uibb with key instance_keyCOMPONENT =

zci_cfr_constants=>c_ats_comp .

if sysubrc = 0.
*There is no way we can use local class’ public attribute. The technique we are
*Using here will help us get access to the local class and eventually to its attrbute


lo_obj ?= lk_uibbINTERFACE_CONTROLLER.
ld_attr = ‘F_ASSIST’.
ASSIGN lo_obj->(ld_attr) TO <lfs_lcl>.
lr_list_assist = <lfs_lcl>.
*Once we get the reference to the Assistance class for ATS we can get the personalization

lr_personalization = lr_list_assist->GET_PERSONALIZATION( ).
lv_variant_key = lr_personalization->GET_CURRENT_VARIANT( )->GET_VARIANT_KEY( ).
er_variant = lv_variant_key.

endif.

endif.


that’s it we can now set variant in similar way and do lot of things available in the class CL_FPM_LIST_SETTINGS_CONTROL

Snapshot_10.PNG

But wait a minute we still need to cross the next hurdle and enhanced the class CL_FPM_LIST_UIBB_ASSIST_ATS to make the above code work.


2) Just enhance the class and write the new method.

METHOD GET_PERSONALIZATION .
ro_personalization = mo_personalization_api.
ENDMETHOD.

Summary:

FPM_LIST_UIBB_ATS does not give you access to personalization in the FEEDER class and I came up with this solution to access the personalization and achieve the required functionality.

Please share your comments or any questions.

Laeeq A Siddique.

laeeq.siddique@gmail.com

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

    1. Laeeq Siddique Post author

      I do not think there is any if you are trying to do what is mentioned here in the article. last time I talked to SAP folks (using OSS) they said they might provide something in service pack 8.

      (0) 
  1. Jens Boeckenhauer

    Please refrain from accessing SAP’s internal functions by some dynamic assignments. Any unexpected behavior or errors can no longer be supported by SAP in this case.

    (0) 
  2. Laeeq Siddique Post author

    You are right that we are using dynamic assignment and I agree. but this feature was just an enhancement and is not even available currently available released.

    (0) 

Leave a Reply