cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering approval with attach files on Material Reservation MB21

Former Member
0 Kudos

Hi Experts,

   We have a requirement that needs to trigger approval with attach files when save material reservation MB21. Actually User wants to attach a desktop item (word, excel or text file) and item from Outlook inbox/outbox can be attached to the reservation.Once we save the reservation, the approval email gets triggered to the approver along with those attach files to his SAP inbox. So i believe, we have to do below two things.

1. Need to do settings/customizing that allow to add multiple attach files while creating material reservation since SAP standard doesnt have option to attach file in MB21.

2. Need to include the attach file coding part into the existing process as it is already routed to appropriate approvers.

So existing process is, while save material reservation, the notification is triggering to respective approver correctly. Now the addtional requirement is to include attach files while triggering approval. if anyone already experienced on this case, Pls give some ideas that how can we do settings/customizing that allow us to attach file in MB21 And also kindly provide some coding part support towards the inclusion of attach file concept?. It would be very immensly helpful in order to achieve this requirement. Many thanks in advance.



Regards,

Kavi

Accepted Solutions (1)

Accepted Solutions (1)

SandySingh
Active Contributor
0 Kudos

Hi Kavi

First you have to identify the BOR object linked to MB21. activate trace in TX - SWELS and Try to save the material reservation and go back to transaction SWEL to see which BOR object and event is triggered.

Once you have identified the BOR object and event, you can try to activate the GOS for TX- MB21 . Refer to links below.  GOS functionalities are available when we instantiates class CL_GOS_MANAGER in the application. As parameter you have to provide BOR object and the key

[https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0e6b0d95-0a01-0010-4696-ca0...]

[http://help.sap.com/erp2005_ehp_04/helpdata/EN/be/3fe63659241157e10000009b38f889/frameset.htm]

So when the WF is triggered with identified BOR object and event, then you can retrieve the attachments in first step and store in WF Container and pass it via bindings to approval task.

Regards

Sandy

SandySingh
Active Contributor
0 Kudos

Hi Kavi,

The Linked BOR object to MB21 is BUS2093 but there is not event defined in this BOR. So looks like you have to create a Subtype ZBUS2093 of BUS2093 and add a "created" event. Then you can trigger the workflow  by triggering this event (using FM SAP_WAPI_CREATE_EVENT) in a User exit or implicit enhancement . Refer to link below

For WF

Regards

Sandy

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Sandy,

    I have activated GOS toolbar for MB21/MB22/MB23.  Now attachments can be inserted. But there is a problem that the attachment list is not refreshing/clearing properly in MB21.

   For instance, i have attached one file into one material reservation number say '10001' and saved. Then again when i go to mb21 for creating another reservation the GOS attachment list has still old attachment for this newly creating reservation as well(Instead the attachment list should be empty as its a new creation ! ). So the issue is that attachment list is not refreshing/clearing properly. Actually I have done an implict enhancement at include 'MM07RFP0 '. Below are the coding which i have used for GOS toolbar activation.


Coding part :

DATA: LO_GOS_MANAGER TYPE REF TO CL_GOS_MANAGER,

      LS_BORIDENT TYPE BORIDENT.

LS_BORIDENT-OBJTYPE = 'BUS2093'. " ASSIGN THE BUSINESS OBJECT

LS_BORIDENT-OBJKEY = RM07M-RSNUM. " ASSIGN THE OBJECT KEY

CREATE OBJECT LO_GOS_MANAGER

  EXPORTING

    IS_OBJECT = LS_BORIDENT

    IP_NO_COMMIT = ' '

  EXCEPTIONS

    OBJECT_INVALID = 1.



Pls advise how to give coding that whenever i go to MB21 it should refresh/clear the attachment list in GOS toolbar. Kindly give your ideas. Many thanks in advance.

SandySingh
Active Contributor
0 Kudos

Hi Kavi,

Since you have raised a new post specific to attachment refresh issue, I suggest close this post with correct and helpful answers. This will avoid duplications.

Regards

Sandy

Former Member
0 Kudos

Hi Sandy.

  Sure. I am also thought to do the same. Once again thanks for your support. I will close this thread.

Regards,

Kavi

Former Member
0 Kudos

Hi Sandy,

   Thank you so much for your links. That immensly helped a lot. Now i have activated the GOS toolbar in MB21/MB22/MB23.

   Then the final step is that i need to send notification along with those attachment. Now there is already a customized material resevation workflow event(ZWOMATRSRV) we have developed and it is routing to approvers properly which is our existing process. So now the additional req is i need to set the attach should go along with notification to User. So is it feasibility to send notification along with that GOS attachment to user?. Can you guide me for this attachment part coding wise too? Is this can be done via User decision step before approving step?. Really it would immensly help me to acheive this whole requirement. Many thanks.

Regards,

Kavi

SandySingh
Active Contributor
0 Kudos

Hi Kavi

You will have to create a background step in WF to get the GOS attachments CL_BINARY_LINKS class . Then you have two options either send email via CL_BCS class OR... pass the attachment to WF container and use WF email step.

Refer to link below

Hope it helps

Regards

Sandy