Project 7 Internal Tables II

Project 7 Internal Tables II

<p>Project 7 Internal Tables II </p><p>Project Overview</p><p>Create an ABAP Program that will produce a summary report of dollars spent on Purchase Orders for a given date range. Display the sum by purchase organization and then purchasing group.</p><p>The key to this program is loading everything into an internal table first. This makes the select very fast then manipulating the data using the 'at new' and 'at end of' statements in the internal table</p><p>Project Specifics/Requirements</p><p>For the report statement, add the following attribute:</p><p> no standard page heading line-size 132</p><p>The Tables for this program are:</p><p>Ekko PO table Ekpo PO line item table</p><p>Creat an internal table that contains the structure of the following fields:</p><p> ekko-ekorg ekko-ekgrp ekko-ebeln ekpo-brtwr</p><p>Use the following code for using Parameters: selection-screen begin of block thread. selection-screen comment /1(83) text-003.</p><p>Parameters: r1 radiobutton group decd default 'X', r2 radiobutton group decd.</p><p> selection-screen uline. selection-screen end of block thread. Use Select-Options as displayed below: select-options: s_ekorg for ekko-ekorg, s_ekgrp for ekko-ekgrp, s_bukrs for ekko-bukrs, s_bsart for ekko-bsart default 'PO', s_bedat for ekko-bedat.</p><p>Create a conditional statement that checks the value of the radio button and calls the appropriate subroutine. if r1 eq 'X'. perform summary. else. perform detail. endif.</p><p>For the Summary Subroutine, create variables that will store the group and organization summary amounts.</p><p>Note: that the internal table must be organized in the order in which you want to break on the data. In addition you need to sort the table in the sort order as well before you start to process it. This is key if you don't you will miss data</p><p> sort itab by ekorg ekgrp.</p><p> loop at itab.</p><p> at new ekorg. write: /2 itab-ekorg. endat.</p><p> at new ekgrp. write: /5 itab-ekgrp. endat.</p><p>Var1 = Var1 + itab-brtwr.</p><p> at end of ekgrp. write: at 15 Var1.</p><p>Var2 = Var2 + Var1.</p><p> clear Var1.</p><p> endat.</p><p> at end of ekorg.</p><p> write: /2(40) sy-uline. write: /2 'Purchasing Org Total: ', Var2.</p><p> clear Var2. endat.</p><p> endloop.</p><p>ENDFORM</p><p>Create a Subroutine for the details. Declare 3 variables to store the values</p><p>Note: that the internal table must be organized in the order in which you want to break on the data. In addition you need to sort the table in the sort order as well before you start to process it. This is key if you don't you will miss data</p><p> sort itab by ekorg ekgrp ebeln.</p><p> loop at itab.</p><p> at new ekorg. write: /2 itab-ekorg. endat.</p><p> at new ekgrp. write: /5 itab-ekgrp. endat.</p><p> at new ebeln. write: /8 itab-ebeln. endat.</p><p>Var3 = Var3 + itab-brtwr.</p><p> at end of ebeln.</p><p> write: at 25 Var3.</p><p>Var1 = Var1 + Var3.</p><p> clear Var3.</p><p> endat.</p><p> at end of ekgrp.</p><p> write: /2(50) sy-uline.</p><p> write: /2 'Purchasing Grp Total: ', Var1.</p><p> skip.</p><p>Var2 = Var2 + Var1.</p><p> clear Var1.</p><p> endat. at end of ekorg.</p><p> skip.</p><p> write: /2(50) sy-uline. write: /8 'Purchasing Org Total: ', Var2.</p><p> clear Var2.</p><p> endat.</p><p> endloop.</p><p>ENDFORM. </p><p>Create a Sub Routine that gets the data. Use the example below.</p><p> select ekorg ekgrp ebeln into (ekko-ekorg, ekko-ekgrp, ekko-ebeln) from ekko where ekorg in s_ekorg and ekgrp in s_ekgrp and bukrs in s_bukrs and bsart in s_bsart and bedat in s_bedat.</p><p> select brtwr into ekpo-brtwr from ekpo where ebeln = ekko-ebeln.</p><p> itab-ekorg = ekko-ekorg. itab-ekgrp = ekko-ekgrp. itab-ebeln = ekko-ebeln. itab-brtwr = ekpo-brtwr.</p><p> append itab.</p><p> endselect.</p><p> endselect.</p><p>ENDFORM. </p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    4 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us