on 05-12-2015 7:19 AM
Dear SRM Expert,
We have requirement to capture the acceptance and rejection reason while we accept /reject the potential supplier in the supplier preselection tab.
We checked that Accpet/Reject buttons are not available in the webdynpro components and they are part of the FPM.Could you please suggest how we can achieve this functionality.
Thanks
Shuvrajyoti
Yes you are correct, Accept/Reject buttons are not visible in the WDC. So you have to make this visible and thereafter you will be able to capture this Accept/Reject button. Please follow the below steps to enable the EDIT button- 1.) Get the technical details and using it go to the Component Controller of WDC. 2.) Create a Post-Exit on the method Process Event in the WD Component Controller. 3.) Read all the FPM buttons in an internal table. 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.) On your FPM event read this internal table with all the FPM buttons with the key 'ACCEPT'. You can use the below code as a reference. 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 iv_visible = 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 iv_visible = abap_true ENDIF. please let me know if you need any further clarifications. Regards, Mrityunjai
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mrityunjai,
Sorry for late reply.
We are able to capture the error message when we click on ACCEPT button but the problem is that status of the supplier is still changes to ACCEPTED from NEW which we don't want.Is it possible that before displaying the FPM error message status is already changing?If that is the case then how we can restrict that?
We are doing coding inside PROCESS_EVENt of WD Componet /SAPSRM/WDC_SUCO_SREG_CA
After generating error message we set ev_result = if_fpm_constants=>gc_event_result-failed as well but still same.
Please suggests.
Thanks
Shuvrajyoti
Hi Shuvrajyoti,
What i have understood from your post, is that you are able to use the accept button, but while doing so irrespective of the system throwing error, the status is successfully getting changed to accepted?
Please correct me if I am wrong.
And if I am correct in my understanding, i will request you to try doing the following-
1.) Please check the roles for the Approver.
2.) Based on the assigned roles, allow/restrict the action on this ACCEPT/REJECT button on the method PROCESS_EVENT of your WDC.
*Also check methods NEEDS_CONFIRMATION and AFTER_FAILED_EVENT.
Regards,
Mrityunjai
Hi Mrityunjaya,
Role will be same for all approver.Can you please elaborate what exactly I need to do with role of the user.Also I am new to FPM and webdynpro so not sure what to write in NEEDS_CONFIRMATION and AFTER_FAILED_EVENT.I checked that currently nothing is implemented in above 2 method.If you have sample code or or other helpful blog ,please let me know.
Also I further debug and found that once ACCEPT button is clicked then method /SAPSRM/IF_SUCO_CLL_AO_SREG~ACCEPT is called which is responsible for changing the status and after that control moved to PROCESS_EVENT of the component controller.Please suggest.
Thanks
Shuvrajyoti
Great nice work, so you have found the class which is getting called after the ACCEPT button is getting clicked.
You mentioned role is same for all, so do you mean anyone can log in to the portal and approve the supplier?
I guess not, so what i meant by roles is- 'Roles will be maintained on the basis of Authorization object given to the users' and for that you will have to create authority check objects (SU21) and apply them inside the code on the method PROCESS_EVENT.
If not and you are only looking to do away with the error shared as below-
Create an Implicit Enhancement inside the method /SAPSRM/IF_SUCO_CLL_AO_SREG~ACCEPT and add in the 'Acceptance reason' to do away with the error OR all you want to achieve when this button is pressed.
Still in doubt please be more clear in what you are looking to achieve here.
Regards,
Mrityunjai
Thanks Mrityunjaya for your quick response.Sorry I don't understand why I need to check the roles.
X role is there to view the vendor and accept them. I want to restrict the user (obviously all user with X role only- They can view the vendor and can click on accept button) so that status of the vendor can't be changed to ACCEPTED without giving acceptance reason.If user fills acceptance reason field then only status will be changed to ACCEPTED otherwise it will remain as NEW.Please let me know if I am unable to explain my requirement.
So it seems with wdcomponent PROCESS_EVENT it can't be achieved and need to enhance the said class.Please confirm.
Thanks
Shuvrajyoti
Yes very true, so this requirement can be met either by making this ACCEPT button enabled/disabled based on the assigned roles, right?
But if the ACCEPT button visible and enabled, then as per the standard functionality the method /SAPSRM/IF_SUCO_CLL_AO_SREG~ACCEPT will be called and this will mark the status accepted.
Now if you are looking to alter this standard logic all together, then also we have the option of overwriting the method, where you can adapt the current standard logic according to your requirement.
So the solution is here now, either you try achieving it making this button enabled/disabled based on the assigned roles through the PROCESS_EVENT method OR overwrite the standard logic with the custom logic.
Please let me know if you are in any further doubt and rewards points accordingly.
Regards,
Mrityunjai
Hi Shuvrajyoti
The accept /. Reject screen is Webyndpro or BSP.. If Webdynpro .
you can check the webdynpro component name and in WDMODIFY you will get the action as reject ..
in that case put your code there to send an email to the vendor who is getting rejected ..
Incase BSP .. then I am not sure ..
I do not have a ROS system currently installed to be able to check this ..
Regards
Vinita
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Vinita,
We are using webdynpro application in ROS process.Can you please suggest how FPM Event ID (ACCEPT /REJECT) will be captured in WDMODIFYVIEW ? I searched some blog and found that code needs to be written in PROCESS_EVENT method of the corresponding component controller but not sure how to get the control of the UI element.
Thanks
Shuvrajyoti
Hi
1. You could try to find the button with the corresponding business object type here and then using configure control of actions you could place your code in a class and method ..
2. OR use this code to cpature the action in WDDOMODIFY
DATA: lo_transaction_context TYPE REF TO /sapsrm/if_transaction_context.
lo_transaction_context = /sapsrm/cl_transaction_context=>/sapsrm/if_transaction_context~get_instance( ) .
CASE lo_transaction_context->get_current_action( ).
WHEN /sapsrm/if_pdo_action_c=>GC_ACTION_REJECT.
PUT CODE HERE ....
ENDCASE.
Let me know if this help ...
Regards
Vinita
Hi Vinita,
Thanks for your response.I was able to get the status in the /SAPSRM/WDC_SUCO_SREG_GEN component and trying to show the error messages but the problem is that the status of the supplier is already getting changed to accepted and after that error is showing in the screen.So problem is still there.I want to display an error message when user will select Approve/Reject button and once user put some data in some field then only status should be changed to ACCEPTED/REJECTED.It seems that after changing the status control in coming to WDMODIFYVIEW. Please suggest.
Please suggest.
Thanks
Shuvrajyoti
Hi Vinita,
Error message is coming after status of the supplier is changed to ACCEPTED which should not be the case.Our requirement is to through error message once ACCEPT button is clicked and status should not be changed if you don't provide some approval comments etc. in some field.
Thanks
Shuvrajyoti
User | Count |
---|---|
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.