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 REPORT < report name >  [NO STANDARD PAGE HEADING] [LINE-SIZE  no of columns ] [LINE-COUNT  no of lines [( no of footer )]]. REPORT  ztest1 NO STANDARD PAGE HEADING. REPORT  ztest  LINE-SIZE  132  LINE-COUNT  65(2). sy-linsz
Text Element : Title&Headers Text Element Title and Headers List Header Column Header   This is test program by Prapoj Column  Column  #1  #2 Report ztest. Write ‘Hello World’.
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 TaskHandler Dynpro Processor ABAP Processor Local Memory Memory Space DB Interface List Buffer WRITE,SKIP,ULINE
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 Text Element Text Symbols Text Symbol  Text Text 2 Text 1 Report ztest. Write: Text-001, Text-002. 001 002
Text Symbol write: / Text-001. write: / Text-001. write: / Text-001. write: / Text-001. write: / Text-001.
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’.  WRITE:  tmp1  CENTERED. test
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 u nderline’. 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-datum sy-uzeit
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 Data tmp(10). Data tmp1 type i.  Data tmp2 type p. Data tmp3. Include Program : ZINCLUDE1 REPORT ztest1. INCLUDE zinclude1. … REPORT ztest2. 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 = ‘1 00 ’. 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 if ‘AABB’  co  ‘AB’. if ‘ABCD’  co  ‘ABC’. if  ‘AXCZ’  ca  ‘AB’. if  ‘ABCD’  ca  ‘XYZ’. if  ‘ABCD’  cp  ‘+B*’. T F T F T
Manipulating Character Data
Manipulating Character Data * Substrings with offsets DATA  tmp(10)  VALUE  ‘ABCDEFGHIJ’. DATA  tmp1(2). WRITE:  tmp+3 (7) , tmp+1(4), tmp+0(8), tmp+7(3). MOVE  tmp+4(2)  TO  tmp1. DEFGHIJ BCDE ABCDEFGH HIJ
SHIFT Statement * SHIFT Statement DATA  tmp(5)  VALUE  ‘12345’. SHIFT  tmp. SHIFT  tmp  BY  2  PLACE S . SHIFT  tmp  BY  2  PLACE S   CIRCULAR. SHIFT  tmp  UP  TO  ‘3’. SHIFT  tmp  UP  TO  ‘3’  RIGHT. SHIFT  tmp  UP  TO  ‘3’  RIGHT  CIRCULAR. SHIFT  tmp  RIGHT  DELETING  TRA I LING  SPACE. SHIFT  tmp  LEFT  DELETING  LEADING  SPACE. 2345_ 345__ 34512 __123 345__ 45123
SHIFT * Shift DATA  name(30)  VALUE  ‘Alexander Bill Charles’. 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. CONDENSE  tmp  NO-GAPS. I am a boy Iamaboy
Concatenation String(CONCATENATE) * Concatenate DATA: tmp1(2)  VALUE  ‘AB’, tmp2(3)  VALUE  ‘CDE’, tmp3(10). CONCATENATE  tmp1  tmp2  INTO  tmp3. CONCATENATE  tmp1  tmp2  INTO  tmp3  SEPARATED  BY  ‘ ‘. ABCDE 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, ‘ Year :’  , today+0(4), ‘ Month :’, today+4(2), ‘ Day :’  , today+6(2). sy-datum+0(4)
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  =  ‘2006 13 21’. 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  ‘ xx a x ’, cn tlen   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 REPORT ztest  NO  STANDARD  PAGE  HEADING. TOP-OF-PAGE. FORMAT COLOR  1. WRITE: /5  ‘User Name’, 25 ‘Program Name’. ULINE. START-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  n ext  p age…’ . 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-datum sy-uzeit sy-repid sy-uname

More Related Content

What's hot (20)

PPT
07.Advanced Abap
sapdocs. info
 
PPT
ABAP Message, Debugging, File Transfer and Type Group
sapdocs. info
 
PPTX
Sap scripts
Jugul Crasta
 
PPTX
Reports
Jugul Crasta
 
PPT
Call transaction method
Kranthi Kumar
 
PDF
Abap reports
Milind Patil
 
PPTX
Object oriented approach to ALV Lists in ABAP
Noman Mohamed Hanif
 
PPTX
Top 10 sap abap faqs-www.bigclasses.com
bigclasses.com
 
PPT
Chapter 03 foreign key relationships1
Kranthi Kumar
 
PPT
Dialog Programming Overview
sapdocs. info
 
PDF
Sap Abap Reports
vbpc
 
PDF
ABAP for Beginners - www.sapdocs.info
sapdocs. info
 
PPT
User exit training
Jen Ringel
 
PPT
Alv theory
Phani Kumar
 
PPT
Step by step lsmw tutorial
raonivaz
 
DOCX
Personalization to restrict values in customer name and number lov in sales o...
Ahmed Elshayeb
 
PPTX
SAP Smart forms
Jugul Crasta
 
DOCX
Select all record from menu for matching item type in ap invoice personalization
Ahmed Elshayeb
 
PPTX
Abap dictionary 1
venkata karthik
 
DOCX
Sap abap modularization interview questions
Pradipta Mohanty
 
07.Advanced Abap
sapdocs. info
 
ABAP Message, Debugging, File Transfer and Type Group
sapdocs. info
 
Sap scripts
Jugul Crasta
 
Reports
Jugul Crasta
 
Call transaction method
Kranthi Kumar
 
Abap reports
Milind Patil
 
Object oriented approach to ALV Lists in ABAP
Noman Mohamed Hanif
 
Top 10 sap abap faqs-www.bigclasses.com
bigclasses.com
 
Chapter 03 foreign key relationships1
Kranthi Kumar
 
Dialog Programming Overview
sapdocs. info
 
Sap Abap Reports
vbpc
 
ABAP for Beginners - www.sapdocs.info
sapdocs. info
 
User exit training
Jen Ringel
 
Alv theory
Phani Kumar
 
Step by step lsmw tutorial
raonivaz
 
Personalization to restrict values in customer name and number lov in sales o...
Ahmed Elshayeb
 
SAP Smart forms
Jugul Crasta
 
Select all record from menu for matching item type in ap invoice personalization
Ahmed Elshayeb
 
Abap dictionary 1
venkata karthik
 
Sap abap modularization interview questions
Pradipta Mohanty
 

Viewers also liked (12)

PPT
Modularization & Catch Statement
sapdocs. info
 
PPT
SAP Accounts Reveivable Functions | http://sapdocs.info
sapdocs. info
 
PPT
List Processing in ABAP
sapdocs. info
 
PPT
SAP Accounts Reveivable Customer Master | http://sapdocs.info
sapdocs. info
 
PPT
SAP Accounts Reveivable Introduction | http://sapdocs.info
sapdocs. info
 
PPT
HR ABAP Technical Overview | http://sapdocs.info/
sapdocs. info
 
PPT
08.Abap Dialog Programming Overview
sapdocs. info
 
DOC
Complete list of all sap abap keywords
Prakash Thirumoorthy
 
PPT
ABAP Open SQL & Internal Table
sapdocs. info
 
PDF
HR ABAP Programming Training Material | http://sapdocs.info
sapdocs. info
 
PPT
SAP Accounts Payable Payment | http://sapdocs.info
sapdocs. info
 
PPT
Introduction to ABAP
sapdocs. info
 
Modularization & Catch Statement
sapdocs. info
 
SAP Accounts Reveivable Functions | http://sapdocs.info
sapdocs. info
 
List Processing in ABAP
sapdocs. info
 
SAP Accounts Reveivable Customer Master | http://sapdocs.info
sapdocs. info
 
SAP Accounts Reveivable Introduction | http://sapdocs.info
sapdocs. info
 
HR ABAP Technical Overview | http://sapdocs.info/
sapdocs. info
 
08.Abap Dialog Programming Overview
sapdocs. info
 
Complete list of all sap abap keywords
Prakash Thirumoorthy
 
ABAP Open SQL & Internal Table
sapdocs. info
 
HR ABAP Programming Training Material | http://sapdocs.info
sapdocs. info
 
SAP Accounts Payable Payment | http://sapdocs.info
sapdocs. info
 
Introduction to ABAP
sapdocs. info
 
Ad

Similar to List Processing in ABAP (20)

PPT
chapter-1abapprogrammingoverview-091205081953-phpapp01
tabish
 
PPT
Chapter 1 Abap Programming Overview
Ashish Kumar
 
PPT
Abapprogrammingoverview 090715081305-phpapp02
wingsrai
 
PPT
Chapter 1abapprogrammingoverview-091205081953-phpapp01
tabish
 
PPT
Abapprogrammingoverview 090715081305-phpapp02
tabish
 
PPTX
Basic programming
Jugul Crasta
 
PDF
PL /SQL program UNIT 5 DMS 22319
ARVIND SARDAR
 
PDF
Ejer
Spacetoshare
 
DOCX
Programas Gambas
Stalin Rodriguez
 
DOCX
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
amrit47
 
ODT
Yolygambas
guest286373
 
ODT
Yolygambas
guest286373
 
ODT
Yolygambas
rosyp
 
PDF
Abap basics 01
yours4ever002
 
PDF
C++ Program It is only 1 rotation. Up-rotation of a stack. Write a.pdf
pallavi953613
 
DOCX
There are a number of errors in the following program- All errors are.docx
clarkjanyce
 
PDF
Plsql programs(encrypted)
Karunakar Singh Thakur
 
PDF
The Ring programming language version 1.6 book - Part 9 of 189
Mahmoud Samir Fayed
 
PPT
SQl
sarankumarv
 
DOCX
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
ssuser454af01
 
chapter-1abapprogrammingoverview-091205081953-phpapp01
tabish
 
Chapter 1 Abap Programming Overview
Ashish Kumar
 
Abapprogrammingoverview 090715081305-phpapp02
wingsrai
 
Chapter 1abapprogrammingoverview-091205081953-phpapp01
tabish
 
Abapprogrammingoverview 090715081305-phpapp02
tabish
 
Basic programming
Jugul Crasta
 
PL /SQL program UNIT 5 DMS 22319
ARVIND SARDAR
 
Programas Gambas
Stalin Rodriguez
 
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
amrit47
 
Yolygambas
guest286373
 
Yolygambas
guest286373
 
Yolygambas
rosyp
 
Abap basics 01
yours4ever002
 
C++ Program It is only 1 rotation. Up-rotation of a stack. Write a.pdf
pallavi953613
 
There are a number of errors in the following program- All errors are.docx
clarkjanyce
 
Plsql programs(encrypted)
Karunakar Singh Thakur
 
The Ring programming language version 1.6 book - Part 9 of 189
Mahmoud Samir Fayed
 
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
ssuser454af01
 
Ad

More from sapdocs. info (20)

PDF
SAP PM Master Data Training Guide
sapdocs. info
 
DOCX
SAP SD Certification (C_TSCM62_66) Preparation Training Notes
sapdocs. info
 
DOCX
Variant Configuration in SAP PP: Beginner's Guide
sapdocs. info
 
PDF
SAP FICO BBP Sample Document PDF NEW!
sapdocs. info
 
PDF
SAP PP MRP Guide for Beginners
sapdocs. info
 
PDF
SAP ECC 6.0 PM Configuration Manual - www.sapdocs.info
sapdocs. info
 
PDF
SAP PM Training Manual - www.sapdocs.info
sapdocs. info
 
PDF
ABAP Basico para Consultores Funcionales
sapdocs. info
 
PDF
SAP Configuration Guide for Functional Modules (Based on IDES)
sapdocs. info
 
PDF
SAP FI-AP TCODES & MENU PATHS
sapdocs. info
 
PDF
SAP FI-AR TCODES & MENU PATHS
sapdocs. info
 
DOC
SAP CO Configuration Guide - Exclusive Document
sapdocs. info
 
DOC
SAP PP End User Document - www.sapdocs.info
sapdocs. info
 
PDF
SAP MM Configuration - Real Project Documentation
sapdocs. info
 
PDF
SAP FI AP: Configuration & End User Guide
sapdocs. info
 
PDF
SAP FI AR: End User Guide for Beginners
sapdocs. info
 
PDF
SAP FI AP: End User Guide for Beginners
sapdocs. info
 
PDF
SAP FI Asset Accounting: End User Guide for Beginners
sapdocs. info
 
PDF
Variant Configurition in SAP: Beginners Guide | www.sapdocs.info
sapdocs. info
 
PDF
Exclusive SAP Basis Training Book | www.sapdocs.info
sapdocs. info
 
SAP PM Master Data Training Guide
sapdocs. info
 
SAP SD Certification (C_TSCM62_66) Preparation Training Notes
sapdocs. info
 
Variant Configuration in SAP PP: Beginner's Guide
sapdocs. info
 
SAP FICO BBP Sample Document PDF NEW!
sapdocs. info
 
SAP PP MRP Guide for Beginners
sapdocs. info
 
SAP ECC 6.0 PM Configuration Manual - www.sapdocs.info
sapdocs. info
 
SAP PM Training Manual - www.sapdocs.info
sapdocs. info
 
ABAP Basico para Consultores Funcionales
sapdocs. info
 
SAP Configuration Guide for Functional Modules (Based on IDES)
sapdocs. info
 
SAP FI-AP TCODES & MENU PATHS
sapdocs. info
 
SAP FI-AR TCODES & MENU PATHS
sapdocs. info
 
SAP CO Configuration Guide - Exclusive Document
sapdocs. info
 
SAP PP End User Document - www.sapdocs.info
sapdocs. info
 
SAP MM Configuration - Real Project Documentation
sapdocs. info
 
SAP FI AP: Configuration & End User Guide
sapdocs. info
 
SAP FI AR: End User Guide for Beginners
sapdocs. info
 
SAP FI AP: End User Guide for Beginners
sapdocs. info
 
SAP FI Asset Accounting: End User Guide for Beginners
sapdocs. info
 
Variant Configurition in SAP: Beginners Guide | www.sapdocs.info
sapdocs. info
 
Exclusive SAP Basis Training Book | www.sapdocs.info
sapdocs. info
 

Recently uploaded (20)

PDF
Top Farewell Gifts for Seniors Under.pdf
ThreadVibe Living
 
PDF
Factors Influencing Demand For Plumbers In Toronto GTA:
Homestars
 
PDF
Improving Urban Traffic Monitoring with Aerial Image Annotation Services
SunTec India
 
PDF
kcb-group-plc-2024-integrated-report-and-financial-statements (3).pdf
DanielNdegwa10
 
PDF
Securiport - A Global Leader
Securiport
 
PDF
Van Aroma IFEAT - Clove Oils - Socio Economic Report .pdf
VanAroma
 
PPT
Financial Management - All Slides.ppt.pdf
HeangLaisiv1
 
DOCX
How to Choose the Best Dildo for Men A Complete Buying Guide.docx
Glas Toy
 
PDF
Why Unipac Equipment Leads the Way Among Gantry Crane Manufacturers in Singap...
UnipacEquipment
 
PPTX
Drive Operational Excellence with Proven Continuous Improvement Strategies
Group50 Consulting
 
PDF
Kirill Klip GEM Royalty TNR Gold Presentation
Kirill Klip
 
PPTX
Business Trendsjobsand careerr 2025.pptx
sahatanmay391
 
PDF
Leadership Advisory & Branding powered by MECE, SCQA & 3P framework.pdf
Vipin Srivastava
 
PPTX
DECODING AI AGENTS AND WORKFLOW AUTOMATION FOR MODERN RECRUITMENT
José Kadlec
 
PDF
Concept Topology in Architectural Build Addendum.pdf
Brij Consulting, LLC
 
PPTX
The Art of Customer Journey Optimization: Crafting Seamless Experiences
RUPAL AGARWAL
 
PDF
Redefining Punjab’s Growth Story_ Mohit Bansal and the Human-Centric Vision o...
Mohit Bansal GMI
 
PPTX
Why-Your-BPO-Startup-Must-Track-Attrition-from-Day-One.pptx.pptx
Orage technologies
 
PDF
Dr. Enrique Segura Ense Group - A Philanthropist And Entrepreneur
Dr. Enrique Segura Ense Group
 
PDF
Keppel Investor Day 2025 Presentation Slides GCAT.pdf
KeppelCorporation
 
Top Farewell Gifts for Seniors Under.pdf
ThreadVibe Living
 
Factors Influencing Demand For Plumbers In Toronto GTA:
Homestars
 
Improving Urban Traffic Monitoring with Aerial Image Annotation Services
SunTec India
 
kcb-group-plc-2024-integrated-report-and-financial-statements (3).pdf
DanielNdegwa10
 
Securiport - A Global Leader
Securiport
 
Van Aroma IFEAT - Clove Oils - Socio Economic Report .pdf
VanAroma
 
Financial Management - All Slides.ppt.pdf
HeangLaisiv1
 
How to Choose the Best Dildo for Men A Complete Buying Guide.docx
Glas Toy
 
Why Unipac Equipment Leads the Way Among Gantry Crane Manufacturers in Singap...
UnipacEquipment
 
Drive Operational Excellence with Proven Continuous Improvement Strategies
Group50 Consulting
 
Kirill Klip GEM Royalty TNR Gold Presentation
Kirill Klip
 
Business Trendsjobsand careerr 2025.pptx
sahatanmay391
 
Leadership Advisory & Branding powered by MECE, SCQA & 3P framework.pdf
Vipin Srivastava
 
DECODING AI AGENTS AND WORKFLOW AUTOMATION FOR MODERN RECRUITMENT
José Kadlec
 
Concept Topology in Architectural Build Addendum.pdf
Brij Consulting, LLC
 
The Art of Customer Journey Optimization: Crafting Seamless Experiences
RUPAL AGARWAL
 
Redefining Punjab’s Growth Story_ Mohit Bansal and the Human-Centric Vision o...
Mohit Bansal GMI
 
Why-Your-BPO-Startup-Must-Track-Attrition-from-Day-One.pptx.pptx
Orage technologies
 
Dr. Enrique Segura Ense Group - A Philanthropist And Entrepreneur
Dr. Enrique Segura Ense Group
 
Keppel Investor Day 2025 Presentation Slides GCAT.pdf
KeppelCorporation
 

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)
  • 2. List Processing Report Header Report Listing (Body)
  • 3. Report Statement * Syntax REPORT < report name > [NO STANDARD PAGE HEADING] [LINE-SIZE no of columns ] [LINE-COUNT no of lines [( no of footer )]]. REPORT ztest1 NO STANDARD PAGE HEADING. REPORT ztest LINE-SIZE 132 LINE-COUNT 65(2). sy-linsz
  • 4. Text Element : Title&Headers Text Element Title and Headers List Header Column Header This is test program by Prapoj Column Column #1 #2 Report ztest. Write ‘Hello World’.
  • 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 TaskHandler Dynpro Processor ABAP Processor Local Memory Memory Space DB Interface List Buffer WRITE,SKIP,ULINE
  • 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 Text Element Text Symbols Text Symbol Text Text 2 Text 1 Report ztest. Write: Text-001, Text-002. 001 002
  • 10. Text Symbol write: / Text-001. write: / Text-001. write: / Text-001. write: / Text-001. write: / Text-001.
  • 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’. WRITE: tmp1 CENTERED. test
  • 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 u nderline’. 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).
  • 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 Data tmp(10). Data tmp1 type i. Data tmp2 type p. Data tmp3. Include Program : ZINCLUDE1 REPORT ztest1. INCLUDE zinclude1. … REPORT ztest2. 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 = ‘1 00 ’. 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 if ‘AABB’ co ‘AB’. if ‘ABCD’ co ‘ABC’. if ‘AXCZ’ ca ‘AB’. if ‘ABCD’ ca ‘XYZ’. if ‘ABCD’ cp ‘+B*’. T F T F T
  • 43. Manipulating Character Data * Substrings with offsets DATA tmp(10) VALUE ‘ABCDEFGHIJ’. DATA tmp1(2). WRITE: tmp+3 (7) , tmp+1(4), tmp+0(8), tmp+7(3). MOVE tmp+4(2) TO tmp1. DEFGHIJ BCDE ABCDEFGH HIJ
  • 44. SHIFT Statement * SHIFT Statement DATA tmp(5) VALUE ‘12345’. SHIFT tmp. SHIFT tmp BY 2 PLACE S . SHIFT tmp BY 2 PLACE S CIRCULAR. SHIFT tmp UP TO ‘3’. SHIFT tmp UP TO ‘3’ RIGHT. SHIFT tmp UP TO ‘3’ RIGHT CIRCULAR. SHIFT tmp RIGHT DELETING TRA I LING SPACE. SHIFT tmp LEFT DELETING LEADING SPACE. 2345_ 345__ 34512 __123 345__ 45123
  • 45. SHIFT * Shift DATA name(30) VALUE ‘Alexander Bill Charles’. 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. CONDENSE tmp NO-GAPS. I am a boy Iamaboy
  • 50. Concatenation String(CONCATENATE) * Concatenate DATA: tmp1(2) VALUE ‘AB’, tmp2(3) VALUE ‘CDE’, tmp3(10). CONCATENATE tmp1 tmp2 INTO tmp3. CONCATENATE tmp1 tmp2 INTO tmp3 SEPARATED BY ‘ ‘. ABCDE 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, ‘ Year :’ , today+0(4), ‘ Month :’, today+4(2), ‘ Day :’ , today+6(2). sy-datum+0(4)
  • 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 = ‘2006 13 21’. 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 ‘ xx a x ’, cn tlen 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 REPORT ztest NO STANDARD PAGE HEADING. TOP-OF-PAGE. FORMAT COLOR 1. WRITE: /5 ‘User Name’, 25 ‘Program Name’. ULINE. START-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 n ext p age…’ . 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-datum sy-uzeit sy-repid sy-uname