Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Can we create complete report in OOPs

Former Member
0 Kudos

Hi,

Could you please advice if we can code the complete report in SE24 and call it in SE38 report..

For ex. I have a report followed by ALV output..now can i write everything in a Z Object (from decalration to output ) ..

Kindly suggest if it is a good strategy than simply using standard objects in report editor.

If possible, request you to provide a sample report using complete OOPs approach.

Thanks,

Gaurav

6 REPLIES 6

Former Member
0 Kudos

Hi Gurav,

You cannot call a selection Screen in an ABAP Class. So, you will not be able to do the Data Selection. You can call function modules, other classes in a method.

You can create a Transaction Code from a Method. So, in a way you are rather restricted with the ABAP Methods.

I think you can use the ABAP Reports and in it you can use ABAP Objects extensively. This will be a good mixture of modern ABAP OOP's approach and will give a lot of flexibility of classical ABAP.

You can check a lot of ABAP Objects Examples from the DEMO Programs.

Hope this helps.

Thanks,

Samantak.

Former Member
0 Kudos

Yes...the entire thing, INCLUDING SELECTION SCREEN, can be written in OO. I haven't tried building the whole thing in SE24, then executing....what's the point? A report may be pretty much one-off, but utilize pieces of classes.

SAP Press recent manual "Official ABAP Progamming Guidlines" contains an example using Separation of Concerns/Software Layering approach that includes a selection screen call in the Presentation layer. It can be done! What I don't see is an easy or elegant way to re-process the selection screen if I must reject what the user has input and get different values....

In that program, BTW, the start of selection event contains only:

report->main( ).

Main might look like:

(from my program, not their version). E-me if you want the entire program.

class report definition.
  public section.
    class-methods main.
endclass.                    "report DEFINITION
class report implementation.
  method main.
    data: gt_itab   type table of gtyp_itab,
          so_tstmp  type table of iseldats,
          rpt_tab   type table of gtyp_rpt.
    data: rc      type sy-subrc.

    gui_level=>get_input_parms( ).  "calls selection screen!
    gui_level=>create_date_table(
             changing so_tstmp = so_tstmp ).
    persistence_level=>get_data_from_db(
                  exporting so_tstmp = so_tstmp
                  importing gt_itab = gt_itab
                                 rc = rc ).
    if rc eq 0.
      apps_level=>sort_itab(
              changing gt_itab = gt_itab ).
      apps_level=>build_report_table(
              changing gt_itab = gt_itab
                       rpt_tab = rpt_tab ).
      if sy-subrc eq 0.
        gui_level=>display_alv_form( rpt_tab  ).
      endif.
    endif.
  endmethod.                    "main
endclass.                    "report IMPLEMENTATION

0 Kudos

Hi Breakpoint - I would be very interested in seeing the rest of this implementation as getting an OO selection-screen (or near approximation) is something I'm really struggling with.

Thanks!

matt
Active Contributor
0 Kudos

I suggest you post your question as a new discussion, detailing where you are struggling.

Clemenss
Active Contributor
0 Kudos

Hi Dave,

seems to be interesting.

I know you can not do a CALL SCREEN in OO context. There are a couple of implicit events defined for a source include of type executable program like

INITIALIZATION
START-OF-SELECTION
GET
END-OF-SELECTION
AT SELECTION-SCREEN OUTPUT
AT SELECTION-SCREEN ON VALUE-REQUEST
AT SELECTION-SCREEN ON HELP-REQUEST
AT SELECTION-SCREEN ON f
AT SELECTION-SCREEN ON BLOCK
AT SELECTION-SCREEN ON RADIOBUTTON GROUP
AT SELECTION SCREEN
AT SELECTION SCREEN ON END OF f
TOP-OF-PAGE
END-OF-PAGE
AT LINE-SELECTION
AT PFnn
AT USER-COMMAND

Usually I try to instantiate a report object with INITIALIZATION event and then call specific methods for the events used.

The values of (globally defined) PARAMETERS and SELECT-OPTIONS can be transferred back and forth using methods called at selection-screen events. In the class we can get the values using dynamic ASSIGN in sy-cprog.

Benny G. Sørensen gave us a nice [oo reoort example|;. See the whole thread to come from academic dispute to practical application.

I'd like to see your definition of gui_level and persistence_level classes.

Regards,

Clemens

Clemenss
Active Contributor
0 Kudos

Hi Gaurav,

small addition: Use SE80 and you will never have to think about anything else. You can use SE80 as a replacement for SE24, SE38, SE11, SE12, SE85, SE09 and many more. You have almost all repository objects in one transaction, direct access to repository info system and transport management system, what else do you need?

I think there is exactly no reason at all to use SE38 except not being willing and able to make some progress.

You need SE24 if you want to create a dictionary class from local report or function pool class, at least I could not find out how to do this from SE80 directly.

Regards,

Clemens