2013 Oct 16 3:18 PM
We currently have a requirement to copy a notification with reference to create a new one. However the standard BAPI does not include the custom fields added to QMEL/VIQMEL. The BAPI structure only lists the standard fields and has no include structure to add additional fields. There are a few implicit enhancement points within the BAPI would could leverage to include custom code to update QMEL/VIQMEL, but this would be a direct table update and this is typically frowned upon.
I've searched through some of the forums and found no real answer. I want to reach out to the community before I attempt to open a customer message with SAP. I feel there has to be a standard solution out there given the fact SAP allows for the QMEL/VIQMEL structures to be updated.
I appreciate any guidance or suggestions on this matter.
Thanks.
2013 Oct 16 3:37 PM
Hi Cullen,
Check if your BAPI provides a TABLES parameter called EXTENSION_IN. If yes you can make use of this parameter to fill your custom fields.
Thanks,
Ajay Bose
2013 Oct 16 3:45 PM
Hi Cullen,
You can check the below example:
http://help.sap.com/saphelp_nw2004s/helpdata/en/6b/3f6d2b6d0711d396a50004ac96334b/frameset.htm
Thanks,
Ajay Bose
2013 Oct 16 4:06 PM
Thanks Ajay. The current BAPI(s) I was looking at don't/doesn't contain that extension as a parameter. I have seen this in other BAPIs and used it before, but it may not help in this case. I might need to go away from the BAPI and use a basic FM and see if that meets the requirements.
2013 Oct 16 4:43 PM
Hi
This my solution (used in a program creates a notification in the last step):
- I've created in the same function group 2 functions:
One to set the data of my custom field and one t get data before saving them
- In my program I call the function to set the data before calling the BAPI to save notification: BAPI_ALM_NOTIF_SAVE
- I've implemented the BADI NOTIF_EVENT_SAVE: I call my fm to get the data in the method CHANGE_DATA_AT_SAVE, here I move my custom fields to CS_VIQMEL
So the flow is:
- Program to create notification:
CALL FUNCTION 'BAPI_ALM_NOTIF_CREATE'
EXPORTING
notif_type = notif_type
notifheader = notifheader
IMPORTING
notifheader_export = notifheader_e
TABLES
notitem = notitem
notifactv = notactvi
longtexts = longtexts
return = return.
LOOP AT return INTO l_return WHERE type = 'E'
OR type = 'A'.
l_error = 'X'.
EXIT.
ENDLOOP.
IF sy-subrc <> 0.
* Move the values of caustom fields:
CALL FUNCTION 'Z_ACM_IMPORT_DATA'
EXPORTING
acm_in = l_zacm_qmel
*
CALL FUNCTION 'BAPI_ALM_NOTIF_SAVE'
EXPORTING
number = notifheader_e-notif_no
IMPORTING
notifheader = notifheader_e
TABLES
return = return.
LOOP AT return INTO l_return WHERE type = 'E'
OR type = 'A'.
l_error = 'X'.
EXIT.
ENDLOOP.
IF sy-subrc <> 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
ENDIF.
- Implementation of BADI NOTIF_EVENT_SAVE (method CHANGE_DATA_AT_SAVE)
CALL FUNCTION 'Z_ACM_EXPORT_DATA'
IMPORTING
acm_out = l_acm_data.
MOVE-CORRESPONDING L_ACM_DATA TO CS_VIQMEL.
My solution is based on property the functions belonging to the same group can be see the same global data:
FUNCTION z_acm_import_data.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(ACM_IN) TYPE ZACM_QMEL
*" REFERENCE(VIQMMA_DATA) TYPE ZACM_VIQMMA_T OPTIONAL
*"----------------------------------------------------------------------
zacm_qmel = acm_in.
ENDFUNCTION
FUNCTION z_acm_export_data.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" EXPORTING
*" REFERENCE(ACM_OUT) TYPE ZACM_QMEL
*"----------------------------------------------------------------------
acm_out = zacm_qmel.
ENDFUNCTION.
I've used the structure ZACM_QMEL to transfer the data (it's defined in TOP include of function group), in my solution I've created a structure in dictionary:
TABLES: zacm_qmel.
Max
2013 Oct 16 5:14 PM
Thanks Max that looks pretty good, and I think that will get us on the right track to creating notifications with references. I appreciate you posting this!