2004 Oct 20 3:31 PM
Hi all,
The following Function Module works only in debug mode. The purpose of this FM is to create a notification and to put it in progress status. If I put a breakpoint before "CALL FUNCTION 'BAPI_ALM_NOTIF_PUTINPROGRESS'" it works. If I execute this FM without putting a breakpoint at that place it creates the notification but doesnt put it in progress status.
In other words, the last BAPI call doesnot work if I dont put a breakpoint before.
Can somebody help me to find out where is the problem?
Thanks,
Younes
FUNCTION ZFM_CREATE_NOTIF_IN_PROCESS.
*"----
""Local interface:
*" IMPORTING
*" VALUE(NOTIFTYP) TYPE CHAR2
*" VALUE(NOTIFHEADER) TYPE BAPI2080_NOTHDRI
*" EXPORTING
*" VALUE(NOTIFNUMBER) TYPE CHAR12
*" VALUE(NOTIFCURSTATUS) TYPE CHAR40
*"----
DATA: gs_bapi2080_nothdre TYPE bapi2080_nothdre,
gt_return TYPE TABLE OF bapiret2.
The notification is created with a temporary number
CALL FUNCTION 'BAPI_ALM_NOTIF_CREATE'
EXPORTING
notif_type = NOTIFTYP
notifheader = NOTIFHEADER
IMPORTING
notifheader_export = gs_bapi2080_nothdre
TABLES
return = gt_return.
READ TABLE gt_return TRANSPORTING NO FIELDS WITH KEY type = 'E'.
CHECK sy-subrc IS NOT INITIAL.
*The notication will be saved with a number which isnt temporary
CALL FUNCTION 'BAPI_ALM_NOTIF_SAVE'
EXPORTING
number = gs_bapi2080_nothdre-notif_no
IMPORTING
notifheader = gs_bapi2080_nothdre
TABLES
return = gt_return.
READ TABLE gt_return TRANSPORTING NO FIELDS WITH KEY type = 'E'.
CHECK sy-subrc IS NOT INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
The Notif is already created, it will be put in progress status
NOTIFNUMBER = gs_bapi2080_nothdre-notif_no.
CALL FUNCTION 'BAPI_ALM_NOTIF_PUTINPROGRESS'
EXPORTING
NUMBER = NOTIFNUMBER
LANGU = SY-LANGU
IMPORTING
SYSTEMSTATUS = NOTIFCURSTATUS
TABLES
RETURN = gt_return.
2004 Oct 20 3:36 PM
Hi Emmanuel,
As BAPIs do not have a commit of their own you should trigger this commit your self. You do so for the first BAPI you call, but not after the second one.
In Debugging mode the commit work is triggered automatically!
Regards,
John.
2004 Oct 20 3:51 PM
Hi John,
I have tried your solution but It does not change anything. Maybe when we put a breakpoint before the call of BAPI_NOTIF_PUTINPROGRESS it gives enough time to the commit just before to be performed. If it's really the problem how can solve it?
Thank you anyway.
Younes
2004 Oct 20 3:55 PM
Hi Emmanuel,
Now I get your problem: you want to wait to have the commit finished! The call to BAPI_TRANSACTION_COMMIT has an optional parameter 'WAIT' which is space by default which causes only a commit. When you set this parameter to 'X' it will do a commit work and wait.
This should solve your problem!
Regards,
John.
2004 Oct 20 3:57 PM
Hi Emmanuel,
When entering debug mode the system performs a commit on database. If you have created the notification just before you want to set the status, the notification does not exist on the database unitl time of commit. You should use the function BAPI_TRANSACTION_COMMIT before calling the function for updating status.
Hope this helps!
🐵 Jacob
2004 Oct 21 2:57 AM
Add Statement SET UPDATE LOCAL at the beginning of the FM.
Regards
VEnkat
2011 May 01 5:06 PM
Hi,
please tell me in which exit we can use this BAPI , I have to use the same functionality in IW21
Thanks & Regards
Dhananjay Mishra
Edited by: dhananjay.93 on May 1, 2011 6:07 PM