Hello Harjyot,
> first method is not returning any value and second method returning retailer ID but it should return terminal ID
I tested the code in ABAP and it delivers a different result in comparison with the equal VBScript code. Also I get the same result as you.
Please download Pointer for COM from here and try the following code.
"-Begin-----------------------------------------------------
Program zPointOfSale.
"-Type Pools--------------------------------------------
Type-Pools OLE2.
"-Variables---------------------------------------------
Data DX Type OLE2_OBJECT.
Data Ptr Type OLE2_OBJECT.
Data TerminalID Type String Value ''.
Data ptrTerminalID Type i Value 0.
Data RetailerID Type String Value ''.
Data ptrRetailerID Type i Value 0.
Data ret Type i Value 0.
"-Main--------------------------------------------------
Create Object DX 'DynamicWrapperX'.
If sy-subrc = 0 And DX-Handle <> 0 And
DX-Type = 'OLE2'.
Call Method Of DX 'Register'
Exporting
#1 = 'C:\Dummy\POS.dll'
#2 = 'API_GETTERMINALPARAMS'
#3 = 'i=uu' #4 = 'r=l'.
If sy-subrc = 0.
Create Object Ptr 'P4Com'.
If sy-subrc = 0 And Ptr-Handle <> 0 And
Ptr-Type = 'OLE2'.
Call Method Of Ptr 'CreateVar' = ptrRetailerID
Exporting #1 = 'RetailerID' #2 = 'String' #3 = 9.
Call Method Of Ptr 'CreateVar' = ptrTerminalID
Exporting #1 = 'TerminalID' #2 = 'String' #3 = 17.
Call Method Of DX 'API_GETTERMINALPARAMS' = ret
Exporting #1 = ptrRetailerID #2 = ptrTerminalID.
Call Method Of DX 'StrGet' = TerminalID
Exporting #1 = ptrTerminalID #2 = 's'.
Call Method Of DX 'StrGet' = RetailerID
Exporting #1 = ptrRetailerID #2 = 's'.
Call Method Of Ptr 'DestroyVar'
Exporting #1 = 'RetailerID'.
Call Method Of Ptr 'DestroyVar'
Exporting #1 = 'TerminalID'.
EndIf.
EndIf.
Write: / ret.
Write: / TerminalID.
Write: / RetailerID.
Free Object Ptr.
Free Object DX.
EndIf.
"-End-------------------------------------------------------
Important hint: I twist the sequence of the API_GETTERMINALPARAMS arguments, because it is Pascal calling convention.
As far as I can say seems DynamicWrapperX pointer functions not work 100% correct in the context of the SAP GUI for Windows. If you use Pointer for COM (P4Com) with DynamicWrapperX in the context of SAP GUI for Windows, all works well.
I think api_TriggerTrxTrack2 use also pointer to strings, so you can use the same way as I described above.
Let us know the results.
Cheers
Stefan