Using Dynamic Structures for a Table 
Some SAP BAPI function modules (Business API) use generic table parameters and return the actual structure of the data table in a second table. The Table object is capable of using another interpretation of its contents by simply changing its column structure. The actual column structure is restricted to the row length of the dummy table. The following code demonstrates how you can achieve this:
Dim oFuncOCX as Object
Dim oFunc as Object
Dim oFieldTab as Object
Dim oDataTab as Object
Dim colObj as Object
Dim k as Long
Rem Create a Function control
Set oFuncOCX = CreateObject (
" SAP.Functions " )Rem Add a BAPI to the Functions collection
Set oFunc = oFuncOCX.Add ("MC_RFC_BAPI_OIWID")
if not oFunc.Call then stop end if ‘ if error stop
Rem Access the table parameter
Set oFieldTab = oFunc.Tables("FIELDS")
Set oDataTab = oFunc.Tables("DATA")
Rem Clear the old column structure
For k = oDataTab.columnCount To 1 Step -1
oDataTab.Columns.Remove k
Next
Rem Imprint the new structure
For k = 1 To oFieldTab.RowCount
Set colObj = oDataTab.Columns.Add
colObj.intlength = Val(oFieldTab.cell(k, 3))
If InStr("FNPI", oFieldTab.cell(k, "type")) > 0 Then
colObj.type = 7
else
colObj.type = 0
End If
Next