Skip to Content

This is in continuation of the blog http://scn.sap.com/community/web-dynpro-abap/floorplan-manager/blog/2012/04/08/dynamically-modifying-purchase-order-fpm-in-srm7-using-custom-appcc I had writen about customising standard PO screen ( Adding custom MAIN / SUBVIEWS and changing standard MAIN / SUBVIEWs) in SRM7. In this blog I will talk about how do we access PO details in Custom subview that we had added in previous blog.

Here is the screenshot of how the screen looks after making changes accrording to the previous blog

poscreen.JPG

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 compoenent 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).

fillinput.JPG

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, eventhough 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 most of the FPM applications in SRM7) . 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 blog brings in in-depth understanding of how to access business object details inside custom UIBBs. Thanks for taking time and reading my blog.

thanks,

sankar.

To report this post you need to login first.

11 Comments

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

  1. Jens Ruths

    Just a comment from my side…

    You should NEVER EVER use method CL_FPM=>GET_INSTANCE( ) directly. Instead, please use CL_FPM_FACTORY=>GET_INSTANCE( ).

    Thanks,

    Jens

    (0) 
    1. sankara rao bhatta Post author

      Hi Ruths,

      Thanks for the comment.

      CL_FPM_FACTORY=>GET_INSTANCE( ) class internally calls same method CL_FPM=>GET_INSTANCE( ). I saw the comment for the method CL_FPM=>GET_INSTANCE( ) ‘Do not use directly – refer to CL_FPM_FACTORY instead! . I still used it to see what happens and I did not face any issues.’ May I know what is the reason why we should not use the call directly? I made the changes in the blog by the way.

      thanks

      sankar

      (0) 
      1. Jens Ruths

        The methods of class CL_FPM are not released for official use (only the interface methods of IF_FPM) and may be changed by SAP at any time. This includes not only the coding but also the method signature.

        (0) 
  2. Neha Mehta

    Very nice and informative blogs Sankar….

    It was good to get list of all standard app parameters 🙂

    To add to the conversation on use of CL_FPM_FACTORY; what i feel SAP is trying to make sure to give access to Abstract Factory (One of the design pattern) rather than giving access to detailed concrete class. One reason is simplicity of the interface which user have access to. In our case CL_FPM_FACTORY is following the abstract factory design pattern and all we are interested is in the instance.

    That’s why in SAP’s blogs/ tutorial/ handbook on FPM we see they use CL_FPM_FACTORY…

    It was good to read the blog…..

    Looking forward to more blogs from you.

    BR,

    Neha

    (0) 
  3. Jens Ruths

    Just another comment from my side…

    In the Blog above the following is mentioned: “…component FPM_OIF_COMPONENT ( This is the core component underlying all the FPM applications) “.

    Of course, the FPM offers more than just the floorplan component FPM_OIF_COMPONENT in order to build FPM applications. There is also the Guided Activity Floorplan (GAF) component FPM_GAF_COMPONENT as well as the Overview Page Floorplan (OVP) component FPM_OVP_COMPONENT. The latter is available as of NW 7.02.

    Just for the sake of completeness… 🙂

    (0) 
  4. srm srm1

    HI Sankar,

    Its a wonderful blog.

    I have to read shopping cart details in enhancement created in one of the FPM related view.

    Is parameter SAPSRM_DOCNUMBER will do?

    I didn’t see the method mentioned by you in this class.

    ” inside the method INITIALIZE_APP_PARAMETERS of class CL_FPM_FLOORPLAN_ASSIST

    (0) 
      1. Gaurav Gautam

        Hi Sankar,

        Could you please guide me how to read the custom tab data on the SAVE or ORDER click of PO. the custom tab I created is filled with all the zfields, I haven’t enhanced any standard structure of PO. Custom tab  is created under the main view Header view – sub view . I would want to read the data entered in the custom tab and store in to the ztable on SAVE/ORDER click. I have enhanced the BADI BBP_DOC_SAVE_BADI but in this there is only 2 parameter flt_val and iv_doc_guid, how can we read custom tab data within this badi.

        Thanks,

        Gaurav Gautam,

        (0) 

Leave a Reply