Hi there,
I decided to create the post because it's the second time I have to enhance Work Manager 6.x with this functionality that in my opinion should come out-of-the-box, I hope SAP will add it in the future.
It will also be useful for inexperienced developers since there are not many articles about how to develop in Agentry, and this task involves changes to all the different components.
The Problem:
In Work Manager 6.2 the option to attach pictures to a notification is disabled when the object is local, meaning that it doesn't exist yet in SAP and therefore it only has a temporary local ID.
This is very inconvenient for field technicians working offline. If they need to create a notification they can't add pictures to it before they synchronize the data to SAP and that is only possible when they are online. Therefore I assume that a lot of customers had to do the same enhancement.
The below explanation is highly technical and it requires a knowledge of Agentry Framework development, including UI, Java interfacing and Back End processing:
Development Overview:
Agentry UI changes:
The action to add picture to a notification has been replaced for a new action that calls the original one in case of a non-local notification or a new one (without update step) for local notifications.
The non-local notifications will be processed as in the standard solution, but the local ones, will first be first posted in SAP, and later on if they have documents attached, a new action during the transmit will be executed to add them once the real SAP notification ID is known.
Rules:
Transactions:
Actions:
Screens:
Action from button "Upload picture" modified to use the new Z_DocumentLinkPictureAddForNotification.
This is how the new action to add pictures looks like:
And the new action to add pictures executed after posting the local notification.
Java changes:
@Override
protected void setHeaderParameters(Logger log) throws Exception {
super.setHeaderParameters(log);
//Set the notification ID for local notificatons, it will be used to create an
//entry to the custom cross reference table to be able to add pictures knowing only the local ID
if (_notification.getIsLocal()) {
setValue(_imports, log, "IV_NOTIF_NO", _notification.getNotifNum());
}
}
Configuration Portal Adjustments:
ABAP Changes:
*2015-08-16 Update: Check Sergey comment on this blog, since he implemented the functionality without ABAP changes. As I mention below in my original text, when I tried to do this first time in version 6.1.0 some deprecated code was triggered using table /SYCLO/MDW03, but standard Java source has been updated since then and probably this is not happening anymore in 6.2.X (or maybe I did something wrong in my attempt): Comment Link
To be able to add attachments to a notification whose ID in the Agentry client is LOCAL_X, the following changes have been implemented in SAP in order to know the notification ID assigned by the backend after its creation and be able to add the corresponding attachment to it.
* Read the client local notification ID into the BADI attribute
ASSIGN ('CS_MDO_INPUT_VALS-IV_NOTIF_NO->*') TO <lv_notif_no>.
IF <lv_notif_no> IS ASSIGNED AND <lv_notif_no> CS 'LOCAL_'.
me->notif_no = <lv_notif_no>.
CLEAR <lv_notif_no>.
ENDIF.
* Get the local client and the SAP notifications ID values and create an entry in the xref table
ASSIGN ('CS_MDO_OUTPUT-ES_NOTIF_HEADER->*') TO <ls_bapi_notif_header>.
IF <ls_bapi_notif_header> IS ASSIGNED AND <ls_bapi_notif_header>-notif_no IS NOT INITIAL.
CALL METHOD cl_system_uuid=>if_system_uuid_static~create_uuid_c32
RECEIVING
uuid = ls_cust_xref-reference_guid.
ls_cust_xref-user_guid = <ls_bapi_input>-user_guid.
ls_cust_xref-object_type = me->wm_obj_type_notif.
ls_cust_xref-source_obj_key = me->notif_no.
ls_cust_xref-target_obj_key = <ls_bapi_notif_header>-notif_no.
ls_cust_xref-effective_ts = 0.
ls_cust_xref-changed_by = sy-uname.
/syclo/cl_core_bapi_tools=>get_system_time( IMPORTING ev_system_ts = ls_cust_xref-changed_ts ).
MODIFY zagt_cust_xref FROM ls_cust_xref.
ENDIF.
* Delete user's notification cross reference IDs
DELETE FROM zagt_cust_xref
WHERE user_guid = <ls_bapi_input>-user_guid
AND object_type = me->wm_obj_type_notif.
Implicit enhancement point added in order to replace the local notification ID for the real one created in SAP when posting a BDS picture. Implementation details:
ASSIGN <ls_mob_in_params>-value->* TO <lv_target>.
IF <lv_target> IS ASSIGNED.
ASSIGN <lv_target> TO <ls_business_obj>.
* Replace the local notification ID for the SAP ID
IF <ls_business_obj>-typeid = lc_type_maint_notif AND <ls_business_obj>-instid CP 'LOCAL_*'.
lv_source_obj_key = <ls_business_obj>-instid.
SELECT SINGLE target_obj_key FROM zagt_cust_xref INTO lv_target_obj_key
WHERE user_guid = me->active_user_guid
AND object_type = lc_wm_obj_type_notif
AND source_obj_key = lv_source_obj_key.
IF sy-subrc = 0.
lv_qmnum = lv_target_obj_key.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_qmnum
IMPORTING
output = lv_qmnum.
<ls_business_obj>-instid = lv_qmnum.
ENDIF.
ENDIF.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
5 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 |