Join 25k+ Publishers who track Tweets, Likes, Pins, +1s to their websites right from their WordPress Dashboard! X

How to Access PO Details from Custom Component Embedded in Standard FPM in SRM7

As a continuation of the FPM tutorial on customizing standard PO screen in SRM7, this article talks about how to access PO details in Custom subview.

This is in continuation of the FPM tutorial I had written about customizing standard PO screen (Adding custom MAIN / SUBVIEWS and changing standard MAIN / SUBVIEWs) in SRM7. In this article I will talk about how we access PO details in Custom subview that we had added in the previous article.

Here is the screenshot of how the screen looks after making changes according to the previous article:

FPM

I have added an input field to the view of component YTEST. Now I would like to access the PO description and display it in the input field. To achieve this we need to access the FPM instance inside the WDDOINIT method of YTEST component controller and access the attribute MO_APP_PARAMETER of interface IF_FPM. Once we have the reference to this attribute ( which is of type IF_FPM_PARAMETER) we can use GET_VALUE( ) method to read different parameter values. Below is the sample code on how to read the PO GUID

* Instantiate the FPM Manager
DATA: lo_fpm TYPE REF TO if_fpm,
lo_appdata type ref to IF_FPM_PARAMETER,
lv_value type string,
lv_guid type CRMD_ORDERADM_H-GUID,
ls_header type BBP_PDS_PO_HEADER_D.
*access the attribute containing different parameters
lo_fpm = cl_fpm_factory=>get_instance( ).
lo_appdata = lo_fpm->MO_APP_PARAMETER.
*get the po guid
CALL METHOD lo_appdata->get_value
EXPORTING
iv_key = 'SAPSRM_BOID'
IMPORTING
ev_value = lv_value.
lv_guid = lv_value.
*once we have the GUID we can access all the details of the PO
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
I_GUID = lv_guid
IMPORTING
E_HEADER = ls_header.

After getting the PO header details in ls_header, set the context attribute which is binded to the input field to ls_header-description. See the code below ( this code can be generated by code wizard)

DATA lo_nd_node TYPE REF TO if_wd_context_node.
DATA lo_el_node TYPE REF TO if_wd_context_element.
DATA ls_node TYPE wd_this->element_node.
DATA lv_ponumber TYPE wd_this->element_node-ponumber.
* navigate from <CONTEXT> to <NODE> via lead selection
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).
* get element via lead selection
lo_el_node = lo_nd_node->get_element( ).
* set single attribute
lo_el_node->set_attribute(
name =  `PODESCR`
value = ls_header-description).

I have listed down below different application parameters that are available for us to access. Unfortunately there is no description available for each of the parameters. If you want to know the value that each parameter holds at runtime, you have to debug and see it. To do that put an external breakpoint at statement

‘lt_app_params = LO_APPLICATION_INFO->GET_APPLICATION_PARAMETERS( ). ‘

inside the method INITIALIZE_APP_PARAMETERS of class CL_FPM_FLOORPLAN_ASSIST

Here is the list of parameter names

Name of the parameter
SAPSRM_ACTION
SAPSRM_BOID
SAPSRM_BOSUBTYPE
SAPSRM_BOTYPE
SAPSRM_CA_TAB
SAPSRM_CONTACTID
SAPSRM_DOC_NUMBER
SAPSRM_ITEMID
SAPSRM_KW_ID
SAPSRM_MODE
SAPSRM_NWBC_HTML
SAPSRM_PARENT_BOID
SAPSRM_PCDLOCATION
SAPSRM_PORTALBASEURL
SAPSRM_PROCESSTYPE
SAPSRM_PROGRESS_SHM_ID
SAPSRM_PS
SAPSRM_TEMPLATEID
SAPSRM_TX_CONTEXT_ID
SAPSRM_VIEW_SWITCH
SAPSRM_WIID
SRM_TEMPLATE

 

If you are wondering how we are able to access FPM instance inside our custom component methods, here is a brief explanation.

*access the attribute containing different parameters

lo_fpm = cl_fpm_factory=>get_instance( ).

The above static method call enables us to get a reference to the FPM instance, even though we did not explicitly create an instance of class CL_FPM. So where did it get instantiated in the first place? To understand it we need to go inside componentcontroller WDDOINIT method of component FPM_OIF_COMPONENT ( This is the core component underlying all the FPM applications) . In this method, below code creates an object for CL_FPM

CREATE OBJECT wd_this->mr_fpm

EXPORTING

io_floorplan  = wd_this->mr_oif_api

io_controller = wd_this.

Initialization of IDR component and AppCC component is also done inside the WDDOINIT method.

The constructor method of the class CL_FPM stores the instance in global private static attribute GO_INSTANCE. FPM message manager is also instantiated inside the constructor method. The static method GET_INSTANCE   reads this attribute and returns it as returning parameter. So in short, the FPM instance is available to all the UIBB components.

I hope this tutorial brings in in-depth understanding of how to access business object details inside custom UIBBs. Thanks for taking time and reading my blog.

Comments

  1. Arif says:

    I have a requirement in SRM 7.0 using FPM…
    I need to raise a custom popup screen whenever the approve button is clicked…The custom webdynpro screen will have some questions with radiobuttons as yes/No and 2 buttons submit and cancel…So when submit is clicked then only the shopping cart will be approved else pressed cancel then the custom screen shud close and the user shud be on the approval screen…How do I make it possible using FPM…