Thursday, July 19, 2012

WRITE statement in ABAP


*&-Code extract to demonstrate the SAP write command-----------*
*&                                                             *
*& Author : www.sapdev.co.uk                                   *
*&  SAP ABAP development                                       *
*&-------------------------------------------------------------*


****************************************************************
*End-OF-selection.
End-OF-selection.


  write:/10(45) 'Total No of Employees entered:', gd_records,  "/10 indents 10 chars
        /10(45) 'Number of Employees processed successfully:', "(45) sets field lenth
                gd_success. "displays variable
  NEW-LINE.  "moves to a new line

  describe table it_error lines gd_lines. "gets number of records in a table
  check gd_lines gt 0.  "check there are some error records

  skip 2. "skips 2 lines
  write:/10 'Unsuccessful Employee records'.  "(10) makes field take up 10 chars
  write:/10 sy-uline(67).   "sy-uline(67) display a line 67 chars long

  write:/10  sy-vline,   "sy-vline creates a vertical line
        (10) 'Employee' COLOR COL_HEADING, sy-vline, "COLOR changes background colour
        (50) 'Description'  COLOR COL_HEADING, sy-vline.

  write:/10 sy-uline(67).     "display a line 67 chars long

  loop at it_error into wa_error.  "loops at err table
    write:/10  sy-vline,      "sy-vline creates a vertical line
          (10) wa_error-pernr, sy-vline,  "(10) makes field take up 10 chars
          (50) wa_error-text, sy-vline.
  endloop.

  write:/10 sy-uline(67). "display a line 67 chars long

No comments:

Post a Comment