Interview Questions

What is Field sysmbol ?

SAP ABAP questions and answers


(Continued from previous question...)

What is Field sysmbol ?

Answer1:
You can use field symbols to make the program more dynamic. In this exanmple the name of a table control is substituted by a field symbol. Thus you cal call the form with any internal table, using the name of the tablæe control as a parameter.

Example
form insert_row
using p_tc_name.

field-symbols <tc> type cxtab_control. "Table control

assign (p_tc_name) to <tc>.

* insert 100 lines in table control
<tc>-lines = 100.

Answer2:
fieldsymbol has the same concept as pointer in c,
fieldsymbol don't point to a data type like char, num instead of that it points to the memory block. the syntax for fieldsymbol is
FIELD-SYMBOL <N>.
EG. FOR FIELD SYMBOL.
DATA: DAT LIKE SY-DATUM,
TIM LIKE SY-UZEIT,
CHAR(3) TYPE C VALUE 'ADF'.
FIELD-SYMBOL : <FS>.
MOVE DAT TO <FS>.
WRITE:/ <FS>.
MOVE TIM TO <FS>.
WRITE:/ <FS>.
MOVE CHAR TO <FS>.
WRITE:/ <FS>.
The output will be
Today's date
current time

(Continued on next question...)

Other Interview Questions