Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

COM4ABAP and Visual Basic Forms

Former Member
0 Likes
615

Hello everyone,

I have a COM object with a function that shows a simple visual basic form:

***

Public Function TestForm()

Form1.Show

End Function

***

When I call it using a test visual basic program it works fine of course:

***

Dim myCOM As New COMClass

myCOM.TestForm

***

But when I call it in ABAP using COM4ABAP it fails.

***

CALL FUNCTION 'com_invoke' DESTINATION worker_dest

EXPORTING

%instid = instid

%method = 'TestForm'

EXCEPTIONS

com4abap_invoke_failure = 1.

IF sy-subrc = 1.

-fails here-

ENDIF.

***

I can successfully call COM functions using COM4ABAP for many things but can't seem to pull up a simple VB form. Anyone have any ideas why?

Thanks for your time.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
589

One thing to check would be the permissions of the COM object via DCOM Config (Start-RUN-DCOMCNFG). The other thing to check would be whether the object has been set to run under the interactive user. When some processes kick off a COM object, the UI bits might not be displayed if the user that is executing the task (in your case i'm guessing it's the user the SAP server is running under) is not intereactive.

This brings up an interesting question. Where do you want the form displayed and where is the ABAP being executed? If the ABAP is executed server-side then the VB form (if configured correctly) would display server-side too. Is this what you are after?

3 REPLIES 3
Read only

Former Member
0 Likes
590

One thing to check would be the permissions of the COM object via DCOM Config (Start-RUN-DCOMCNFG). The other thing to check would be whether the object has been set to run under the interactive user. When some processes kick off a COM object, the UI bits might not be displayed if the user that is executing the task (in your case i'm guessing it's the user the SAP server is running under) is not intereactive.

This brings up an interesting question. Where do you want the form displayed and where is the ABAP being executed? If the ABAP is executed server-side then the VB form (if configured correctly) would display server-side too. Is this what you are after?

Read only

0 Likes
589

Charles, thanks for taking the time to respond.

I need the form to be displayed for interactive users from their SAP screen on their local workstations. So basically they press a button and the form pops up.

This is the first time I've used the DCOM config. From what I understood in your reply, I need to set the COM object's Identity property to the interactive user.

I was able to locate my COM object thru the COM class id and its identity property was already set to the interactive user (other options were launching user and specific user). So I'm still stuck. Unless I misunderstood your repy?

Read only

0 Likes
589

Ahmad,

I'm not too sure how you will get this to work. In my limited knowledge of ABAP, I'm guessing that the ABAP is sent to a server and executed from there. This means that the ABAP that instantiates the COM object will be instantiating the COM object on the server. I'm not sure how you could redirect it to the client that sent or executed the ABAP. I don't think this is even possible. Is there any way in ABAP to execute an external application on the client's machine? This might be a way of achieving what you want. This is of course unless COM4ABAP does initiate the COM on the client in which case most of this post is useless and you'll have to forgive me. Just thought i'd let you know my thoughts in anycase.