cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

pedro_magueija
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Pedro,

Thank you so much, that was the issue, I can't not imagine how I missed that

Mamadou

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

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

Regards,

Former Member
0 Kudos

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