1
votes

I have defined local variables in a program line in SMARTFORMS but it seems that even it is locally declared within the program line node, it does not see the variables.

Error shown below.

Field "L_TABDEF–TLTYPE" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement. "DATA" state

FIELD-SYMBOLS: <f_tab> TYPE tsftabdef.

DATA: l_tabdef  TYPE  ssftabdef ,    " Work Area for the Table
      t_ltypes  TYPE tsfltype   ,   " Table – Line types
      l_ltypes  TYPE ssfltype   ,     " Work Area for the table
      t_colinfo TYPE tsfcolinfo ,    " Table – Columns
      l_colinfo TYPE ssfcolinfo ,   " Work area for the table
      t_border  TYPE tsfctaba   ,  " Tables – Borders
      l_border  TYPE ssfctaba   .   " Work Area for the border

ASSIGN ('(SAPLSTXBC)TABDEFS') TO <f_tab>.

* Table definition table
LOOP AT <f_tab> INTO l_tabdef.
  LOOP AT l_tabdef–tltype INTO l_ltypes WHERE linetype = 'LINE'.
    LOOP AT l_ltypes–tcolinfo INTO l_colinfo.
      LOOP AT l_colinfo-borders INTO l_border.
        CLEAR l_border-intensity.
        l_border-fillcolor-red = '255'.
        l_border-fillcolor-green = '000'.
        l_border-fillcolor-blue = '000'.
        l_border-fillcolor-used = 'X'.

        l_border-cfillcolor-color  = 'X'.
        l_border-cfillcolor-xred = 'FF'.
        l_border-cfillcolor-xgreen = '00'.
        l_border-cfillcolor-xblue = '00'.

        MODIFY l_colinfo-borders FROM l_border.
      ENDLOOP.
      MODIFY l_ltypes-tcolinfo FROM l_colinfo.
    ENDLOOP.
    MODIFY l_tabdef-tltype FROM l_ltypes.
  ENDLOOP.
  MODIFY <f_tab> FROM l_tabdef.
ENDLOOP.

What am I missing here?

1
This is some weird kind of access. You have seen "For internal use only, the name in name can also have the form "(PROG)DOBJ"", I assume? "For internal use" is SAP slang for "Poisonous stuff! Don't touch!" ;-) Not sure whether the condition "If the program "PROG" is loaded into the same internal session as the current program" can be relied on here. And even if, breaking sideways through several walls to modify a global variable of another program is surely no clean design. - Florian

1 Answers

2
votes

In l_tabdef–tltype, you are confused by the dash character which is in fact the invalid Unicode character EN DASH U+2013, so it's not recognized as the "structure component selector" (i.e. the dash character U+002D) and the compiler considers the whole name as referring to a classic data object, not a structure component.

Probably the error originates from a copy/paste from your favorite Text Processing software.

Solution: please retype "-" in l_tabdef–tltype.

PS: thank you for having provided this Minimal, Complete, and Verifiable example otherwise it would have been impossible to troubleshoot the issue!