SlideShare a Scribd company logo
ABAP Chapter 2
   Report Statement
   Write & Format Statement
   Flow Control in ABAP
   Manipulating Character Data
   Report Driven : Page Report (List Header)
List Processing



Report Header
Report Listing
   (Body)
Report Statement
Syntax
EPORT < report name >
        [NO STANDARD PAGE HEADING]
        [LINE-SIZE no of columns ]
        [LINE-COUNT no of lines [( no of footer )]].

EPORT ztest1 NO STANDARD PAGE HEADING.
EPORT ztest LINE-SIZE 132 LINE-COUNT 65(2
                             sy-linsz
Text Element : Title&Headers
                                                   Report ztest.
                                                   Write ‘Hello World’.



 Text Element
     Title and Headers
      List Header This is test program by Prapoj
       Column Header
        Column        Column
          #1            #2
Creating Lists
   ABAP statement that create list
       WRITE
       SKIP
       ULINE
   The complete report list will appears
    automatically at the end of the
    processing block
List Buffer

Dialog WP             Local Memory

                        Memory Space
   TaskHandler

   ABAP Processor
                        List Buffer
                                       WRITE,SKI
   Dynpro Processor                     P,ULINE


     DB Interface
WRITE Statement

 Write data
WRITE ‘Hello World’.
WRITE: ‘OK’, ‘Test data’.
WRITE: /15(10) ‘ABCDEFGHIJKLMNOPQ’
WRITE /20 ‘Test data’.
Breaking to a New Line

* Write data
WRITE: / ‘First Line’,      ‘Data 1’,
       / ‘Second Line’, ‘Data 2’,
       /(20) ‘Third Line’, ‘Data 3’,
       /35 ‘Fourth Line’, ‘Data 4’.
            sy-
           colno
Text Symbol


                               Report ztest.
                               Write: Text-001,
                                     Text-002.
 Text Element
   Text Symbols
   Text Symbol     Text

         001        Text 1

         002        Text 2
Text Symbol
        write: / Text-00
        write: / Text-00
        write: / Text-00
        write: / Text-00
        write: / Text-00
Column Position

DATA colno type I value 10.
write: /5 ‘Hello’, at colno ‘World’.
write: at /colno ‘OK’.
Options of the WRITE Statement


* Write Syntax
WRITE var   [NO-ZERO]
            [NO-SIGN]
            [NO-GROUPING]
            [NO-GAP]
            [DECIMALS no of decimals]
Suppressing Blanks(NO-ZERO)


* No Zero
DATA: number(10) TYPE N VALUE 23.
WRITE: number, number NO-ZERO.
Suppressing Number(+ / -) Sign


* No Sign
DATA: v_integer TYPE I VALUE -1.
WRITE: v_integer, v_integer NO-SIGN.
NO-GROUPING

* No grouping
DATA: v_integer TYPE I VALUE 120000.
WRITE: v_integer, v_integer NO-GROUPING.
NO-GAP


* No gap
WRITE: ‘Hello’ NO-GAP, ‘World’.
DECIMALS

* Decimals
DATA: v_pack TYPE P DECIMALS 4
        VALUE ‘1234.5678’.
WRITE: v_pack, v_pack DECIMALS 2.
Formatting Options

*   Format options of WRITE statement
*   LEFT-JUSTIFIED for Integer data
*   RIGHT-JUSTIFIED for Character data
*   CENTERED
Data tmp1(20) value ‘test’. test
WRITE: tmp1 CENTERED.
Inserting Blank Lines(SKIP)

*Skip Statement
SKIP.
WRITE: ‘Hello World’, sy-linno.
SKIP.
WRITE: ‘Test 1’.
SKIP 5.
WRITE: ‘Test 2’.
SKIP TO LINE 20.
WRITE ‘This is line 20’.
Inserting Horizontal Lines(ULINE)

* Uline
WRITE: ‘Hello World’.
WRITE: /5(35) sy-uline, sy-vline.
ULINE /5(35).
ULINE.
WRITE: / ‘This is an underline’.
ULINE /(18).
Frame


uline: /(45).
write: /1 sy-vline, 'Column #1',
      15 sy-vline, 'Column #2',
      30 sy-vline, 'Column #3',
      45 sy-vline.
uline: /(45).
Exercise I


 sy-                 sy-uzeit
datum
FORMAT Statement

FORMAT [INTENSIFIED]
       [INTENSIFIED OFF]
       [COLOR <color>]
       [COLOR OFF]
       [HOTSPOT ON]
       [HOTSPOT OFF]
       [RESET]
FORMAT Statement

FORMAT COLOR 1.
WRITE: / ‘Hello World’, ‘Test’ COLOR 7
FORMAT COLOR OFF.
FORMAT COLOR
FORMAT   COLOR   col_heading.      “color 1
FORMAT   COLOR   col_normal.       “color 2
FORMAT   COLOR   col_total.        “color 3
FORMAT   COLOR   col_key.          “color 4
FORMAT   COLOR   col_positive.     “color 5
FORMAT   COLOR   col_negative.     “color 6
FORMAT   COLOR   col_group.        “color 7
FORMAT   COLOR   col_background.   “color off
Exercise I
Include Program
     You can create a program with program type include program
      in the program attribute
     Include program do not have to have an introductory statement
     During the syntax check and during program generation by the
      ABAP compiler, the INCLUDE statement is replaced by the
      source text of the defined include program


REPORT ztest1.
                          Include Program :
INCLUDE zinclude1.        ZINCLUDE1
                           Data tmp(10).
  …                        Data tmp1 type i.
                           Data tmp2 type p.    REPORT ztest2.
                           Data tmp3.
                                                INCLUDE zinclude1
                                                  …
Symbols and Icons
* Display Icon or Symbol in List
INCLUDE <LIST>.
WRITE: / ‘Phone :’, SYM_PHONE AS SYMBOL.
WRITE: / ‘Alarm :’, ICON_ALARM AS ICON.
WRITE: / ‘Green Light :’,
         ICON_GREEN_LIGHT AS ICON HOTSPOT
FORMAT HOTSPOT ON.
 WRITE: / ‘Hello ABAP’, ’Hi!’.
FORMAT HOTSPOT OFF.
Flow Control in ABAP
Flow Control in ABAP


 Branching ==> IF, CASE.
 Looping   ==> DO, WHILE.
IF Statement

IF < Condition >.
    <Statement Block>
ELSEIF < Condition >.
    <Statement Block>
ELSEIF < Condition >.
    <Statement Block>
ELSE.
    <Statement Block>
ENDIF.
IF Statement

IF sy-mandt = ‘100’.
   WRITE: / ‘This is Production Client’.
ELSEIF sy-mandt = ‘800’.
   WRITE: / ‘This is Development Client’.
ELSE.
   WRITE: / ‘This is Test Client’.
ENDIF.
CASE Statement
CASE < field >.
 WHEN < value1 >.
     <Statement Block>
 WHEN < value2 >.
     <Statement Block>
 ...
 WHEN OTHERS.
     <Statement Block>
ENDCASE.
CASE Statement
CASE sy-mandt.
 WHEN ‘100’.
   WRITE: / ‘Production Client’.
 WHEN ‘800’.
   WRITE: / ‘Development Client’.
 WHEN OTHERS.
   WRITE: / ‘Test Client’.
ENDCASE.
DO Statement

DO.
WRITE sy-index.
IF sy-index = 3.
    EXIT.
ENDIF.
WRITE: sy-index.
ENDDO.
CONTINUE Statement

  DO 5 TIMES.
  IF sy-index = 3.
     CONTINUE.
  ENDIF.
  WRITE: sy-index.
  ENDDO.
CHECK Statement


DO 4 TIMES.
 CHECK sy-index BETWEEN 2 AND 3.
 WRITE: sy-index.
ENDDO.
WHILE Statement


DATA: count TYPE I value 1.
WHILE count <> 4.
 WRITE: sy-index.
 count = count + 1.
ENDWHILE.
Logical Expressions
>,GT
<,LT
>=, =>, GE
<=, =<, LE
=, EQ
<>, ><, NE
BETWEEN value1 AND value2
IS INITIAL
Arithmetic Operators
+ , - , * , / , **
DIV
MOD

    Example :
    9 / 2 = 4.5
    9 DIV 2 = 4.0
    9 MOD 2 = 1
    SQRT( 2 ) = 1.41
    2 ** 4 = 16
Character String Operator

                         T
if   ‘AABB’    co    ‘AB’. F
if   ‘ABCD’    co    ‘ABC’.
                          T
if    ‘AXCZ’    ca    ‘AB’.
                           F
if    ‘ABCD’    ca    ‘XYZ’.
                             T
if    ‘ABCD’    cp    ‘+B*’.
Manipulating Character Data
Manipulating Character Data

* Substrings with offsets
DATA tmp(10) VALUE ‘ABCDEFGHIJ’.
                          DEFGHIJ
DATA tmp1(2).
WRITE: tmp+3(7),   BCDE
         tmp+1(4), ABCDEFGH
         tmp+0(8),
                      HIJ
         tmp+7(3).
MOVE tmp+4(2) TO tmp1.
SHIFT Statement
* SHIFT Statement
DATA tmp(5) VALUE ‘12345’.
SHIFT tmp.        2345_
SHIFT tmp BY 2 PLACES.      345__
SHIFT tmp BY 2 PLACES CIRCULAR.   34512
SHIFT tmp UP TO ‘3’.    345__
SHIFT   tmp   UP TO ‘3’ RIGHT.  __123
SHIFT   tmp   UP TO ‘3’ RIGHT CIRCULAR.
                                  45123
SHIFT   tmp   RIGHT DELETING TRAILING SPACE.
SHIFT   tmp   LEFT DELETING LEADING SPACE.
SHIFT

* Shift
DATA name(30) VALUE ‘Alexander Bill Charl
SHIFT name UP TO ‘Bill’.
WRITE: / name.
                  Bill Charles
SEARCH(Non Case-
           sensitive)
* Search
DATA tmp(5) VALUE ‘ABCDE’.
SEARCH tmp FOR ‘C’.

DATA tmp1(10) VALUE ‘Till Bill’.
SEARCH tmp1 FOR ‘Bill’.
IF SY-SUBRC = 0.
  WRITE: / SY-FDPOS.
ENDIF.
TRANSLATE

* Translate
DATA tmp(5) VALUE ‘abc ‘.
TRANSLATE tmp TO UPPER CASE.
TRANSLATE tmp TO LOWER CASE.
TRANSLATE tmp USING ‘ 0’.
TRANSLATE tmp USING ‘ 0aA’.
REPLACE

* Replace
DATA tmp(20) VALUE ‘I was a boy’.
REPLACE ‘was’ WITH ‘am’ INTO tmp.
IF sy-subrc = 0.
 write ‘Replace OK’.
ELSE.
 write ‘Cannot find data to be replaced’.
ENDIF.
Removing Spaces(CONDENSE)

* Condense
DATA: tmp(20) VALUE ‘I am a      boy’.
CONDENSE tmp.       I am a boy
CONDENSE tmp NO-GAPS.

            Iamaboy
Concatenation String(CONCATENATE)

* Concatenate
DATA: tmp1(2) VALUE ‘AB’,
                      ABCDE
     tmp2(3) VALUE ‘CDE’,
     tmp3(10).
CONCATENATE tmp1 tmp2 INTO tmp3.
CONCATENATE tmp1 tmp2 INTO tmp3
               SEPARATED BY ‘ ‘.
                           AB CDE
Split



* Split
DATA: name(30) value ‘David, John, Peter’,
        one(10), two(10), three(30).
split name at ‘,’ into one two three.
Working with Date Variables
* Date
DATA today TYPE D.
today = sy-datum.
WRITE: today,       sy-datum+0(4)

       ‘Year :’ , today+0(4),
       ‘Month :’, today+4(2),
       ‘Day :’ , today+6(2).
WRITE … TO …
DATA: today TYPE D, tmp(10).
today = sy-datum.
tmp = today.
WRITE tmp.
WRITE today TO tmp.
WRITE tmp.
CLEAR today.
WRITE today NO-ZERO TO tmp.
WRITE tmp.
Invalid Date

DATA: today TYPE D.
today = ‘20061321’.
today = today + 0.
if today is initial.
   write: / ‘invalid date’.
else.
   write: / today.
endif.
Built-in Functions
   ABAP provides a lot of built-in functions
   A Built-in function calculates a return
    value from an argument
       abs       =   Absolute value of argument
       sign      =   +/- sign of argument
       sqrt      =   Square root
       strlen    =   Number of characters in arg
       xstrlen   =   Number of bytes in arg
STRLEN Built-in Function


DATA: tmp(20) VALUE ‘Test String’,
     count TYPE I.
count = strlen( tmp ).
WRITE count.
STRLEN Built-in Function Example
 DATA: tmp(20) VALUE ‘xxax’,
       cntlen TYPE I.
 cntlen = strlen( tmp ).
 cntlen = cntlen – 2.
 if tmp+cntlen(1) = ‘a’. “cntlen >= 0
    write: / ‘OK’.
 endif.
WRITE ‘

*If we need the word like this I’m a boy
WRITE: ‘I’’m a boy’.
Exercise
   Create program to display current
    month in text for example October
Report Driven : Page Report
Application Driven Programming
 REPORT ztest.
 DATA: today TYPE D.
 today = ‘20061321’.
 today = today + 0.
 IF today IS INITIAL.
   WRITE: / ‘invalid date’.
 ELSE.
   WRITE: / today.
 ENDIF.
Event Driven Programming
REPORT ztest.
DATA today TYPE D.
TOP-OF-PAGE.
 <ABAP statement>
END-OF-PAGE.
 <ABAP statement>
START-OF-SELECTION.
 <ABAP statement>
Report Driven List Header
EPORT ztest NO STANDARD PAGE HEADING
OP-OF-PAGE.
FORMAT COLOR 1.
WRITE: /5 ‘User Name’, 25 ‘Program Name’.
ULINE.
TART-OF-SELECTION.
WRITE: /5 sy-uname, 25 sy-repid.
Report Driven Page Footer
REPORT ztest no standard page heading LINE-COUNT 10(2).
TOP-OF-PAGE.
 FORMAT COLOR 1.
 WRITE: / ‘Page :’, sy-pagno.
 ULINE.
END-OF-PAGE.
 ULINE.
 WRITE: / ‘To be continue on next page…’ .
START-OF-SELECTION.
  DO 20 TIMES.
   WRITE: / sy-index.
  ENDDO.
TOP-OF-PAGE
REPORT ztest no standard page heading.

TOP-OF-PAGE.
 FORMAT COLOR 1.
 WRITE: / 'Report Header'.
 ULINE.

START-OF-SELECTION.
 DO 100 TIMES.
  WRITE: / sy-index.
 ENDDO.
ABAP Program Structure
Report ztest.
*Data declaration
data ...
data begin of ...

*Top-of-Page event
top-of-page.

*End-of-Page event
end-of-page.

*Start-of-selection
Start-of-selection.
ABAP Practice
Exercise II


 sy-                     sy-uzeit
datum
    sy-
   uname
                           sy-repid

More Related Content

PDF
Abap reports
PPT
ABAP Open SQL & Internal Table
PPT
Message, Debugging, File Transfer and Type Group
PPT
Alv theory
PPTX
Object oriented approach to ALV Lists in ABAP
PPT
Ab1011 module pool programming
PPT
ABAP Programming Overview
PPT
07.Advanced Abap
Abap reports
ABAP Open SQL & Internal Table
Message, Debugging, File Transfer and Type Group
Alv theory
Object oriented approach to ALV Lists in ABAP
Ab1011 module pool programming
ABAP Programming Overview
07.Advanced Abap

What's hot (20)

PPT
abap list viewer (alv)
PPT
Module pool programming
PPT
ABAP Event-driven Programming &Selection Screen
PPT
Modularization & Catch Statement
PDF
Introducing enhancement framework.doc
PPT
Abap function module help
PPT
User exit training
PPT
ABAP Advanced List
PPT
Chapter 01 user exits
PPTX
Sap scripts
PPT
Open SQL & Internal Table
DOC
Badi document
PPTX
Reports
PPT
SAP ABAP - Needed Notes
PPT
ABAP Object oriented concepts
DOCX
Field symbols
PPTX
SAP Modularization techniques
PDF
Creating attachments to work items or to user decisions in workflows
PPT
08.Abap Dialog Programming Overview
PPT
Introduction to ABAP
abap list viewer (alv)
Module pool programming
ABAP Event-driven Programming &Selection Screen
Modularization & Catch Statement
Introducing enhancement framework.doc
Abap function module help
User exit training
ABAP Advanced List
Chapter 01 user exits
Sap scripts
Open SQL & Internal Table
Badi document
Reports
SAP ABAP - Needed Notes
ABAP Object oriented concepts
Field symbols
SAP Modularization techniques
Creating attachments to work items or to user decisions in workflows
08.Abap Dialog Programming Overview
Introduction to ABAP
Ad

Viewers also liked (17)

PDF
Beginner’s guide to sap abap 1
PPT
ABAP Message, Debugging, File Transfer and Type Group
PPT
HR ABAP Technical Overview | http://sapdocs.info/
PDF
ABAP for Beginners - www.sapdocs.info
PDF
HR ABAP Programming Training Material | http://sapdocs.info
PDF
SAP FICO BBP Sample Document PDF NEW!
DOC
SAP ABAP Material
PDF
ABAP Basico para Consultores Funcionales
PDF
SAP ABAP data dictionary
PPT
List Processing in ABAP
PPT
Sap abap ppt
PPT
Dialog Programming Overview
DOC
LSMW Tutorial (Spanish Espanol)
PDF
SAP FI AP: End User Guide for Beginners
PDF
SAP FI-AR TCODES & MENU PATHS
PDF
SAP FI AR: End User Guide for Beginners
PPT
SAP Accounts Reveivable Functions | http://sapdocs.info
Beginner’s guide to sap abap 1
ABAP Message, Debugging, File Transfer and Type Group
HR ABAP Technical Overview | http://sapdocs.info/
ABAP for Beginners - www.sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
SAP FICO BBP Sample Document PDF NEW!
SAP ABAP Material
ABAP Basico para Consultores Funcionales
SAP ABAP data dictionary
List Processing in ABAP
Sap abap ppt
Dialog Programming Overview
LSMW Tutorial (Spanish Espanol)
SAP FI AP: End User Guide for Beginners
SAP FI-AR TCODES & MENU PATHS
SAP FI AR: End User Guide for Beginners
SAP Accounts Reveivable Functions | http://sapdocs.info
Ad

Similar to List Processing in ABAP (20)

PPT
1582627
PPT
Abapprogrammingoverview 090715081305-phpapp02
PPT
Chapter 1abapprogrammingoverview-091205081953-phpapp01
PPT
chapter-1abapprogrammingoverview-091205081953-phpapp01
PPT
Chapter 1 Abap Programming Overview
PPT
Abapprogrammingoverview 090715081305-phpapp02
PPTX
Basic programming
PPT
Abap programming overview
ODT
Yolygambas
ODT
Yolygambas
ODT
Yolygambas
PDF
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
PPTX
Unit 3(rdbms)
PPTX
Unit 3(rdbms)
PPT
03-fortran.ppt
PPTX
Python crush course
PPTX
CS 542 Database Index Structures
PDF
PDF
Ur Domain Haz Monoids DDDx NYC 2014
PDF
BASICS OF COMPUTER PROGRAMMING-TAKE HOME ASSIGNMENT 2018
1582627
Abapprogrammingoverview 090715081305-phpapp02
Chapter 1abapprogrammingoverview-091205081953-phpapp01
chapter-1abapprogrammingoverview-091205081953-phpapp01
Chapter 1 Abap Programming Overview
Abapprogrammingoverview 090715081305-phpapp02
Basic programming
Abap programming overview
Yolygambas
Yolygambas
Yolygambas
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Unit 3(rdbms)
Unit 3(rdbms)
03-fortran.ppt
Python crush course
CS 542 Database Index Structures
Ur Domain Haz Monoids DDDx NYC 2014
BASICS OF COMPUTER PROGRAMMING-TAKE HOME ASSIGNMENT 2018

More from sapdocs. info (20)

PDF
SAP PM Master Data Training Guide
DOCX
SAP SD Certification (C_TSCM62_66) Preparation Training Notes
DOCX
Variant Configuration in SAP PP: Beginner's Guide
PDF
SAP PP MRP Guide for Beginners
PDF
SAP ECC 6.0 PM Configuration Manual - www.sapdocs.info
PDF
SAP PM Training Manual - www.sapdocs.info
PDF
SAP Configuration Guide for Functional Modules (Based on IDES)
PDF
SAP FI-AP TCODES & MENU PATHS
DOC
SAP CO Configuration Guide - Exclusive Document
DOC
SAP PP End User Document - www.sapdocs.info
PDF
SAP MM Configuration - Real Project Documentation
PDF
SAP FI AP: Configuration & End User Guide
PDF
SAP FI Asset Accounting: End User Guide for Beginners
PDF
Variant Configurition in SAP: Beginners Guide | www.sapdocs.info
PDF
Exclusive SAP Basis Training Book | www.sapdocs.info
PDF
SAP Plant Maintenance Training Material | www.sapdocs.info
PDF
SAP HR Time Management User Guide | www.sapdocs.info
PPT
SAP FICO General Ledger EndUser Training | www.sapdocs.info
PPT
SAP Accounts Reveivable Introduction | http://sapdocs.info
PPT
SAP Accounts Reveivable Financial Transaction | http://sapdocs.info
SAP PM Master Data Training Guide
SAP SD Certification (C_TSCM62_66) Preparation Training Notes
Variant Configuration in SAP PP: Beginner's Guide
SAP PP MRP Guide for Beginners
SAP ECC 6.0 PM Configuration Manual - www.sapdocs.info
SAP PM Training Manual - www.sapdocs.info
SAP Configuration Guide for Functional Modules (Based on IDES)
SAP FI-AP TCODES & MENU PATHS
SAP CO Configuration Guide - Exclusive Document
SAP PP End User Document - www.sapdocs.info
SAP MM Configuration - Real Project Documentation
SAP FI AP: Configuration & End User Guide
SAP FI Asset Accounting: End User Guide for Beginners
Variant Configurition in SAP: Beginners Guide | www.sapdocs.info
Exclusive SAP Basis Training Book | www.sapdocs.info
SAP Plant Maintenance Training Material | www.sapdocs.info
SAP HR Time Management User Guide | www.sapdocs.info
SAP FICO General Ledger EndUser Training | www.sapdocs.info
SAP Accounts Reveivable Introduction | http://sapdocs.info
SAP Accounts Reveivable Financial Transaction | http://sapdocs.info

Recently uploaded (20)

PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Cell Structure & Organelles in detailed.
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Complications of Minimal Access Surgery at WLH
PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Yogi Goddess Pres Conference Studio Updates
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Computing-Curriculum for Schools in Ghana
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PPTX
master seminar digital applications in india
PDF
RMMM.pdf make it easy to upload and study
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Cell Structure & Organelles in detailed.
Final Presentation General Medicine 03-08-2024.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Complications of Minimal Access Surgery at WLH
UNIT III MENTAL HEALTH NURSING ASSESSMENT
Microbial disease of the cardiovascular and lymphatic systems
STATICS OF THE RIGID BODIES Hibbelers.pdf
Yogi Goddess Pres Conference Studio Updates
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
Orientation - ARALprogram of Deped to the Parents.pptx
Final Presentation General Medicine 03-08-2024.pptx
Computing-Curriculum for Schools in Ghana
Chinmaya Tiranga quiz Grand Finale.pdf
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
master seminar digital applications in india
RMMM.pdf make it easy to upload and study
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE

List Processing in ABAP

  • 1. ABAP Chapter 2  Report Statement  Write & Format Statement  Flow Control in ABAP  Manipulating Character Data  Report Driven : Page Report (List Header)
  • 3. Report Statement Syntax EPORT < report name > [NO STANDARD PAGE HEADING] [LINE-SIZE no of columns ] [LINE-COUNT no of lines [( no of footer )]]. EPORT ztest1 NO STANDARD PAGE HEADING. EPORT ztest LINE-SIZE 132 LINE-COUNT 65(2 sy-linsz
  • 4. Text Element : Title&Headers Report ztest. Write ‘Hello World’.  Text Element  Title and Headers List Header This is test program by Prapoj Column Header Column Column #1 #2
  • 5. Creating Lists  ABAP statement that create list  WRITE  SKIP  ULINE  The complete report list will appears automatically at the end of the processing block
  • 6. List Buffer Dialog WP Local Memory Memory Space TaskHandler ABAP Processor List Buffer WRITE,SKI Dynpro Processor P,ULINE DB Interface
  • 7. WRITE Statement Write data WRITE ‘Hello World’. WRITE: ‘OK’, ‘Test data’. WRITE: /15(10) ‘ABCDEFGHIJKLMNOPQ’ WRITE /20 ‘Test data’.
  • 8. Breaking to a New Line * Write data WRITE: / ‘First Line’, ‘Data 1’, / ‘Second Line’, ‘Data 2’, /(20) ‘Third Line’, ‘Data 3’, /35 ‘Fourth Line’, ‘Data 4’. sy- colno
  • 9. Text Symbol Report ztest. Write: Text-001, Text-002.  Text Element  Text Symbols  Text Symbol Text 001 Text 1 002 Text 2
  • 10. Text Symbol write: / Text-00 write: / Text-00 write: / Text-00 write: / Text-00 write: / Text-00
  • 11. Column Position DATA colno type I value 10. write: /5 ‘Hello’, at colno ‘World’. write: at /colno ‘OK’.
  • 12. Options of the WRITE Statement * Write Syntax WRITE var [NO-ZERO] [NO-SIGN] [NO-GROUPING] [NO-GAP] [DECIMALS no of decimals]
  • 13. Suppressing Blanks(NO-ZERO) * No Zero DATA: number(10) TYPE N VALUE 23. WRITE: number, number NO-ZERO.
  • 14. Suppressing Number(+ / -) Sign * No Sign DATA: v_integer TYPE I VALUE -1. WRITE: v_integer, v_integer NO-SIGN.
  • 15. NO-GROUPING * No grouping DATA: v_integer TYPE I VALUE 120000. WRITE: v_integer, v_integer NO-GROUPING.
  • 16. NO-GAP * No gap WRITE: ‘Hello’ NO-GAP, ‘World’.
  • 17. DECIMALS * Decimals DATA: v_pack TYPE P DECIMALS 4 VALUE ‘1234.5678’. WRITE: v_pack, v_pack DECIMALS 2.
  • 18. Formatting Options * Format options of WRITE statement * LEFT-JUSTIFIED for Integer data * RIGHT-JUSTIFIED for Character data * CENTERED Data tmp1(20) value ‘test’. test WRITE: tmp1 CENTERED.
  • 19. Inserting Blank Lines(SKIP) *Skip Statement SKIP. WRITE: ‘Hello World’, sy-linno. SKIP. WRITE: ‘Test 1’. SKIP 5. WRITE: ‘Test 2’. SKIP TO LINE 20. WRITE ‘This is line 20’.
  • 20. Inserting Horizontal Lines(ULINE) * Uline WRITE: ‘Hello World’. WRITE: /5(35) sy-uline, sy-vline. ULINE /5(35). ULINE. WRITE: / ‘This is an underline’. ULINE /(18).
  • 21. Frame uline: /(45). write: /1 sy-vline, 'Column #1', 15 sy-vline, 'Column #2', 30 sy-vline, 'Column #3', 45 sy-vline. uline: /(45).
  • 22. Exercise I sy- sy-uzeit datum
  • 23. FORMAT Statement FORMAT [INTENSIFIED] [INTENSIFIED OFF] [COLOR <color>] [COLOR OFF] [HOTSPOT ON] [HOTSPOT OFF] [RESET]
  • 24. FORMAT Statement FORMAT COLOR 1. WRITE: / ‘Hello World’, ‘Test’ COLOR 7 FORMAT COLOR OFF.
  • 25. FORMAT COLOR FORMAT COLOR col_heading. “color 1 FORMAT COLOR col_normal. “color 2 FORMAT COLOR col_total. “color 3 FORMAT COLOR col_key. “color 4 FORMAT COLOR col_positive. “color 5 FORMAT COLOR col_negative. “color 6 FORMAT COLOR col_group. “color 7 FORMAT COLOR col_background. “color off
  • 27. Include Program  You can create a program with program type include program in the program attribute  Include program do not have to have an introductory statement  During the syntax check and during program generation by the ABAP compiler, the INCLUDE statement is replaced by the source text of the defined include program REPORT ztest1. Include Program : INCLUDE zinclude1. ZINCLUDE1 Data tmp(10). … Data tmp1 type i. Data tmp2 type p. REPORT ztest2. Data tmp3. INCLUDE zinclude1 …
  • 28. Symbols and Icons * Display Icon or Symbol in List INCLUDE <LIST>. WRITE: / ‘Phone :’, SYM_PHONE AS SYMBOL. WRITE: / ‘Alarm :’, ICON_ALARM AS ICON. WRITE: / ‘Green Light :’, ICON_GREEN_LIGHT AS ICON HOTSPOT FORMAT HOTSPOT ON. WRITE: / ‘Hello ABAP’, ’Hi!’. FORMAT HOTSPOT OFF.
  • 30. Flow Control in ABAP  Branching ==> IF, CASE.  Looping ==> DO, WHILE.
  • 31. IF Statement IF < Condition >. <Statement Block> ELSEIF < Condition >. <Statement Block> ELSEIF < Condition >. <Statement Block> ELSE. <Statement Block> ENDIF.
  • 32. IF Statement IF sy-mandt = ‘100’. WRITE: / ‘This is Production Client’. ELSEIF sy-mandt = ‘800’. WRITE: / ‘This is Development Client’. ELSE. WRITE: / ‘This is Test Client’. ENDIF.
  • 33. CASE Statement CASE < field >. WHEN < value1 >. <Statement Block> WHEN < value2 >. <Statement Block> ... WHEN OTHERS. <Statement Block> ENDCASE.
  • 34. CASE Statement CASE sy-mandt. WHEN ‘100’. WRITE: / ‘Production Client’. WHEN ‘800’. WRITE: / ‘Development Client’. WHEN OTHERS. WRITE: / ‘Test Client’. ENDCASE.
  • 35. DO Statement DO. WRITE sy-index. IF sy-index = 3. EXIT. ENDIF. WRITE: sy-index. ENDDO.
  • 36. CONTINUE Statement DO 5 TIMES. IF sy-index = 3. CONTINUE. ENDIF. WRITE: sy-index. ENDDO.
  • 37. CHECK Statement DO 4 TIMES. CHECK sy-index BETWEEN 2 AND 3. WRITE: sy-index. ENDDO.
  • 38. WHILE Statement DATA: count TYPE I value 1. WHILE count <> 4. WRITE: sy-index. count = count + 1. ENDWHILE.
  • 39. Logical Expressions >,GT <,LT >=, =>, GE <=, =<, LE =, EQ <>, ><, NE BETWEEN value1 AND value2 IS INITIAL
  • 40. Arithmetic Operators + , - , * , / , ** DIV MOD Example : 9 / 2 = 4.5 9 DIV 2 = 4.0 9 MOD 2 = 1 SQRT( 2 ) = 1.41 2 ** 4 = 16
  • 41. Character String Operator T if ‘AABB’ co ‘AB’. F if ‘ABCD’ co ‘ABC’. T if ‘AXCZ’ ca ‘AB’. F if ‘ABCD’ ca ‘XYZ’. T if ‘ABCD’ cp ‘+B*’.
  • 43. Manipulating Character Data * Substrings with offsets DATA tmp(10) VALUE ‘ABCDEFGHIJ’. DEFGHIJ DATA tmp1(2). WRITE: tmp+3(7), BCDE tmp+1(4), ABCDEFGH tmp+0(8), HIJ tmp+7(3). MOVE tmp+4(2) TO tmp1.
  • 44. SHIFT Statement * SHIFT Statement DATA tmp(5) VALUE ‘12345’. SHIFT tmp. 2345_ SHIFT tmp BY 2 PLACES. 345__ SHIFT tmp BY 2 PLACES CIRCULAR. 34512 SHIFT tmp UP TO ‘3’. 345__ SHIFT tmp UP TO ‘3’ RIGHT. __123 SHIFT tmp UP TO ‘3’ RIGHT CIRCULAR. 45123 SHIFT tmp RIGHT DELETING TRAILING SPACE. SHIFT tmp LEFT DELETING LEADING SPACE.
  • 45. SHIFT * Shift DATA name(30) VALUE ‘Alexander Bill Charl SHIFT name UP TO ‘Bill’. WRITE: / name. Bill Charles
  • 46. SEARCH(Non Case- sensitive) * Search DATA tmp(5) VALUE ‘ABCDE’. SEARCH tmp FOR ‘C’. DATA tmp1(10) VALUE ‘Till Bill’. SEARCH tmp1 FOR ‘Bill’. IF SY-SUBRC = 0. WRITE: / SY-FDPOS. ENDIF.
  • 47. TRANSLATE * Translate DATA tmp(5) VALUE ‘abc ‘. TRANSLATE tmp TO UPPER CASE. TRANSLATE tmp TO LOWER CASE. TRANSLATE tmp USING ‘ 0’. TRANSLATE tmp USING ‘ 0aA’.
  • 48. REPLACE * Replace DATA tmp(20) VALUE ‘I was a boy’. REPLACE ‘was’ WITH ‘am’ INTO tmp. IF sy-subrc = 0. write ‘Replace OK’. ELSE. write ‘Cannot find data to be replaced’. ENDIF.
  • 49. Removing Spaces(CONDENSE) * Condense DATA: tmp(20) VALUE ‘I am a boy’. CONDENSE tmp. I am a boy CONDENSE tmp NO-GAPS. Iamaboy
  • 50. Concatenation String(CONCATENATE) * Concatenate DATA: tmp1(2) VALUE ‘AB’, ABCDE tmp2(3) VALUE ‘CDE’, tmp3(10). CONCATENATE tmp1 tmp2 INTO tmp3. CONCATENATE tmp1 tmp2 INTO tmp3 SEPARATED BY ‘ ‘. AB CDE
  • 51. Split * Split DATA: name(30) value ‘David, John, Peter’, one(10), two(10), three(30). split name at ‘,’ into one two three.
  • 52. Working with Date Variables * Date DATA today TYPE D. today = sy-datum. WRITE: today, sy-datum+0(4) ‘Year :’ , today+0(4), ‘Month :’, today+4(2), ‘Day :’ , today+6(2).
  • 53. WRITE … TO … DATA: today TYPE D, tmp(10). today = sy-datum. tmp = today. WRITE tmp. WRITE today TO tmp. WRITE tmp. CLEAR today. WRITE today NO-ZERO TO tmp. WRITE tmp.
  • 54. Invalid Date DATA: today TYPE D. today = ‘20061321’. today = today + 0. if today is initial. write: / ‘invalid date’. else. write: / today. endif.
  • 55. Built-in Functions  ABAP provides a lot of built-in functions  A Built-in function calculates a return value from an argument  abs = Absolute value of argument  sign = +/- sign of argument  sqrt = Square root  strlen = Number of characters in arg  xstrlen = Number of bytes in arg
  • 56. STRLEN Built-in Function DATA: tmp(20) VALUE ‘Test String’, count TYPE I. count = strlen( tmp ). WRITE count.
  • 57. STRLEN Built-in Function Example DATA: tmp(20) VALUE ‘xxax’, cntlen TYPE I. cntlen = strlen( tmp ). cntlen = cntlen – 2. if tmp+cntlen(1) = ‘a’. “cntlen >= 0 write: / ‘OK’. endif.
  • 58. WRITE ‘ *If we need the word like this I’m a boy WRITE: ‘I’’m a boy’.
  • 59. Exercise  Create program to display current month in text for example October
  • 60. Report Driven : Page Report
  • 61. Application Driven Programming REPORT ztest. DATA: today TYPE D. today = ‘20061321’. today = today + 0. IF today IS INITIAL. WRITE: / ‘invalid date’. ELSE. WRITE: / today. ENDIF.
  • 62. Event Driven Programming REPORT ztest. DATA today TYPE D. TOP-OF-PAGE. <ABAP statement> END-OF-PAGE. <ABAP statement> START-OF-SELECTION. <ABAP statement>
  • 63. Report Driven List Header EPORT ztest NO STANDARD PAGE HEADING OP-OF-PAGE. FORMAT COLOR 1. WRITE: /5 ‘User Name’, 25 ‘Program Name’. ULINE. TART-OF-SELECTION. WRITE: /5 sy-uname, 25 sy-repid.
  • 64. Report Driven Page Footer REPORT ztest no standard page heading LINE-COUNT 10(2). TOP-OF-PAGE. FORMAT COLOR 1. WRITE: / ‘Page :’, sy-pagno. ULINE. END-OF-PAGE. ULINE. WRITE: / ‘To be continue on next page…’ . START-OF-SELECTION. DO 20 TIMES. WRITE: / sy-index. ENDDO.
  • 65. TOP-OF-PAGE REPORT ztest no standard page heading. TOP-OF-PAGE. FORMAT COLOR 1. WRITE: / 'Report Header'. ULINE. START-OF-SELECTION. DO 100 TIMES. WRITE: / sy-index. ENDDO.
  • 66. ABAP Program Structure Report ztest. *Data declaration data ... data begin of ... *Top-of-Page event top-of-page. *End-of-Page event end-of-page. *Start-of-selection Start-of-selection.
  • 68. Exercise II sy- sy-uzeit datum sy- uname sy-repid