cancel
Showing results for 
Search instead for 
Did you mean: 

Enable Edit button in FPM_OIF_COMPONENT

former_member227141
Active Participant
0 Kudos

Hi all,

I'm new in SRM and I need some guidance.

I have the requirement to enable button edit in the next screen:

This is the technical help:

They want this:

Is the same component, but I don't know where could I change that. What should I do?

Thanks in advance, best regards!

Accepted Solutions (1)

Accepted Solutions (1)

former_member219747
Participant
0 Kudos

Hi Karina,

Please follow the below steps to enable the EDIT button-

1.) Go to the Component Controller of WDC /SAPSRM/WDC_UI_SC_DOFC_HD.

2.) Create a Post-Exit on the method Process Event in the WD Component Controller.

3.) Copy paste the below code here to read all the buttons in a table.

     DATA: lo_fpm                   TYPE REF TO       if_fpm,
      lo_cnr_oif              
TYPE REF TO       if_fpm_cnr_oif,
      lt_buttons              
TYPE              if_fpm_cnr_oif=>t_button,
      ls_button               
LIKE LINE OF      lt_buttons,


     lo_fpm = cl_fpm_factory=>get_instance( ).
      lo_cnr_oif ?= lo_fpm-
>get_service( cl_fpm_service_manager=>gc_key_cnr_oif ).

*   get all the FPM buttons
CALL METHOD lo_cnr_oif->get_buttons
IMPORTING
et_buttons
= lt_buttons[].

4.) Now consider the role assignment according to your's project requirement here.


5.) Further copy this code to enable the EDIT Button.


IF io_event->mv_event_id = 'FPM_EDIT'.
*   read  button with ID, which you created while creating FPM configuration
READ TABLE lt_buttons[] INTO ls_button WITH KEY element_id = 'ACCEPT'.
IF sy-subrc IS INITIAL.

*     define button as enabled or disabeld
CALL METHOD lo_cnr_oif->define_button
EXPORTING
iv_function  
= ls_button-function
iv_element_id
= 'ACCEPT'
iv_enabled   
= abap_true

ENDIF.

READ TABLE lt_buttons[] INTO ls_button WITH KEY element_id = 'REJECT'.
IF sy-subrc = 0.
*     define button as enabled or disabeld
CALL METHOD lo_cnr_oif->define_button
EXPORTING
iv_function  
= ls_button-function
iv_element_id
= 'REJECT'
iv_enabled   
= abap_true

ENDIF.

please let me know if you need any further clarifications.


Regards,

Mrityunjai

former_member227141
Active Participant
0 Kudos

Sorry but, how is the post exit created?

former_member219747
Participant
0 Kudos

Gr8! question.....if you are a functional consultant please take help from some technical guy

Steps-

1.) Create Enhancement for the WDC /a SAPSRM/WDC_UI_SC_DOFC_HD,shortcut to create enhncement (Ctrl+F4).

2.) Go to Component controller-> Method Process Event.

3.) You will find options to create PRE, POST, OVERWRITE EXITS, click on create POST EXIT.

former_member227141
Active Participant
0 Kudos

Thanks I'm technical but I've never worked with WD and this kind of enhancements before, I'm lost

I created the enhancement but doesn't let me modify code...

former_member219747
Participant
0 Kudos

follow the below link-

http://wiki.scn.sap.com/wiki/display/WDABAP/Enhancing+the+WebDynpro+Component+and+Methods.

And exactly implement my 1st post, your Job will be done

former_member219747
Participant
0 Kudos

Did you follow the above link?

You have to create an enhancement.

Then after you don't have to go inside that method.

When you got to the methods tab, after enhancement you will find options for creating POST, PRE and OVERWRITE EXITS.

This has been covered in the above shared link too.

There 1st create a POST EXIT and add the new code.

former_member227141
Active Participant
0 Kudos

Hi, yes I did. But it didn't work

former_member219747
Participant
0 Kudos

former_member227141
Active Participant
0 Kudos

Sorry, I did it.. but It didn't work..

I think that the code is not being executed because I placed a break-point and it didn't stop, then also I placed a infinite cicle and nothing...

former_member219747
Participant
0 Kudos

Hey,

This is a tried and tested piece of code and we had covered this requirement long back.

1.) Please check the button IDs used here(ACCEPT/REJECT), they might be different in you's case.

2.) Check the FPM configuration.

3.) Put a break point inside this POST EXIT Created and debug it once.

Also share the screen shot of what you have coded inside this POST EXIT.

Answers (1)

Answers (1)

former_member228602
Contributor
0 Kudos

Hello Karina,

        The button in question is an FPM Button and in SRM we have an extensive meta data framework to control button visibility.

Depending on your release the SM30 views will differ

1. Lower than SRM 702 - SM30 View /SAPSRM/V_MDA_HD

2. SRM 702 and greater - /SAPSRM/V_MDA_H1

A.Here look for

PDO Action Type - EDIT

Bus object Type - BUS2121

You might one more entries based on the mode and you will specifically find a dynamic class and dynamic method which will control the visibility of the button. You might to create overwrite exits for the method and alter the behavior.

This should help you control the UI.

Thanks and Regards,

Veera

former_member227141
Active Participant
0 Kudos

Thanks a lot!, but I have on doubt.. how can I implement my code in the method?

I think I could use EDIT_DURING_WORKFLOW from /SAPSRM/CL_PDO_DYN_MDA_WF_ADJ I but I can't see any enhancement point or something..

former_member228602
Contributor
0 Kudos

Hello Karina,

             These follow the newer methods of adding the enhancement in abap namely pre-exit. post-exit and overwrite exit.This SC link should help you

http://wiki.scn.sap.com/wiki/display/ABAP/Enhancement+Framework+-+Class+Enhancements+-+Pre-exit,+Pos...

Thanks,

Veera