cancel
Showing results for 
Search instead for 
Did you mean: 

how to handle the button dynamically based on the po status

_Satish_
Participant
0 Kudos

Hi All,

We have a requirement to change the availability of the Print Preview button based on the status of PO in the SRM (7.0) Portal. The Print preview button needs to be disabled if the status of the PO is 'Awaiting Approval'.

We have successfully written the code in the pre-exit for the method wddomodifyview of the concerned view to disable the print preview button but are unable to find how to read the status of the PO inside the method in order to handle the button dynamically based on the po status.

Or is there any-other better way of achieving the same?

Kindly suggest how we can achieve the desired functionality.

Thanks in advance!

Regards,

Satish

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Satish,

First, how to get PO or any document status(details) in SRM.

LR_PD_MODEL TYPE REF TO /SAPSRM/IF_PDO_MODEL_ACCESS,

LS_PD  type /SAPPSSRM/S_GETDETAIL_RESULTS.

LR_PD_MODEL  = /SAPSRM/CL_PDO_MODEL_FACTORY=>GET_INSTANCE().

LR_PD_MODEL->GET_DETAILS(EXPORTING

                                                            IV_GUID = lv_PO_HEADER_GUID

                                                            ET_STATUS  = ET_STATUS).

second, your requirement is to disable Print Preview Button( Or any other button).

Go to SPRO->SRM Server->Cross Application Basic Setting ->Extensions and Field Control -> Control Actions-> configure control of Actions on Header Level.

Now add an entry : 

PDO Action Type : PRINT_PRIVIEW

Process Mode: EDIT

OBject Type : BUS2201

PDO Action Enable : True

Dyn Class: < You Z class to control action >

Dyn Method : < Z Class Method>

In this you control the button property, Enable/Disable , Visible/Hide etc.

This is easy rather you do any enhancements.

_Satish_
Participant
0 Kudos

Hello Surender,

Thanks for your reply.

The above solution provided by robin worked correctly. However i'll make sure to try your suggestion too so that i can gain a better understanding of both the methods.

Thanks again for your help.

Cheers!

Satish

_Satish_
Participant
0 Kudos

Hello Surender,

As per your suggestion, i implemented the soution for the above requirement by maintaining the configuration in SPRO and then by implementing the logic in the Zclass.

You are correct!

The solution suggested by you is much easier (also appropriate) to implement rather than doing any enhancements.

Thanks again!

Regards,

Satish

Former Member
0 Kudos

Hi Surender,

I am using SRM 7.0 portal. At header level, For PO Status "Ordered" EDIT button is disabled. Any pointer to resolve this would be appreciated.

Regards

Tarun

Former Member
0 Kudos

Hi Surender ,

Can you please tell me how did you get the lv_po_header_guid.Did you call any Badi for this.

Because it varies for every shopping cart how can we get the details for that particular shopping cart

Former Member
0 Kudos

Hello,

Please use below code for  GUID.

 

DATA:    lo_wd_view_controller TYPE REF TO if_wd_view_controller,
             lo_wd_comp_controller
TYPE REF TO /sapsrm/iwci_wdi_l_fpc_general,
             lo_task_container
TYPE REF TO /sapsrm/if_cll_task_container,
             lv_bo_guid
TYPE bbp_pd.

* Instantiate the component controller and task container


lo_wd_view_controller = wd_this->wd_get_api( ).
lo_wd_comp_controller = wd_comp_controller.
lo_task_container = wd_comp_controller->mo_task_container.

 

** Get the GUID
CALL METHOD

lo_task_container->GET_BO_GUID

RECEIVING
RV_BO_GUID = lv_bo_guid.

Thanks,

Neelima

*

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Satish,

If I am right I dont think you can handle the actions buttons dynamically from wddomodify view.

Pls do the following ->

All the button events in SRM 7.0 are handled in the ident mapper class.

For PO

Goto the class -> /SAPSRM/CL_CH_WD_IDEN_MAP_PO

Methods -> Redefination ->    GET_CLL_ACTION_METADATA

Create an enhancement for this method --

the easy and the best way to disable any buttons on the PO screen ..header level button.

To disable print preview

   CASE iv_action.
      WHEN 'FPM_PRINT_PREVIEW'.    // Pls note case sensisitive
        cv_cll_metadata = abap_false.

   endcase.

Now before this you need to get the status of the PO.

  lo_pdo_po ?= mo_pdo.

  lo_pdo_status ?= lo_pdo_po.

  lo_pdo_status->get_header_status

   ( IMPORTING es_status            = ls_status_text )

You can get the exact code in the same class in the method -> /SAPSRM/IF_CLL_IDENT_MAPPER~GET_FIELD_DATA

In this class they are getting the status, you can check the code there.

Hope this resolves your issue.

Regards,

RBEI SRM/ Robin

_Satish_
Participant
0 Kudos

Hello Robin,

You are great!!

Your suggestion worked perfectly

Thanks a ton for your help!!!

CHEERS!!

Satish