0% found this document useful (0 votes)
14 views2 pages

Modify With Field Symbols

The document defines a structure and internal table to store employee data. It inputs data for 3 employees, including number, name, salary, and city. It then prints the employee information before and after modifying the salaries of employees located in HYD.

Uploaded by

sksk1911
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

Modify With Field Symbols

The document defines a structure and internal table to store employee data. It inputs data for 3 employees, including number, name, salary, and city. It then prints the employee information before and after modifying the salaries of employees located in HYD.

Uploaded by

sksk1911
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

REPORT zmr_modifytable_fieldsymbol .

* Declaration block
TYPES: BEGIN OF ty_employee,
       number TYPE i,
       name(50) TYPE c,
       sal TYPE p DECIMALS 2,
       city TYPE char20,
       END OF ty_employee.

DATA wa_employee TYPE ty_employee.         " workarea
DATA lt_employee TYPE TABLE OF ty_employee. " internal table

* User input or Processing Block
wa_employee-number = 100.
wa_employee-name = 'Mr.Krishna'.
wa_employee-sal = '55000.50'.
wa_employee-city = 'HYD'.
APPEND wa_employee TO lt_employee.

wa_employee-number = 200.
wa_employee-name = 'Mr.Rama'.
wa_employee-sal = '45000.50'.
wa_employee-city = 'MUM'.
APPEND wa_employee TO lt_employee.

wa_employee-number = 300.
wa_employee-name = 'Mr.Hari'.
wa_employee-sal = '75000.50'.
wa_employee-city = 'HYD'.
APPEND wa_employee TO lt_employee.

WRITE :/40  'Employee INformation' COLOR 6.
* Printing Block
WRITE :/ 'Employee Number',  25 'Employee Name', 40 'Employee Salary', 60 'Cit
y'.
WRITE :/ sy-uline.
LOOP AT lt_employee INTO wa_employee.
  WRITE :/ wa_employee-number LEFT-JUSTIFIED,
  25 wa_employee-name LEFT-JUSTIFIED,
  40 wa_employee-sal LEFT-JUSTIFIED, 60 wa_employee-city.
ENDLOOP.

WRITE:/ sy-uline.
WRITE :/ 'After Modify internal table'.
WRITE :/ sy-uline.

FIELD-SYMBOLS <FS_EMP> TYPE TY_EMPLOYEE.
LOOP AT lt_employee ASSIGNING <FS_EMP>.
  IF <FS_EMP>-city = 'HYD'.
    <FS_EMP>-sal = '10000.00'.
  ENDIF.
  WRITE :/ <FS_EMP>-number LEFT-JUSTIFIED,
  25 <FS_EMP>-name LEFT-JUSTIFIED,
  40 <FS_EMP>-sal LEFT-JUSTIFIED, 60 <FS_EMP>-city.
ENDLOOP.

output:

You might also like