sap interface, how to learn sap, sap connection, process sap, sap process, sap application integration

Create Structure 2

SAP Interfacing with VBA. In this blog you will get some informations about :
Best Information For Create Structure 2 | Create Structure 2 Articles

Same as CreateStructure method, Structure can be created by the NewStructure method of TableFactory control. This utilize the ActiveX module in ...SAP/FrontEnd/Controls/WDTAOCX.OCX.


(A) Compare to CreateStructure command, it requires few more steps.
If you explicitly allocate the structure to as parameter of function module, you may be able to use this. But except for this kind of special situation, do with CreateStructure will be good enough.
Sub TempStructure2()

Dim sapConn As Object 'Declare variant
Set sapConn = CreateObject("SAP.Functions") 'Create ActiveX object

If sapConn.Connection.Logon(0, False) <> True Then 'Try Logon
MsgBox "Logged on to SAP - " & sapConn.Connection.Destination
Exit Sub
End If

Dim objTableFactory As Object
Set objTableFactory = CreateObject("Sap.TableFactory.1")

'Define objEdidc with SAP EDIDC structure and name it as IDOC_CONTROL
Dim objEdidc As Object
Dim lngTmp As Long
Set objEdidc = objTableFactory.NewStructure
lngTmp = objEdidc.CreateFromR3Repository(sapConn.Connection, "EDIDC", "IDOC_CONTROL")

Dim lngIdx As Long
objEdidc("DOCNR") = "1"
Debug.Print ""
For lngIdx = 1 To objEdidc.ColumnCount
Debug.Print objEdidc.ColumnName(lngIdx) & " = " & _
objEdidc(objEdidc.ColumnName(lngIdx)) & ", " & _
objEdidc.ColumnLength(lngIdx)
Next

End Sub


(B) Properties for Structure object
Unlike the Structure created by CreateStructure method, some fields are visible but not all.
ColumnCount Number of columns.
ColumnDecimals(n) Number of decimals for this item (n).
ColumnLength(n) Number of byte length for this item (n).
ColumnName(n) Name for this item (n).
ColumnOffset(n) Distance from the structure start to this element (n).
ColumnSAPType(n) SAP Type number for this item (n).
Name Name of structure.
StructureHandle Structure handle.
Type Structure type.
Value (n or str). Value for this item (n or str).
Width Byte length of the structure.

(C) Methods for Structure object
Clear Initialize values set in the structure fields.
CreateFromR3Repository Create Structure as specified in the parameters.
IsStructure Return true if the object is Structure.

We have been providing the best information about Create Structure 2 For you. If you liked this information, please tell your friends on Facebook, Twitter or Google plus using social buttons below.. ^_^. SAP Interfacing with VBA
Create Structure 2 Rating: 4.5 by: Abdul Rahman Nasution

0 comments:

Post a Comment