Question:
Hello All,
How can I call a COM DLL (Running from Windows) from an ABAP Program.
Regards
TandT
Answer:
Hello,
You will need to install SAP DCom Connector (downloadable
from SAP Service Market). With SAP DCom CC, you will
have SAP COM4ABAP Service which will serve your need.
There is detailed instructions within SAP DCom CC Doc.
The basic steps are :
1. Import into your R/3 the transport files found
at C:\Program Files\SAPPC\SAPGUI\RFCSDK\COM4ABAP,
if your R/3 is below Basis 4.6D. This import creates
COM4ABAP related function modules :
BEGIN_COM_SESSION
END_COM_SESSION
2. Use TypeMapper to load the target COM obj and
config the data fields mappings between the COM
interface and ABAP interface.
Generally, you map data field types as below
VT_BSTR --> RFC_CHAR
VT_I4 --> RFC_INT (4)
VT_I2 --> RFC_INT2 (2)
VT_DATE --> RFC_DATE (
VT_DISPATCH (ADO recordset) --> RFC_ITAB (ABAP int table)
etc...
If among your COM method arguments, there are
ADO recordsets, you will need to do further
mappings for each field of the recordset.
Save the mappings in a XML file.
Everytime you rebuid your COM obj, you need to
perform this mapping again to keep the COM UUID
updated in the XML file.
3. Start COM4ABAP Service and enter
Program ID = (Any unique ID)
Host = (SAP R/3 App Host IP)
Service = (generally sapgw00)
COM Class = (Target COM Class ID)
Type Lib in XML = (The mapping file name without
.XML extention)
Type Repository Path = (Full path of mapping file)
Now the COM4ABAP service is registered to your R/3
App server.
4. With Tcode SM59, maintain a Type T RFC
destination with Register Type & Program ID
as the one you input in step #3. Test connection
to make sure ...
5. Refer to the sample ABAP code in DCom CC
doc. You should be able to invoke COM method
within ABAP now.
HTH...
- YJChen
Answer:
Hello YJChen,
Thanks for your inputs.
Regards
TandT
Hello,
You will need to install SAP DCom Connector (downloadable
from SAP Service Market). With SAP DCom CC, you will
have SAP COM4ABAP Service which will serve your need.
There is detailed instructions within SAP DCom CC Doc.
The basic steps are :
1. Import into your R/3 the transport files found
at C:\Program Files\SAPPC\SAPGUI\RFCSDK\COM4ABAP,
if your R/3 is below Basis 4.6D. This import creates
COM4ABAP related function modules :
BEGIN_COM_SESSION
END_COM_SESSION
2. Use TypeMapper to load the target COM obj and
config the data fields mappings between the COM
interface and ABAP interface.
Generally, you map data field types as below
VT_BSTR --> RFC_CHAR
VT_I4 --> RFC_INT (4)
VT_I2 --> RFC_INT2 (2)
VT_DATE --> RFC_DATE (
VT_DISPATCH (ADO recordset) --> RFC_ITAB (ABAP int table)
etc...
If among your COM method arguments, there are
ADO recordsets, you will need to do further
mappings for each field of the recordset.
Save the mappings in a XML file.
Everytime you rebuid your COM obj, you need to
perform this mapping again to keep the COM UUID
updated in the XML file.
3. Start COM4ABAP Service and enter
Program ID = (Any unique ID)
Host = (SAP R/3 App Host IP)
Service = (generally sapgw00)
COM Class = (Target COM Class ID)
Type Lib in XML = (The mapping file name without
.XML extention)
Type Repository Path = (Full path of mapping file)
Now the COM4ABAP service is registered to your R/3
App server.
4. With Tcode SM59, maintain a Type T RFC
destination with Register Type & Program ID
as the one you input in step #3. Test connection
to make sure ...
5. Refer to the sample ABAP code in DCom CC
doc. You should be able to invoke COM method
within ABAP now.
HTH...
- YJChen