ABAP Programs:Using Field Symbols for components of a structure
REPORT ZSOURCE2403.
* Table work area for later use
TABLES CUSTOMERS.
* Defining a Field Symbol
FIELD-SYMBOLS <OUTPUT>.
* Displaying all fields of all table entries
SELECT * FROM CUSTOMERS.
NEW-LINE.
DO.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE CUSTOMERS TO < OUTPUT>.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
WRITE < OUTPUT>.
ENDDO.
ENDSELECT.
If you like this post, you may as well like these too:
- ABAP Programs :Using Field Symbols for variable parts of fields REPORT ZSOURCE2402. DATA: EXTERNAL_RECORD(4000), POSITION TYPE I, LENGTH TYPE N. FIELD-SYMBOLS < ENTRY>. EXTERNAL_RECORD = ‘0005Smith0007Edwards0005Young’. DO. LENGTH = EXTERNAL_RECORD+POSITION(4). IF LENGTH = 0. EXIT. ENDIF. ADD 4 TO...
- ABAP Programs: Working with Field symbols REPORT CHAP2401. * Defining a Field Symbol FIELD-SYMBOLS < FS>. * Variable for later use DATA FIELD VALUE 'X'. * Assigning a field to a Field Symbol ASSIGN FIELD...
- ABAP Program : Working with Temporary Programs Ever had a need to create a temporary program during the run time. Here is a simple program which will allow you to learn that. REPORT ZSOURCE2501. * Internal...
- ABAP Programs: Simple examples of field conversion REPORT ZSOURCE0702. * Converting to numbers during computationsDATA: NUMBER_1(4) VALUE ‘1771′, NUMBER_2(3), RESULT TYPE I. NUMBER_2 = ‘005′.RESULT = NUMBER_1 + NUMBER_2.WRITE / RESULT. NUMBER_2 = ‘ 5′.RESULT =...
- ABAP Programs: Internal flow of control (if, case, do, while) REPORT ZSOURCE0902. * Declarations for later useTABLES CUSTOMERS.DATA: COLOR(10) VALUE ‘yellow’, N(4) TYPE N VALUE ‘123′, P TYPE P, C4(4) VALUE ‘124′, C5(5) VALUE ‘00124′, SQUARE_NUMBER TYPE I, X...

















Leave a Reply