on 10-12-2004 9:42 AM
Dear All,
I have got a function in SAP R/3 4.6, which has got one Table as parameter. I use the following code to call this function via .NET connector. everything goes fine except that the passing parameter is considered as call by value instead of reference.
private void InitializeComponent()
{
this.zemP_ADSTable1 = new SAPRFC.ZEMP_ADSTable();
((System.ComponentModel.ISupportInitialize)(this.zemP_ADSTable1)).BeginInit();
this.DataGrid1.SelectedIndexChanged += new System.EventHandler(this.DataGrid1_SelectedIndexChanged);
this.Button1.Click += new System.EventHandler(this.Button1_Click);
//
// zemP_ADSTable1
//
this.zemP_ADSTable1.AllowEdit = true;
this.zemP_ADSTable1.AllowNew = true;
this.zemP_ADSTable1.AllowRemove = true;
this.zemP_ADSTable1.SupportsChangeNotification = true;
this.Load += new System.EventHandler(this.Page_Load);
((System.ComponentModel.ISupportInitialize)(this.zemP_ADSTable1)).EndInit();
}
#endregion
// this method prepare the ADSTable based on ADS structure.
private void prepareADSTable()
{
zemP_ADSTable1 = new ZEMP_ADSTable ();
zemP_ADS = new ZEMP_ADS ();
zemP_ADS.Name="Amirali";
zemP_ADS.Lastname="pourteymour";
// employee.Email="amirali.pourteymour@cablesurf.de";
// employee.Tel="01636558732";
zemP_ADSTable1.
zemP_ADSTable1.Add (zemP_ADS);
//return employees;
}
private void Button1_Click(object sender, System.EventArgs e)
{
SAPHR proxy = new SAPHR();
try
{
proxy.Connection = SAP.Connector.SAPLoginProvider.GetSAPConnection(this);
prepareADSTable();
proxy.Zemp_Ads_Update(ref zemP_ADSTable1);
// Call methods here
// Now update Data Bindings. On WinForms this will be automatic, on WebForms call the following line
this.DataBind();
}
catch(Exception ex)
{
TextBox1.Text = ex.ToString();
// If SAPLoginProvider.GetSAPConnection(this) cannot get a connection, we might get an error. // Normally this can be ignored as it will automatically will force a relogon.
}
}
but the table parameter is not considered as call by reference. am I doing something wrong.
Regards,
Amirali
Hello
I want the runtime installation of .net connector ver 1.2.2 . Where will get the same? on service.sap.com/connector it is not shown.
Thanks
Sandeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Did you get any error at compilation time or at runtime? If yes, what is the original error message ?
By the way, I saw the following code:
private void prepareADSTable()
{
zemP_ADSTable1 = new ZEMP_ADSTable ();
. . .
}
Please reconsider this line. It is at least unnecessary if it is not harmful.
Regards,
Guangwei
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Inside InitializeComponent, you already have
this.zemP_ADSTable1 = new SAPRFC.ZEMP_ADSTable();
Therefore, the line I mentioned in my last response is unnecessary. As for the null reference problem, you can sure resolve it with VS debugger.
I am more interested in the "Call By Reference" problem. Why did you believe that you have this problem?
Guangwei
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.