Skip to Content
author's profile photo Former Member
Former Member

Error:Unable to cast COM object of type 'System._ComObject' to interface type 'SAPboui.StaticText

Hello everyone,

I am having an issue that tearing me appart, The code where it is blowing is so simple and I'm following as a guide the refUI SDK but I can't understand why this would blow

if (itm.Type == SAPbouiCOM.BoFormItemTypes.it_STATIC)

{

SAPbouiCOM.StaticText miStaticText;

miStaticText = (SAPbouiCOM.StaticText)itm;

cValue = miStaticText.Caption;

}

Can You help me with this issue error 1 says: Unable to cast COM object of type 'System._ComObject' to interface type 'SAPbouiCOM.StaticText'....

Error2 says: System call failed. RPC_E_SYS_CALL_FAILED.

Both errors are attached in a screen shot. Please help me as this issue is so huge as an impact.

Thanks to you in advance.

Mamadou

SAPB1Error.png (60.3 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on May 24, 2013 at 06:47 AM

    Hi Bah,

    I think you are missing the .Specific property.

    if (itm.Type == SAPbouiCOM.BoFormItemTypes.it_STATIC)

    {

    SAPbouiCOM.StaticText miStaticText;

    miStaticText = (SAPbouiCOM.StaticText)itm.Specific;

    cValue = miStaticText.Caption;

    }

    Good luck.


    Best regards,

    Pedro Magueija


    View Pedro Magueija's profile on LinkedIn

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 24, 2013 at 01:13 AM

    Hi,

    What are you trying to do here? Create static and edit text in existing form or from custom form?

    Regards,

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks Bryan,

      What I'm trying to do is to get field's value from HR Employee Master Data window, I get the value sometimes but it still blow this error. For instance I need the employee number which has a unique ID of 33 but sometimes different values comes like 4 or 14 and this specifically happpen when I use the Employee Master Data after using an AP window to similar things. It is a very weird issue. Let me know if this makes sense or not.

      Again thank you for your reply and contribution.

      Mamadou

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.