SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

Dynamic Programming using Field Symbols in ABAP Reports

Field symbols in ABAP reports and programming ABAP using field symbols provides flexibity to ABAP developers. A field symbol in ABAP can be considered as pointers in C programming language.

In this ABAP tutorial, ABAP developers will find a dynamic ABAP programming example using field symbols





The below field symbol sample ABAP report can be considered as a dynamic ABAP programming sample. The field value printed on the screen is determined dynamically by using the input parameter on the selection screen. After the user input is read, the field name is build dynamically with ABAP Concatenate command. Then this text field is evaluated and assigned to field symbol <fs>. Later this field symbol value is printed on the screen using ABAP Write command.

REPORT Z_FIELDSYMBOL.

DATA :
 ls_glt0 type glt0,
 lv_txt(20).

FIELD-SYMBOLS <fs>.

PARAMETERS :
 p_bukrs TYPE bukrs OBLIGATORY DEFAULT 'TR11',
 p_period TYPE monat OBLIGATORY DEFAULT '11'.

START-OF-SELECTION.

SELECT SINGLE * FROM GLT0 into ls_glt0 WHERE bukrs = p_bukrs.

CONCATENATE 'ls_glt0-TSL' p_period INTO lv_txt.

* Assign text as field
ASSIGN (lv_txt) to <fs>.
*ASSIGN ls_glt0-tsl01 to <fs>.

WRITE <fs>.

END-OF-SELECTION.
Code


SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.