cancel
Showing results for 
Search instead for 
Did you mean: 

Customizing Work Manager 6.1 to create notification and attachments

0 Kudos

Hi Experts,

I have a requirement in Syclo to customize locally created notifications to upload attachments in single transmit. For this my idea would be

  1. Modify rules in Agentry to enable attachment for notifications not posted
  2. create custom notification post steplet and stephandler. Stephandler will contain standard NotificationAddPostBAPI
  3. Stephandler run() method will also include Document Capture BAPI that will be triggered multiple times based on the number of attachments per notification
  4. BAPI's will remain same (Standard) for Notification create and attachment upload at ABAP layer

I would need correct direction to get this achieved. Any other options too are welcome.

Accepted Solutions (1)

Accepted Solutions (1)

Marçal_Oliveras
Active Contributor
0 Kudos

Hi Syed,

I did the changes and it works fine now. In case someone wants to do the same here are the steps:

Agentry:

  • Enable add pictures to local notifications modifying rules
  • Create a new action to attach pictures to a notification with 2 subactions. The first one is the original for non-local notifications but the second one is for local notifications. The only difference is that I removed the update step calling to SAP in the one for local notifications
  • In the transmit action, the first subaction is deleting documentlinks from notifications. Change the rule to be sure you don't delete the ones from local notifications.
  • Created a new edit action with a transaction calling the update step removed from the transaction that adds pictures to a notification. Use this new action as a loop when posting the notification to SAP in transmit, NotificationPostCurrent action.

JAVA:

  • Send the local notification ID when creating a notification. By default the ID is not sent.

SAP:

  • When a notification is going to be created use the BADI before the BAPI call to save the local notification ID in a BADI attribute.
  • After creation, save the link between local ID and real SAP ID to a cross reference table. Use /SYCLO/MDW03 causes problems of deprecated code being triggered... I created a new table with the same fields
  • When calling the BDS or DMS document create method, if the ID is LOCAL_*, search for it in the cross reference table and replace it.
0 Kudos

Hi Marcal,

Wonderful and thanks for reply. I did not test this yet as standard attachment is not working on DMS.

fazal_ilahi
Explorer
0 Kudos

Hi Marcal,

In Agentry, your pictures were getting saved under Notification or under Main Object ?

Thanks,

Fazal.

Marçal_Oliveras
Active Contributor
0 Kudos

Hi Fazal,

The attached pictures are saved under Notification Object.

I think the Main Object Document Link collection is to store the pictures retrieved after executing a push request. Then the data fetched from SAP is stored in the main object.

fazal_ilahi
Explorer
0 Kudos

Hi Marcal,

Thanks for the quick response

When I am looking at the code, it seems to me to be the other way round. Downloaded pictures are getting attached under Notification but new ones are getting stored under Main Object.

In your Agentry Editor, do you have an object DocumentMetaData ?

Thanks,

Fazal.

Marçal_Oliveras
Active Contributor
0 Kudos

Hi,

No I don't have the DocumentMetaData object. I'm working with Work Manager 6.1.0, I know there was a version 6.1.1 (before 6.2) and actually most of the changes between version where related to document links. But I already did to many changes to the original to upgrade to 6.1.1

fazal_ilahi
Explorer
0 Kudos

Hi,

Yeah I expected the difference in version.

In the steps that you provided for Agentry, there is a last step where you are creating a new transaction with update step for attachment. How did you set the Initial Value for the properties of this transaction? Is it 'From Object property'?

Thanks,

Fazal.

Marçal_Oliveras
Active Contributor
0 Kudos

Yes, everything is from object property since I don't need to modify anything, I got all the date using the copy of the standard transaction. Here I just need to post the document link with the AttachmentCaptureSteplet.

Former Member
0 Kudos

Hi Marçal,

regarding

  • After creation, save the link between local ID and real SAP ID to a cross reference table. Use /SYCLO/MDW03 causes problems of deprecated code being triggered... I created a new table with the same fields

do you recall what kind of problems you had with deprecated code? Did you encounter the problems with ABAP or Java code? (I would like to have the key replacement logic on the java side, using /SYCLO/MDW03 for data persistence.)

Regards, Daniel

Marçal_Oliveras
Active Contributor
0 Kudos

Hi

Sorry, I don't remember the details, but I'm almost sure it was something in the Java side.

When a record exists in /SYCLO/MDW03 some conditional statement in Java is executed (I found it debugging) and then the fetch was not working properly, but I can't recall what were the exact consequences.

I tried to create the entry temporarily and delete it during the same transmit process using a Work Manager BADI or Enhancement Point, but I wasn't able to solve it. I'm not sure but I think I found what I was supposed to do and then I decided that creating a new Z table was easier and even more elegant.

Former Member
0 Kudos

Hi,

thanks for the information... I guess I will give it a try - maybe they fixed the issue in the 6.2 code.

Regards, Daniel

Answers (2)

Answers (2)

Former Member
0 Kudos

I find way to only change Agentry and Java and reuse all existing backend BAPIs.

There are multiple ways of doing that. I think SAP should provide it out of box though.

Marçal_Oliveras
Active Contributor
0 Kudos

Hi Syed,

Did you manage to implement your proposal?

I have exactly the same requirement, my first thought before reading your thread was the following:

  • Enable add attachments action for local notifications
  • Keep the standard functionality but force the notification create BAPI to be executed always before the Attachment creation.
  • When the attachment creation BAPI sends the document, replace the local notification ID for the real SAP notification ID. This link between local ID and real ID was stored in table /SYCLO/MDW03 in SAP for Work Manager 5.2 but for 6.1 it seems the table is empty, so I'm not sure if I will be able to implement exactly mi idea.
0 Kudos

Hi Marçal,

I did not implement yet, I was planning to have it done in similar fashion you mentioned. We can get real id , local id in WM 6.1 as i saw its method called in java layer. Notification create BAPI gets Notification object (context) where as attachment create BAPI requires DocumentLink object (context) and should be called multiple times. I will post reply if this approach works.

Thank You

Marçal_Oliveras
Active Contributor
0 Kudos

Hi Syed,

How did you manage to get the cross reference between local notification ID and the one given by SAP?

I'm starting this development now and I still don't see if this relationship is stored somewhere, because actually Work Manager is just deleting the local notification after creating it, and then the real one from SAP is fetched afterwards, so probably the standard solution doesn't need to store this data.

Have you modified your Java/ABAP source to keep it?

Did you finally implement everything?

Thank you,

- Marçal

0 Kudos

Hi Marçal,

I have the code built but issue on standard WM6.1 DMS document upload issue is interrupting my testing. I will post once this is successful.

Another approach worth a try is no java change and just Agentry changes which include NotificationAddPost transaction to replace client key instead of delete and as usual post DocumentCreate transaction. I could not test even this approach as well due to bug.

Thank You

Marçal_Oliveras
Active Contributor
0 Kudos

Hi ,

But with the 1st approach how are you retrieving the real notification ID when posting the attachment?

Regarding the second, I think it is even better but if I'm not wrong it forces to do some major changes to all the standard Notification creation process (java and ABAP) which I always try to avoid... In Agentry something as simple as replace the object ID can be a nightmare, but I may give it a try.