abap chapter 2 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
ABAP Chapter 2 PowerPoint Presentation
Download Presentation
ABAP Chapter 2

Loading in 2 Seconds...

play fullscreen
1 / 68

ABAP Chapter 2 - PowerPoint PPT Presentation


  • 179 Views
  • Uploaded on

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 >

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

ABAP Chapter 2


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
    Presentation Transcript
    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 Report ztest. Write ‘Hello World’. This is test program by Prapoj 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 Local Memory • Dialog WP Memory Space TaskHandler ABAP Processor List Buffer WRITE,SKIP,ULINE Dynpro Processor 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 • Text Element • Text Symbols • Text Symbol Text Report ztest. Write: Text-001, Text-002. 001 Text 1 002 Text 2

    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 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-uzeit sy-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

    26. Exercise I

    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 zinclude1. • … Include Program : ZINCLUDE1 Data tmp(10). Data tmp1 type i. Data tmp2 type p. Data tmp3. • 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.

    29. Flow Control in ABAP

    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’. • if ‘ABCD’ co ‘ABC’. • if ‘AXCZ’ ca ‘AB’. • if ‘ABCD’ ca ‘XYZ’. • if ‘ABCD’ cp ‘+B*’. F T F T

    42. Manipulating Character Data

    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 PLACES. SHIFT tmp BY 2 PLACES CIRCULAR. SHIFT tmp UP TO ‘3’. SHIFT tmp UP TO ‘3’ RIGHT. SHIFT tmp UP TO ‘3’ RIGHT CIRCULAR. SHIFT tmp RIGHT DELETING TRAILING SPACE. SHIFT tmp LEFT DELETING LEADING SPACE. 2345_ 345__ 34512 345__ __123 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