Skip to Content
0
Former Member
Feb 12, 2015 at 04:38 AM

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

43 Views

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:

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


Thanks,

Nirav