14 Replies Latest reply: Jun 9, 2014 11:53 AM by sankara rao bhatta RSS

Event handling for standard save button in PO srm portal

Gaurav Gautam
Currently Being Moderated

Hello Gurus,

 

 

       I am into SRM 7.0 Ehp2 , Extended Classical Scenario. Now I am created two custom tabs (Custom Data and Retention) under header in po screen . Now I am facing few problems.

 

1. When I am opening a PO then all data's are in display mode except my ztab data.Still it is allowing to modify.

2. I have to code on SAVE button so that the  data entered into Custom Data and Retention gets saved in my ztable.But I can't find any way to enhance the standard SAVE button.Is there any BAPI/BADI or any class  where I can find the place to enhance the standard SAVE button of the PO screen.

 

 

Thanks

 

Gaurav Gautam

  • Re: Event handling for standard save button in PO srm portal
    Anubhav Jain
    Currently Being Moderated

    Hi Gaurav,

     

    1. You can read the mode from task container using the below code..

     

    DATA lo_task TYPE REF TO /sapsrm/cl_ch_wd_taskcontainer.

    DATA lv_pdo_mode TYPE  /sapsrm/pdo_inst_mode.

     

      lo_task ?= wd_comp_controller->mo_task_container.

     

       CALL METHOD lo_task->/sapsrm/if_cll_task_container~get_transaction_mode

         IMPORTING

           ev_pdo_trans_mode = lv_pdo_mode.

    lv_pdo_mode will be 'EDIT' or 'DISPLAY'. Based on this you can toggle attributes of your custom tab.

     

    2. To save the data use BBP_DOC_SAVE_BADI..

     

     

    Thanks,

    Anubhav



    • Re: Event handling for standard save button in PO srm portal
      Gaurav Gautam
      Currently Being Moderated

      Hello Jain ,

       

         Thanks for quick response will check and return back.I hope it should work.

       

       

      Thanks

      Gaurav Gautam

    • Re: Event handling for standard save button in PO srm portal
      Gaurav Gautam
      Currently Being Moderated

      Hello Anubhav Jain,

       

           Will this help me to save the tab data both on ORDER and SAVE button or something different has to be tried out for both buttons.

      Also while reading this above code into my zwebdynpro (Based on this you can toggle attributes of your custom tab.) How can I achieve this.

       

      Also I am facing an issue with client as when I am trying to check my custom tab from 110 then its working fine but when I checking it through 120 then my both the custom tabs under Header are in display mode.Why this is happening.

       

      Thanks

      Gaurav Gautam

      • Re: Event handling for standard save button in PO srm portal
        Anubhav Jain
        Currently Being Moderated

        Hi Gaurav,

         

        Will this help me to save the tab data both on ORDER and SAVE button or something different has to be tried out for both buttons.

        Yes save badi is called for both events.

         

        Also while reading this above code into my zwebdynpro (Based on this you can toggle attributes of your custom tab.) How can I achieve this.

        You can get the reference of task container of component controller by using WD_COMP_CONTROLLER->MO_TASK_CONTAINER variable and then get the mode using code in previous post. Put that code in WDDOMODIFYVIEW of your Z component's view

         

        Also I am facing an issue with client as when I am trying to check my custom tab from 110 then its working fine but when I checking it through 120 then my both the custom tabs under Header are in display mode.Why this is happening.

        No clue about this

         

        I can not see the PO UI in my system as we are on classic. Do try this and let me know.

        Best is if you could debug and find out why it behaves different in different clients...you might not face these issues at all.

         

        Thanks,

        Anubhav

        • Re: Event handling for standard save button in PO srm portal
          Gaurav Gautam
          Currently Being Moderated

          Hi Anubhav,

           

          I haven't enhanced any standard structure of PO to hold custom value....  Badi BBP_DOC_SAVE_BADI has only 2 parameters FLT_VAL and IV_DOC_GUID. As my custom tab contains all the fields from Ztable how can I read the data of custom tab within this BADI......  with guid if I read the PO getdetail method , I wont be getting any extension parameter because the standard structure is not enhanced to store custom value.

           

           

          Thanks,

           

          Gaurav Gautam

          • Re: Event handling for standard save button in PO srm portal
            Anubhav Jain
            Currently Being Moderated

            Hi Gaurav,

             

            For custom table suppose the key field is PO Num + Item num OR GUID of item...you can get details of the PO using BBP_PD_PO_GETDETAIL(including items) and read/update your Z tables in Save BADI.

             

             

             

             

            Thanks,

            Anubhav

            • Re: Event handling for standard save button in PO srm portal
              Gaurav Gautam
              Currently Being Moderated

              Dear Anubhav,

               

              I think i have not explained my issue clearly, Customtab in PO is having normal fields which are not related to the standard structure  of PO. So whatever we enter into the custom tab willnot be appearing in any of the standard tables of PO and hence the BBP_PD_PO_GETDETAIL will not return these values. Unlike in R/3 where the standard table EKKO is enhanced and these fields are shown in the me21n screen  and these gets saved into ekko so from here we can read it using the bapi_po_getdetails1 parameter extensionout.

               

              I want to read the data entered in the customtab of PO when the SAVE button is clicked. Custom data willnot be available using BBP_PD_PO_GETDETAIL beacuse there is no parameter for extension.

               

              I hope i was able to put forward my issue.......

               

              Thanks,

              Gaurav.

              • Re: Event handling for standard save button in PO srm portal
                Robin Janke
                Currently Being Moderated

                Please read up about using customer fields in SRM.

                 

                You really don't want to create a whole new processing routine if SRM has already provided this for you in quite an easy usable way using includes so that you can find all those details using the *getdetail FMs.

                 

                Hint: search for structure INCL*CSF* in SE11 and in SPRO: extension and field control.

                • Re: Event handling for standard save button in PO srm portal
                  Gaurav Gautam
                  Currently Being Moderated

                  Hi Robin,

                   

                  Thanks for your reply!!!

                  1. I created Table control using the Extension and field control options in spro . It is easy to add and the data will get stored by the standard code and the same can be read by bapi. But my table has 5 columns and each columns  behavior is different. First column is dropdown, second is non editable with initial value set po currency, third is a dropdown but the values in dropdown will depend upon the first column , fourth column value entered based on this the fifth column will be calculated  and the last too is a dropdown with value populated based on first column. Also the sixth and last column is calculated based on the PO netwr .

                  Will it be easy to do all this dynamic check coding into the standard structure. how will we achieve this.

                   

                  2. Can we have more than one tab created using the Extension option in SPRO. because in the second tab there are few more details to be read

                   

                   

                   

                  Thanks,

                  Gaurav.

              • Re: Event handling for standard save button in PO srm portal
                Anubhav Jain
                Currently Being Moderated

                Hi Gaurav,

                 

                Looks like you need to save the data directly from WD Component and the fields are not added in customer includes. In that case you can enhance the WD Component FPM_OIF_COMPONENT and create a post exit of method ONACTIONBUTTON_PRESSED.

                In the post exit you need to get the event details - which button is pressed if SAVE is pressed check if there are any validation errors or exceptions in the document and if no errors read data from context of WD and update your custom tables.
                Below code will help...find out what is the event id for SAVE button and you can get the current event id by

                DATA: lv_event_id TYPE fpm_event_id.

                 

                lv_event_id = wdevent->get_string( 'ID' ).

                You can check for validation errors :

                 

                 

                 

                DATA: lo_cll_message_handler              TYPE REF TO /sapsrm/if_ch_wd_map_msg_hdlr.

                lo_cll_message_handler = wd_comp_controller->mo_task_container->get_message_handler( ).

                  IF ( lo_cll_message_handler->has_exception( ) EQ abap_false )

                        AND ( lo_cll_message_handler->has_validation_error( ) EQ abap_false ).

                *******YOUR CODE HERE*******

                ENDIF.

                If you need to get the GUID or other data you can get it from FPM key params.

                 

                Another idea----you can extend the customer includes for PO and then use these fields in your custom WD Component. You can toggle these fields dynamically since it is your custom WD and these will be saved on SAVE button since these are now in PO customer includes.

                 

                Hope this time we are on same page

                 

                Thanks,

                Anubhav

                • Re: Event handling for standard save button in PO srm portal
                  Gaurav Gautam
                  Currently Being Moderated

                  Dear Anubhav,

                   

                  My custom webdynpro component ZWD_POCUSTOMDATA is having interface implemented /SAPSRM/WDI_L_FPC_GENERAL, IF_FPM_OIF_CONF_EXIT and IF_FPM_UI_BUILDING_BLOCK, created configuration and the same is shown inside PO header tab.

                  To add the custom component to FPM i have ehanced the webdynpro /sapsrm/wdc_fpm_oif_conf and created post-exit for method override_event_oif. if the event is FPM_START then i am adding the custom component using   io_oif->add_subview. With this the view is shown under purchase order header tab.

                   

                  Now the custom tab is having 3 fields which is normal fields , so how can we pass  this  to the enhanced standard structure.INCL_EEW_PD_HEADER_CSF_PO. even if the added field are binded to this strucutre. How will the parent class fetch this values to po header.

                   

                  You mentioned "if SAVE is pressed check if there are any validation errors or exceptions in the document and if no errors read data from context of WD and update your custom tables." but how to read the context of wd in FPM save event.

                   

                  initially when the po is getting created , FPM key params will not give the guid it will  be iniital.

                  it is easy to get the guid of the po in the custom component , but how will the custom component data get saved when the standard event 'save' is fired.

                   

                   

                  Thanks,

                  Gaurav.

Actions