Skip to Content

Getting an specific UDO Column/field from a CFL returned DocEntry.

Hi,

I have an EditText with a CFL over an UDO. In the ItemEvent pval variable I am receiving the UDO DocEntry key. It is working fine.

I need to get an specific column/field, What is the best way to get it?

I am thinking about doing thisu2026

SAPbouiCOM.DataTable oDataTable = null; 
oDataTable = oCFLEvento.SelectedObjects; // CFLResults

string val = null;
val = System.Convert.ToString(oDataTable.GetValue(0, 0));

//  U_MyCol has the value that I am looking for
string SQuery = @"SELECT U_MyCol FROM [@UDOTABLE] WHERE DocEtry='"+val+@"'"
SqlCommand cmd = new SqlCommand(SQuery, conn);
reader = cmd.ExecuteReader();
reader.Read();
string MyColValue = reader[0].ToString();

Is there a better way using some SAP tool?

Thanks

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2009 at 04:07 AM

    Hi Mario,

    I guess you have used more of .NET concepts in your code than the SBO ones. Still I dint exactly get your point. Is it something like you need to place the value in a particular field? or what exactly do you want to perform in your column/edit text?

    Few basic reminders I can help you with are,

    1. Always bind the columns / fields using either DBDataSource or UserDataSource.

    2. You can use UDO's only for Master and Document type tables.

    3. In your case, you can directly achieve the execute Reader functionality using,

    oRecSet.DoQuery(strQuery);

    Let me know what exactly you need to perform and I will let you know what you are missing or what you got to do.

    Best Regards,

    Satish. B.

    Add a comment
    10|10000 characters needed characters exceeded

    • Satish,

      First of all, there is an error in my first post, it should say u201CCodeu201D instead DocEntry. When a user select a value in a CFL(Choose From List) associated to a UDO SAP gives you back the field u201CCodeu201D.

      What I am trying to accomplish is to transform the UDO Code that I get from a CFL to a specific column, this is done by performing a simple query.

      My question perhaps should be, ¿What is the SAP recommended way to perform a simple query in a UIAPI AddOn?

      Thanks

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.