cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to pick the 'Notes For Approval' text into the mail body ?

Former Member
0 Likes
1,234

Hi Experts,

If a SC is rejected by the approver, the approver will write some reasons for rejection in the Notes For Approval text box.

My requirement is, the text ( rejection reasons ) written in the Notes For Approval text box should come in the rejection mail (Lotus notes,) to the lower level approvers .

How can I get this , please give me a solution .

Thank you

Regards

Krishhna

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Hi krishna,

To add long text pls check the below link

[;

Pls check below link for passing rejection content to email body

[;

regards

sahil p

Former Member
0 Likes

Hi Sahil,

Thank you for your reply. I understood that , we can fetch the 'Notes for Approval' text from method MAIL_DATA_GET of BAdi BBP_OFFLINE_APP.

But where it is storing the text written in 'Notes For Approval'. If we can find that one, then we can display the text in the rejection mail.

Best Regards

Krishhna

Former Member
0 Likes

Hi krishna,

Pls use the FM READ_TEXT to read all long for SC or PO etc.

while you need to pass GUID of item if it is line item pass your object type, ID as example NOTM ( you should know in your case) also the business object type

regards

sahil p

Former Member
0 Likes

Hi ,

I implemented the below code in the BAdi BBP_OFFLINE_APPBADI~MAIL_DATA_GET method

Is it will work or not ? Please give me any other suggestions if required.

   Data: sc_id TYPE CRMD_ORDERADM_H-OBJECT_ID,
      sc_guid TYPE CRMD_ORDERADM_H-GUID.

Data: approval_notes type TABLE OF BBP_PDS_LONGTEXT,

      wa_appr_notes type BBP_PDS_LONGTEXT .


CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
EXPORTING
*   I_GUID                           =
    I_OBJECT_ID                      = sc_id
*   I_ATTACH_WITH_DOC                = ' '
*   I_WITH_ITEMDATA                  = 'X'
*   I_ITEM_SORTED_BY_HIERARCHY       =
*   I_WITHOUT_HEADER_TOTALS          =
*   I_READ_FROM_ARCHIVE              = ' '
* IMPORTING
*   E_HEADER                         =
*   EV_IS_PD                         =
*   ET_ATTACH                        =
TABLES
*   E_ITEM                           =
*   E_ACCOUNT                        =
*   E_PARTNER                        =
*   E_CONFIRM                        =
    E_LONGTEXT                       = approval_notes
*   E_LIMIT                          =
*   E_ORGDATA                        =
*   E_TAX                            =
*   E_PRIDOC                         =
*   E_HCF                            =
*   E_ICF                            =
*   E_MESSAGES                       =
*   E_ACTVAL                         =
*   E_ACC_ACTVAL                     =
*   E_HEADER_REL                     =
*   E_ITMLIM_REL                     =
*   E_STATUS                         =
          .

IF sy-subrc eq 0.
loop at approval_notes into wa_appr_notes .
write 😕 wa_appr_notes-tdline.
endloop.
ENDIF.

Former Member
0 Likes

Hi Krishna,

The FM looks fine but the last statement may  not work. first  You have to loop the item details of SC then inside you have to loop the long text of the shopping cart based upon the consideration of GUID of item with that of GUID of long text.

just look into below code.

loop at it_item into wa_item.

check for current line item status.

    CALL METHOD /sapsrm/cl_wf_apv_facade=>get_current_decision

      EXPORTING

        iv_document_guid = WA_ITEM_GUID

      IMPORTING

        ev_decision      = lv_decision.

if lv_decision = "REJECTED'.

loop at it_long text into wa_longtext where guid = wa_item-guid.

check for IT_LONGTEXT-TDID = 'NOTM'  which contain the long text with one you have defined for rejection.

the use FM READ_TEXT to read the entire text as your case it should be rejection.

pass this rejection note into the subject or inside the mail content and modify it in the Badi BBP_OFFLINE_APV_BADI.

endif.

endloop.

endloop.

Remember if you want to change the body of the e-mail then you have to develop z custom smart form and which should override the std smartform BBP_OUT_EXCEPTION and you have to implement the badi BBP_CHANGE_SF

REGARDS

SAHIL P

Former Member
0 Likes

Hi Sahil,

Thanks for your reply.

I think, the smartform BBP_OUT_EXCEPTION is triggered to the rejection mail, then is this code wil develop in the smart form.

If yes, how can we do that one ?

Former Member
0 Likes

Hi Murali,

BBP_OUT_EXCEPTION is the std smartform has been called whenever there is e-mail content going to the reciepients.

As you said you have found BBP_OUT_EXCEPTION smartform in your case, now if you want to add those rejection note content to cover letter of e-mail, then you have to copy the std smartforms into custom one like ZBBP_OUT_EXCEPTION.

inside the smart form read those rejection text with the help of FM BBP_PD_SC_GETDETAILS Item details and longtext.

next step is you have to call your custom smartform in the badi BBP_OUTPUT_CHANGE_SF  method
CHANGE_FORMS.

consider below code as example

IF IS_EVENT-EVENT ='APPROVAL_PROCESS_DOC_REJECTED' and   IS_EVENT-OBJECT_TYPE   = 'BUS2121'.

CV_SMARTFORM_MAIL = 'ZBBP_OUT_EXCEPTION'.

ENDIF.

regards

sahil p

Former Member
0 Likes

Hi Sahil,

I done the same thing. I called the custome smartform ZBBP_OUT_EXCEPTION only, I done the all changes you said (

next step is you have to call your custom smartform in the badi BBP_OUTPUT_CHANGE_SF  method
CHANGE_FORMS.).

Now I want to add the rejection reasons in the smartform . Can you please give me the total details (If you have coding of that , that coding also ) to call the FM BBP_PD_SC_GETDETAILS Item details and longtext.

Waiting for your reply.

Thanks a lot Sahil

Regards

Krishna

Former Member
0 Likes

Hi Sahil,

In the smart form ZBBP_OUT_EXCEPTION  I developed this code,

In the global definitions , Internal table and Workarea are

approval_notes type table of  BBP_PDS_LONGTEXT,

wa_appr_notes type  BBP_PDS_LONGTEXT.

And I created a Program Lines , in that I called the FM BBP_PD_SC_GETDETAILS, into this I passed SC_ID (shopping cart id ) as export, APPROVAL_NOTES ( internal table ) as TABLES ,

and I given the SC_ID in the Input parameters and APPROVAL_NOTES in the Output parameters.

I created a Loop , in that I passed &WA_APPR_NOTES-TDLINE& to display the output.

Now, I am getting these errors

Inside the LOOP

1) @8O@ %LOOP1 "APPROVAL_NOTES" is neither specified under "TABLES" nor defined as an internal table.

2) In the Code

@8O@ %CODE1 "APPROVAL_NOTES" has already been declared.

Please resolve these errors and , If any thing I have to develop , please tell me.

Eagerly waiting for your reply.

Thanks a lot

Krishna

Former Member
0 Likes

Krishan,

I could say this is something related with field declaration. pls check global defination and parameter interface where you have difined the variable also check in the main window of SM where you have define and input and output parameter.

make sure whatever rejection text you have to add in the smartforms only where as in badi BBP_OUTPUT_CHANGE_SF you are calling the your driver samrtform.

regards

sahil p

Former Member
0 Likes

krishna,

since you are changing the e-mail cover letter so that which should contain the rejection text along with the other standard contects.

Pls look look into my above sample code and the actully code should be something similar.

also pls check your event schema from SPRO in order to know your event and event sub catagory

Former Member
0 Likes

HI Sahil,

What are the changes I have to do in SPRO,

Please observe my below mail, in that I explained. how I implemented the smartform, now the errors are solved. Is it correct ? If any other implementation I have to do..

Thank you

Regards

Krishna

Former Member
0 Likes

Murali,

You have to maintain Define recipient of notification in SPRO for shopping cart pls check this.

it should be something like

aprove shopping cart------->contact person(in most cases the creator of document )

click on display set the check box for rejection and approval of application object.

My question to you have maintain anything for deadline monitoring ??

regards

sahil

Former Member
0 Likes

Hi Sahul,

I am not maintaining any deadline monitoring ...

Former Member
0 Likes

Hi Sahil,

I done every thing you said,

1) in the SF ZBBP_OUT_EXCEPTION , I am calling FM BBP_PD_SC_GETDETAIL,

and in the BAdi BBP_OUTPUT_CHANGE_SF I replaced the SF with ZBBP....

2) In the SPRO also, all settings are ok.

still the rejection text is not coming into the mail.

Can you please help me.

Regards

Murali Krishna

Former Member
0 Likes

Hi Sahil,

I tried to get the Notes For Approval text in the mail as we discussed with the smart form,

But it is not working . Can you please suggest me any thing.

Your suggestions will be appriciate

Thanks and Regards

Murali Krishna         

Former Member
0 Likes

NEED HELP....

Former Member
0 Likes

Hi krishna

I am finding it little difficulty to answer since i don't know exactly how system is behaving with your case, so i request just debug once more and get to know what exactly been passed with e-mail cover to the recipients.

try the below link

http://scn.sap.com/thread/3148323

time sake just dectivate whatever implimentation you have done in badi and just execute the report and debug it to know better.

regards

sahil p

Former Member
0 Likes

Hi Sahil,

I deleted the smartform zbbp_out_exception and copied the same thing from production. Now I  have to do the same development in this also.

Please observe the screen shot. In this , in which node I have to develope the code ( Call the FM BBP_PD_SC_GET DETAIL) and what are the other declarations I have to do.

Former Member
0 Likes

Hi Sahil,

I put a breakpoint in the function module ( /1BCDWB/LSF00000004F01 )main program generated by SF Zbbp_out_exception. When the approver is rejected the PR , the BP was triggered and it is showing in the BAdi IF_EX_BBP_WFL_APPROV_BADI~GET_REMAING_APPROVERS...

Can you please help me now , to fetch the Notes for approval text into the rejection mail.

waiting for your reply.

Regards

Murali Krishna

Answers (2)

Answers (2)

Former Member
0 Likes

Hello all,

How can i add Internal Note Text from SC to the offline approval email ?

Where and what i should change ?

Many thanks !

Former Member
0 Likes

As far as I know,your requirement is a standard function.

If a cart has mulitple approvers,and any approver adds comment under "APPROVAL NOTES",those comments are always visible to the next approver.