03-10-2009 8:33 AM
Hi All,
I want to download the structure of the table in the excel sheet. Is there any menu path, transaction or program for the same?
Thanks in advance for your help.
Regards,
Anuja.
03-10-2009 8:46 AM
Hi
Use the Function Module :DDIF_FIELDINFO_GET and specify the table for which you required the strucrure,it will gives the structure of that table inclusing fields,data elements and domains etc.
Regards,
Sreeram Kumar.Madisetty
03-10-2009 8:35 AM
you have to manually copy the structure..you cannot directly get the structure...
03-10-2009 8:36 AM
May be you can use the FM: DB02_GET_TABLE_STRUCTURE_DB2
Regards
Satya
03-10-2009 8:36 AM
hi use this ..
Use function module DDIF_FIELDINFO_GET. That will give you all the fields for a given table...capture it into an internal table and download it to the excel..
05-08-2020 10:21 AM
03-10-2009 8:37 AM
Hi,
U can use RFC_READ_TABLE
[https://www.sdn.sap.com/irj/sdn?rid=/library/uuid/f50dcd4e-0501-0010-3596-b686a7b51492]
03-10-2009 8:39 AM
HI,
There are many ways of achieving this, u can use the following FM : RPY_TABLE_READ and download in excel file using any FM or SE11--> DD3T table and display u r table and download in excel file.
Or SE11--> Table name --> Display and then go to TABLE Menu - and click on PRINT, then view the entries in Print preview of the sap script form ,
next go to GOTO menu and click in list display........
next go to menu SYSTEM->LIST-> SAVE->LOCAL FILE.
Thanks & Regards,
Rock.
03-10-2009 8:46 AM
Hi
Use the Function Module :DDIF_FIELDINFO_GET and specify the table for which you required the strucrure,it will gives the structure of that table inclusing fields,data elements and domains etc.
Regards,
Sreeram Kumar.Madisetty
06-29-2015 7:13 AM
Hi Anuja,
Good evening.
Following are the steps to get the structure to an excel file using VBScript:
a. Define all the variables that are needed for this script.
- and one of the main variable is 'Long Index Variable' that you can define as follows:
Dim lngIdx 'Needed to loop thru SAP table structure & retrieve table column field names.
&
Dim ExcelApp 'Excel App
Dim ExcelWorkbook 'Excel workbook
Dim ExcelSheet 'Excel worksheet
b. Instantiate the structures and functions for SAP access - which are:
Set objFileSystemObject = CreateObject("Scripting.FileSystemObject") 'Instantiation of filesystem object
Set ctlLogon = CreateObject("SAP.LogonControl.1") 'Instantiation of SAP Logon Control Object
Set funcControl = CreateObject("SAP.Functions") 'Instantiation of SAP Functions - NOTE SAP should be installed
Set ctlTableFactory = CreateObject("SAP.TableFactory.1") 'Setting & instantiation of SAP Table Factory
Set RFC_READ_TABLE = funcControl.Add("RFC_READ_TABLE") 'Function control for RFC READ TABLE, following 4 are needed in that sequence
Set strExport1 = RFC_READ_TABLE.Exports("QUERY_TABLE") 'SAP Query Table instantiation
Set strExport2 = RFC_READ_TABLE.Exports("DELIMITER") 'Delimiter as needed, and part of RFC READ TABLE in SAP
Set tblOptions = RFC_READ_TABLE.Tables("OPTIONS") 'This is for writing the actual SQL Query
Set tblData = RFC_READ_TABLE.Tables("DATA") 'Please refer to actual RFC READ TABLE FM (SE37) shown above
Set tblFields = RFC_READ_TABLE.Tables("FIELDS")
Set tblStructure = funcControl.CreateStructure(sapTables(m)) 'Where sapTables(m) is the array containing the list of tables for which you want to retrieve the structure.
c. Following is the function that you need to retrieve the table structure along with their positions
that SE16 shows you OR ZSE16 shows you.
For lngIdx = 1 To tblStructure.ColumnCount 'Loop thru entire table structure and get the table column field names. This is ideal.
if tblStructure.ColumnCount > 10 Then
actCounter = 10 'This is needed since RFC_READ_TABLE which the main function that i use has an output field that is TAB512 - implying the total length of output cannot be > 512 bytes.
else
actCounter = tblStructure.ColumnCount
End if
For lngIdx = 1 to actCounter
'.ColumnName contains field name
'.ColumnLength contains field length
'.ColumnOffset contains field offset
tblFields.AppendRow
tblFields(tblFields.RowCount, "FIELDNAME") = tblStructure.ColumnName(lngIdx)
ExcelSheet.Cells(row, n).Value = tblStructure.ColumnName(lngIdx) '10 fields from the input table will be copied over along with their domain, size, offset and length.
' If tblStructure.ColumnOffset(lngIdx) + tblStructure.ColumnLength(lngIdx) > 1024 Then Exit For
'WshShell.Popup tblFields(tblFields.RowCount, "FIELDNAME") & " column retrieved", 1, "Progress" ' show message box with table fieldname for a second & disappears.
Next
'---- not including full code.here.
Additional FYI - i am currently researching on using the following functions that will help to
increase the size of the output buffer, so that i can extract entire tables and not be limited to
512 bytes:
a. RPY_TABLE_READ OR
b. BBP_RFC_READ_TABLE
Hope it helps. Let me know if you need any more help?.
Thanks
Ram.S