SAP ABAP Data Element TB_MACRNAME (Market data: Macro name)
Hierarchy
SAP_APPL (Software Component) Logistics and Accounting
   TR (Application Component) Treasury
     FTDF (Package) Treasury: Datafeed TR-TM-TM-TO-DF
Basic Data
Data Element TB_MACRNAME
Short Description Market data: Macro name  
Data Type
Category of Dictionary Type D   Domain
Type of Object Referenced     No Information
Domain / Name of Reference Type SYCHAR30    
Data Type CHAR   Character String 
Length 30    
Decimal Places 0    
Output Length 30    
Value Table      
Further Characteristics
Search Help: Name    
Search Help: Parameters    
Parameter ID   
Default Component name    
Change document    
No Input History    
Basic direction is set to LTR    
No BIDI Filtering    
Field Label
  Length  Field Label  
Short 10 Macro name 
Medium 10 Macro name 
Long 10 Macro name 
Heading 10 Macro Name 
Documentation

Definition

Specify the macros that are called up to transfer the table information in the work file of your spreadsheet. The first macro is used to transfer data back to the SAP system (table MARKETDATA_TO_R3). The second macro fetches the data from the SAP system (table headers from table MARKETDATA_HEADER, market data from table MARKETDATA_FROM_R3).

Further notes

SAP delivers an Excel template with the relevant macros. Only change the standard macro names if you are creating your own template with your own macros and wish to use your own macro names.

Example

Here are some sample macros (the Excel Visual Basic macros are defined in English, changes should only be carried out by the system administrator) that are delivered with the SAP templates.

Enter the:

  • 1.Macro name: TablebackToR3
  • 2.Macro name: FillTableFromR3

The VB macros for Excel 97 are, for example, as follows:

Public Function TableBackToR3()

Dim R3Table As Object

Dim Row As Object

Dim Range As Range

Rem This is the table which is passed back to the system

If ThisWorkbook.Container.Tables("MARKETDATA_TO_R3").Tables Is

Nothing Then

Else

Set R3Table = ThisWorkbook.Container.Tables("MARKETDATA_TO_R3").Tables ("MARKETDATA_TO_R3").Table

Rem Count the number of active rows in the Excel sheet

Rem restriction is 1000 instruments per call

Rem Coding works only if all rows in the Excel sheet are without gaps

NumRows = 0

MaxnumRows = 1001

Rem Number of Columns in the Table "MARKETDATA_TO_R3", please refer to the SAP Documentation

For Each z In ThisWorkbook.Sheets(1).Range(ThisWorkbook.Sheets(1). Cells(1, 1), ThisWorkbook.Sheets(1).Cells(MaxnumRows, 1))

If z.Value <> "" Then

NumRows = NumRows + 1

End If

Next z

Rem Set the Range: the first line is the header, therefore we start at (2, 1)

Rem Set the Range: the last line is the first line with an empty value field in (numRows, 1)

If NumRows > 1 Then

Set Range = ThisWorkbook.Sheets(1).Range(ThisWorkbook.Sheets(1).Cells (2, 1), ThisWorkbook.Sheets(1).Cells(NumRows, MaxnumColumns))

Rem the R/3 Table is empty after this statement

R3Table.Rows.RemoveAll

Rem Fill the R/3 table with the values

For i = 1 To Range.Rows.Count

Set Row = R3Table.Rows.Add

For j = 1 To Range.Columns.Count

Row.Cell(j) = Range.Cells(i, j).Value

Next j

Next i

End If

End If

End Function

Public Function FillTableFromR3()

Dim R3Table As Object

Dim R3TableHeader As Object

Dim Row As Object

Dim ExcelRange As Excel.Range

Dim ExcelRangeHeader As Excel.Range

Rem Number of Columns in the Table "MARKETDATA_FROM_R3", please refer

to SAP Documentation

MaxnumColumns = 13

Rem This is the header table which is received from the system

If ThisWorkbook.Container.Tables("MARKETDATA_HEADER").Table is Nothing

Then

Else

Set R3TableHeader =

ThisWorkbook.Container.Tables("MARKETDATA_HEADER").TABLE

Set ExcelRangeHeader =

ThisWorkbook.Sheets(1).Range(ThisWorkbook.Sheets(1).

Cells(1, 1), ThisWorkbook.Sheets(1).Cells(1, MaxnumColumns))

ExcelRangeHeader.Value = R3TableHeader.Data

End If

Rem This is the table which is received from the system

If ThisWorkbook.Container.Tables("MARKETDATA_FROM_R3").Table Is

Nothing Then

Else

Set R3Table = ThisWorkbook.Container.Tables("MARKETDATA_FROM_R3").Table

Rem Count the number of active rows in the Excel sheet

Rem restriction is 1000 instruments per call

Rem Coding works only if all rows in the Excel sheet are without gaps

NumRows = 0

MaxnumRows = 1001

NumRows = R3Table.Rows.Count + 1

Rem Set the Range: the first line is the header, therefore we start at (2, 1)

Rem Set the Range: the last line is the first line with an empty value field in (NumRows, 1)

If NumRows > 1

Set ExcelRange = ThisWorkbook.Sheets(1).Range(ThisWorkbook.Sheets(1). Cells(2, 1), ThisWorkbook.Sheets(1).Cells(NumRows, MaxnumColumns))

Rem Fill the Cells from the table

ExcelRange.Value = R3Table.Data

End If

End Function

History
Last changed by/on SAP  19990317 
SAP Release Created in