0

Following this link I have found GP table "SY01200" with fields matching those I need ("EmailToAddress", "Master_ID"). Sadly, there are no email addresses for debtors. Could you tell me what I am doing wrong, please? Is information about "SY01200" correct? I am convinced that there is nothing wrong with the code:

    static void Main(string[] args)
    {
        SqlConnectionStringBuilder b = new SqlConnectionStringBuilder();
        SqlConnection c = new SqlConnection("data source=localhost;initial catalog=TWO;integrated security=SSPI;persist security info=False;packet size=4096;");
        c.Open();
        SqlCommand myCommand = new SqlCommand();
        myCommand.Connection = c;
        myCommand.CommandType = CommandType.Text;
        myCommand.CommandText = "select * from SY01200 ";
        SqlDataReader myDataReader = myCommand.ExecuteReader();
        Console.WriteLine("F:" + myDataReader.FieldCount);
        while (myDataReader.Read())
        {
            Console.WriteLine("code: " + myDataReader["ADRSCODE"]);
            Console.WriteLine("master: " + myDataReader["Master_ID"]);
            Console.WriteLine("TO: "+ myDataReader["EmailToAddress"]);
        }
        Console.ReadKey();

    }

Is there? I am getting empty strings from "Master_ID" and "EmailToAddress" and some data from "ADRSCODE", but nothing useful.

Thanks in advance for any direction.

vt100
  • 923
  • 1
  • 11
  • 21

1 Answers1

1

The e-mail address for a debtor (customer) is located in the INET1 field in the SY01200 table.

You could use this query to get the email addresses for every customer:

SELECT Master_ID AS CustomerNumber,
       INET1     AS EmailAddress
FROM   SY01200
WHERE  Master_Type = 'CUS'
Bryan Prince
  • 516
  • 2
  • 7
  • Thanks Bryan, but I am getting empty strings when I run `SELECT INET1 FROM SY01200`. This table seems to be missing debtors I entered. I am not getting expected IDs from: `SELECT Master_ID from SY01200` query as well. – vt100 Jun 18 '13 at 08:49
  • I believe that the table is only populated once an e-mail address has been added. Also I think it depends on which version of GP you are using. GP 10 used the INET1 column. I just tested in GP 2013 and it uses the EmailToAddress column. – Bryan Prince Jun 18 '13 at 13:10
  • To confirm, click the Internet Addresses icon in the customer maintenance window. (It looks like a globe). Add an email address and then check the SY01200 table. – Bryan Prince Jun 18 '13 at 13:11
  • Thanks. Seems that in GP 2010 the case is different. There is no icon and you add by pressing 'options' button. Also, i executed full search trough the entire database for email address I have entered and I found it in **RM00106** table. Thanks again for your help! Now I know that I must make a case statements for different versions of GP. Good luck! :) – vt100 Jun 19 '13 at 10:35