SAP Database - The Unofficial SAP Knowledge Base

Free Business and Tech Magazines and eBooks

ABAP Programs :Using Field Symbols for variable parts of fields

Print This Post Email This Post Written by admin on Jan 28th, 2008 | Filed under: ABAP Programs

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 POSITION.
ASSIGN EXTERNAL_RECORD+POSITION(LENGTH) TO < ENTRY>.
WRITE < ENTRY>.
ADD LENGTH TO POSITION.
IF POSITION >= 4000.
EXIT.
ENDIF.
ENDDO.

If you like this post, you may as well like these too:

  1. 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 TO...
  2. 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....
  3. ABAP Programs: Using system fields REPORT ZSOURCE0409. WRITE: / ‘Current date’, SY-DATUM, / ‘Current table index’, SY-TABIX, / ‘Loop counter’, SY-INDEX, / ‘System return code’, SY-SUBRC.———————ABAPer, mail: abap.community@gmail.com http://abaplearner.blogspot.com ...
  4. ABAP Programs: Copying fields REPORT ZSOURCE0701. * move fieldsDATA: NAME(25), COUNTER TYPE I.DATA: SOURCE LIKE NAME, TARGET LIKE SOURCE.MOVE: ‘Edison’ TO NAME, 17 TO COUNTER.MOVE SOURCE TO TARGET.* Using the compute command (keyword can...
  5. ABAP Programs: Using Symbols and Icons REPORT ZSOURCE0806. * Declaring symbols and iconsINCLUDE: , . * Displaying symbols and iconsWRITE: / SYM_PHONE AS SYMBOL, ‘telephone’, / SYM_FAX AS SYMBOL, ‘fax machine’, / SYM_LEFT_HAND AS SYMBOL, ‘hand...



This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

Leave a Reply

  • Subscribe to RSS

  • Free Ebooks