structuring an abap report in an optimal way

18
Structuring An SAP ABAP Report In An Optimal Way Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Upload: blackvard

Post on 06-Aug-2015

386 views

Category:

Education


0 download

TRANSCRIPT

Structuring An SAP ABAP Report In An Optimal Way

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Blackvard Management Consultants

www.blackvard.comCopyright © Blackvard Management Consulting – All rights reserved

Erin Lett is the Operations Manager for Blackvard Management Consulting. She holds a Bachelor’s Degree from Stetson University in Communications and has been working in the SAP, eLearning, and Software Development industries for the past 6 years.

For further information please visit:

www.blackvard.com

[email protected]

Copyright © Blackvard Management Consulting- All rights reserved www.blackvard.com

Your Host

Erin Lett

Blackvard Management Consultants

www.blackvard.comCopyright © Blackvard Management Consulting – All rights reserved

Short Bio:

Lukas M. Dietzsch is managing director at Blackvard Management Consulting, LLC. He is holding a Master’s degree in Information Technology and is an experienced IT solution architect and project lead.

His strong background in adapting to requirements and standards in different industries and on various platforms are valuable assets for Blackvard customers.

He is repeatedly commended by customers for driving efficient solutions for complex problems in globally distributed team environments and meeting tough deadlines.

For further information please visit:

www.blackvard.com

Lukas M. Dietzsch

[email protected]

Copyright © Blackvard Management Consulting- All rights reserved www.blackvard.com

Managing Director

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Course Agenda: ABAP 7.4 What’s new?

What Will Be Covered In This Course:

1. Lesson 1 - Overview & General Information

a) ABAP 7.4 – Source Code Samples

b) ABAP Reports

2. Lesson 2 - New ABAP Development Tools e.g. in Eclipse (ADT / CDS)

a) Object-Orientation / Model View Controller (MVC)

b) MVC Sample Report

3. Lesson 3 - New ABAP Syntax & Development

a) Syntax: New great syntax options

b) Compliance: Advance Online Documentation with ABAP 7.4

4. Lesson 4 - Using Persistence Classes

* Please contact us for additional course details regarding lessons 2 – 4 & their schedules.*

* Please contact us for additional course details regarding lessons 2 – 4 & their schedules.*

Source: Blackvard Slide 6Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

SAP Reports - Background

Reports in SAP are used as a synonym for programs. Simple programming modules where a set of parameters are entered Program uses parameters to produce a report (interactive list)

The term “report” can be misleading; reports can also be designed to modify data. Called reports due to the “list-oriented” nature of output they produce

Reportvs.

(SAP Report)

Source: Blackvard Slide 7Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

SAP Reports - Background

Different types of programs: Executable Program, INCLUDE, Module Pool, Function Group, Subroutine, Interface, Class

Pool, Type Pool, XSLT Program

Structure of an SAP report: 1 declarations (e.g. data types, variables, constants, user interface, class definitions) 2 processing blocks (e.g. procedures, dialog modules) 3 calling processing blocks

Data Declaration Block

Processing Block

Event Blocks

Subroutines

Dialog Blocks

etc.

Source: Blackvard Slide 8Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

SAP Reports - Background

An ordinary ABAP report can be implemented with an old fashioned “Classical” top-down approach. Simple normal reports e.g. w/ only one output screen Does not contain any user interaction or sub reports Numerous lines of coding lead to user confusion “Spaghetti code” (e.g. thousands lines of code!) Hard to support Step 1

Step 2

Step 3

Step …n

Source: Blackvard Slide 9Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Object-oriented Reports

Object-oriented Reports are an easier & more elegant approach. Focus on objects that represent abstract/concrete objects in real world Objects are first defined by character & then by their properties

Represented by internal structure & attributes (data) Object behavior described by methods (functions) Form capsule combining characteristics

w/ behavior Users can map realistic problems Propose solutions on a one-to-one basis

Advantages: Complex systems easier to understand; better

representation of reality w/ encapsulation Easy to overview single methods - less alterations at other system points Reuse individual components Less maintenance effort

Source: Blackvard Slide 10Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Model View Controller Reports

Model View Controller (MVC) Reports – clear distinction between processing control, data model & interface displayed data. Areas distinguished by three objects – Model, View & Controller

Used in user interface programming field Enhancement of previous BSP implementation model Controller-based approach Ensures clear distinction between application logic &

presentation logic Structure & organize graphical interfaces into logical units

Model

View

Controller

Source: Blackvard Slide 11Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Model View Controller Reports

Advantages of Model View Controller (MVC) Reports Simplified application structures (View separate from Controller & Model) Option to generate program-driven layout Easier element navigation; reduces network traffic Same work process; create objects easier & save memory Distribute user interface into components Few redirects; optimized performance Intuitive & easy-to-use for application development

Model

View

Controller

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

The report itself consists of only three include objects. ZMY_REPORT_TOP (for TOP Include declarations) ZMY_REPORT_LCL (for local class definition &

implementation of the methods) ZMY_REPORT_RUN (starting the report)

Methods from the local class: The function call: CALL_FUNCTION To start the program: RUN_PROGRAM To show the results: SHOW_RESULT

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Structuring An SAP ABAP Report In An Optimal Way

Source: Blackvard Slide 13Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Globally used variables & structures are externalized in a TOP-Include. implementation of the local class:

Structuring An SAP ABAP Report In An Optimal Way

ZMY_REPORT_TOP

ZMY_REPORT_LCL

Source: Blackvard Slide 14Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Calling the report requires only the execution of “Run program” of the local class & e.g with an exception handling.

Sample Live-Coding…

Structuring An SAP ABAP Report In An Optimal Way

ZMY_REPORT_RUN

Source: Blackvard Slide 15Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

The functional part in the example report is about setting a value for the char50 variable & printing it in the SHOW_RESULT method. In this place, you could call FUBAs or other methods In the print method, you could show some ALV lists, for example

Structuring An SAP ABAP Report In An Optimal Way

Source: Blackvard Slide 16Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Here you can see the source code of the local class:

Structuring An SAP ABAP Report In An Optimal Way

CLASS lcl_my_report DEFINITION. PUBLIC SECTION. CLASS-METHODS run_program EXCEPTIONS prog_err. CLASS-METHODS call_function RETURNING VALUE(rv_name) TYPE char50. CLASS-METHODS show_result IMPORTING lv_name TYPE char50.

ENDCLASS.

"! Local service class implementationCLASS lcl_my_report IMPLEMENTATION.

METHOD run_program. DATA: lv_name TYPE char50.

call_function( RECEIVING rv_name = lv_name ).

show_result( lv_name ).

ENDMETHOD.

METHOD call_function. "! sample name rv_name = 'Oskar Mazerath'. ENDMETHOD.

METHOD show_result. WRITE: / lv_name. ENDMETHOD.

ENDCLASS.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Have Additional Questions?

Want To get trained?

Please Set Up A Consultation.

Email: [email protected]

Require A Consultation?

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Technical project lead and ABAP architect responsible for quality in technical scope and budget in a global roll-out of SAP Logistics applications (SAP LE / LO)

Conducting multiple SAP ABAP and SAP HANA® trainings for various US companies

Implementation of a standard SAP software solution for Spend Management within SAP AG & ARIBA (annual spend volume 3 Bill. EUR) which can be used in all SAP systems

Improved claims management using SAP FS-CM which is generating annual savings of 15 Mio € for a huge German public healthcare organization

Implemented a global solution for procurement processes at BMW AG using SAP SRM / B2B

Blueprinting and implementation of SAP software for banking credit cancelations for VOLKSWAGEN

Key Achievements of Blackvard Management Consulting in Previous Projects

What We’ve Accomplished

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

An overview of current and previous customers:

Customers That Recommend Blackvard