Quantcast
Channel: SCN: Message List - ABAP Connectivity
Viewing all articles
Browse latest Browse all 3125

Not able to create Maintenance Notification using SAP .NET Connector 3.0

$
0
0

Hi,

I am working on a .NET Console application to create maintenance notification. I am using SAP .NET Connector 3.0 to connect to SAP system from my console application.

 

As per the requirement to create a notification I am using following BAPI calls in given order:

 

1. BAPI_ALM_NOTIF_CREATE

                IRfcFunction funcCreateNotification = this.SAPRfcDestination.Repository.CreateFunction("BAPI_ALM_NOTIF_CREATE");

               funcCreateNotification.SetValue("NOTIF_TYPE", notif_Type);

                funcCreateNotification.SetValue("NOTIFHEADER", notifheader);

                funcCreateNotification.SetValue("ORDERID", orderid);

                funcCreateNotification.SetValue("SENDER", sender);

                funcCreateNotification.SetValue("TASK_DETERMINATION", task_Determination);

                funcCreateNotification.SetValue("NOTIFHEADER_EXPORT", notifheader_Export);

                funcCreateNotification.SetValue("KEY_RELATIONSHIPS", key_Relationships);

                funcCreateNotification.SetValue("LONGTEXTS", longtexts);

                funcCreateNotification.SetValue("NOTIFACTV", notifactv);

                funcCreateNotification.SetValue("NOTIFCAUS", notifcaus);

                funcCreateNotification.SetValue("NOTIFPARTNR", notifpartnr);

                funcCreateNotification.SetValue("NOTIFTASK", notiftask);

                funcCreateNotification.SetValue("NOTITEM", notitem);

                funcCreateNotification.SetValue("RETURN", return0);

                funcCreateNotification.Invoke(this.SAPRfcDestination);

 

Above BAPI call gives me notification number in notifheader_Export object. I pass this notification number "%00000000001" to BAPI_ALM_NOTIF_SAVE function as shown below.

 

2.     BAPI_ALM_NOTIF_SAVE

               RfcSessionManager.BeginContext(this.SAPRfcDestination);

               IRfcFunction funcSaveNotification = this.SAPRfcDestination.Repository.CreateFunction("BAPI_ALM_NOTIF_SAVE");

                IRfcStructure structNotifExp = funcSaveNotification.GetStructure("NOTIFHEADER");

                funcSaveNotification.SetValue("NUMBER", notifheader_Export.GetValue("NOTIF_NO"));

                funcSaveNotification.SetValue("NOTIFHEADER", structNotifExp);

               IRfcFunction funcCommit = this.SAPRfcDestination.Repository.CreateFunction("BAPI_TRANSACTION_COMMIT");

               funcSaveNotification.Invoke(this.SAPRfcDestination);

                funcCommit.Invoke(this.SAPRfcDestination);

               RfcSessionManager.EndContext(this.SAPRfcDestination);

 

After save I commit changes by calling BAPI_TRANSACTION_COMMIT.

At the end of this function call I expect structure 'structNotifExp' to retun valid notification number but it only return empty string.

 

Could you please suggest me why I am not able to create notification?

 

I found some posts similar to my problem but suggested solution didn't help me: BAPI_ALM_NOTIF_CREATE not creating any maintenance notification.    

 

Could you please suggest me why I am not able to create notification?


Thanks,

Nirav


Viewing all articles
Browse latest Browse all 3125

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>