cancel
Showing results for 
Search instead for 
Did you mean: 

Reason of rejection

vinita_kasliwal
Active Contributor
0 Kudos

I am trying to code for reason of rejection in doc_check_badi however facing issues in implementing the functionality

We have placed a custom code in DOC_CHECK_BADI to have the approval note as mandatory while the SC is rejected . This is the piece of code in DOC_CHECK BADI

* Check if user Rejected the Shopping Cart
IF lv_decision EQ 'REJECTED'.

* Read Approval Note
SORT lt_appnote BY guid.
READ TABLE lt_appnote ASSIGNING <fs_appnote>
WITH KEY guid = iv_doc_guid BINARY SEARCH.
IF sy-subrc EQ 0.

CHECK <fs_appnote> IS ASSIGNED.
IF <fs_appnote>-tdid NE 'NOTM'.

* Save error message
ls_messages
-msgty   = zsrm_if_wf_constans=>gc_msg_type.
ls_messages
-message = 'Please enter reason for rejection'.
APPEND ls_messages TO et_messages.
ENDIF.
*********START OF MODIFICATION for making reason of rejection Manadatory ************************   "001

ELSE.
* Save error message
ls_messages
-msgty   = zsrm_if_wf_constans=>gc_msg_type.
ls_messages
-message = 'Please enter reason for rejection'.
APPEND ls_messages TO et_messages.


Case 1 : When trying through UWL buttons --- not working

Case 2 : When clicking on Submit ---- not working

Case 3 : when clicking on Check --- working and throws the error message ‘Please enter the reason of rejection

We want case 1 and case 2 to work like case 3  and also would like to work this for line item based rejection as well .

We are in SRM_SERVER                701         0009       SAPK-70109INSRMSRV  SRM_SERVER

Do you think we should apply the below notes ?

1621624 - SC cannot be rejected because of document error messages

1565582 - SC item based rejection cannot carry out due to errors

I tried to download the note in my system and status says : Cannot be implemented

Please see the attached screenshots for reference ..

      

Case 1 : When clicking from UWL buttons it goes into DOC CHECK BADI and checks for the code however it still lets the approver reject the SC without reason of rejection it justs gives a warning no error message as is written in doc_check



Case 2 :  When clicking on Submit button without entering the reason of rejection it is not stopping in DOC_CHECK_BADI . Thus reason of rejection is not being mandatory and gets successfully submitted . Thus it is not working ..

Case 3 : When clicking on the check button it works

Accepted Solutions (0)

Answers (1)

Answers (1)

konstantin_anikeev
Active Contributor
0 Kudos

Hi Vinita,

CHECK_BADI should not be called for rejection. Approved should be able to reject shopping cart also with errors. You may need to make an enhancement in /SAPSRM/CL_PDO_BO_SC_ADV->/SAPSRM/IF_PDO_ADV_BASE~REJECT

In this case, offline rejection will also not work and approver will have to login into the system.

Regards

Konstantin

vinita_kasliwal
Active Contributor
0 Kudos

Hey konstantin

please can you let me know in more details ? Ideally when we click on submit button it should be taking us to DOC_CHECK _BADI and checking for the piece of code I had written for reason of rejection pl could you explain as to why this is not being done ?

I saw the below pieoce of code here :

Can you explain where do I insert the code and the error message would be reflected in the parameter CO_MESSAGE_HANDLER  could you let me know exactly on what to code here as there is nothing in signature so ideally have to call all the FM here ?

Secondly for my future ref how did you understand that the class here would be the correct one to use ?

Thanks for the help in advance .

Former Member
0 Kudos

Hi Vinita,

The screenshot that you shared was containing item level approval. In that case /SAPSRM/CL_PDO_BO_SC_ADV->/SAPSRM/IF_PDO_ADV_BASE~REJECT method wouldn't be called. It is called when Rejection decision is taken at header level.

Regards,

Karthik Babu.

vinita_kasliwal
Active Contributor
0 Kudos

Ok thanks for the reply , can you confirm me why the code I have placed in doc_check_badi not running for rejection at header level status of SC  ? It works when I click on button "check" but when I click on submit it doesnt work .

Please can you confirm ? and for my requirement for maintaining the reason of rejection as mandatory where should I be making the change in code ?

Former Member
0 Kudos

Hi Vinita,


Try enhancing the following method.


/SAPSRM/CL_PDO_BO_SC_ADV->/SAPSRM/IF_PDO_ADV_BASE~SUBMIT_DECISION()

This is where the underlying BO, which is required to save the approval note and attachments is done. Use the method get_rejected_items method to fetch if there are any rejected items, and in that case, you can add error messages to  co_message_handler.


Please see that, I didnt try it in my system, as I have limited access.


Regards,

Karthik Babu.