Skip to Content
author's profile photo Former Member
Former Member

ABAP oo problem

Hi all

I'm try to start with abap oo and have problem with code below.

When i generate this all is ok.

When try to activate there is error

Statement 'LDB->read_spfli()' is not defined . please check your ...

Anyone help ?

PS. Using SAP 46c

Regards

Bartek.

report test.

----


  • CLASS ldb DEFINITION

----


  • ........ *

----


class ldb definition.

public section.

methods read_spfli.

events spfli_ready exporting value(values) type spfli.

private section.

data: spfli_wa type spfli.

endclass.

----


  • CLASS ldb IMPLEMENTATION

----


  • ........ *

----


class ldb implementation.

method read_spfli.

select * from spfli into spfli_wa.

raise event spfli_ready exporting values = spfli_wa.

endselect.

endmethod.

endclass.

----


  • CLASS report DEFINITION

----


  • ........ *

----


class report definition.

public section.

methods start.

private section.

data spfli_tab type table of spfli.

methods: get_spfli for event spfli_ready of ldb

importing values,

display_spfli.

endclass.

----


  • CLASS report IMPLEMENTATION

----


  • ........ *

----


class report implementation.

method start.

data ldb type ref to ldb.

create object ldb.

set handler me->get_spfli for ldb.

ldb->read_spfli().

display_spfli().

endmethod.

method get_spfli.

append value to spfli_tab.

endmethod.

method display_spfli.

write:/ 'display_spfli'.

endmethod.

endclass.

Message was edited by: Bartek Szmajdzinski

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 08, 2004 at 12:14 PM

    Hi

    I get this code from

    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/eight reasons why every abap developer should give abap objects a second look.pdf

    and i think it should be work without

    start-of-selection.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      <i>There are no issues with LDB, but in case I need to use SELECT-OPTIONS and PARAMETERS in an OO Transaction, how do I proceed ?</i>

      aah, once again in a hurry, just saw the appendix and it is clearly mentioned to decouple selection-screen and application logic. Thanks again.

      Regards,

      Subramanian V.

      Message was edited by: Subramanian Venkateswaran

  • author's profile photo Former Member
    Former Member
    Posted on Dec 08, 2004 at 11:53 AM

    Also include:

    Changes to code:

    1)

    START-OF-SELECTION.
    CALL METHOD report=>start.
    

    2)

    class report definition.
    public section.
    class-methods start.
    methods: get_spfli for event spfli_ready of ldb
    private section.
    data spfli_tab type table of spfli.
    importing values,
    display_spfli.
    endclass.
    
    

    Regards,

    Subramanian V.

    Refer to Serdar's message below and also program DEMO_ABAP_OBJECTS

    Message was edited by: Subramanian Venkateswaran

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 08, 2004 at 11:55 AM

    Hi Bartek

    In ABAP OO, we call methods by the following statement:

    CALL METHOD <obj_ref>-><method_name>
      EXPORTING
    <Parameters to export>
      IMPORTING
    <Parameters to import>
      EXCEPTIONS
    <exceptions> .

    Just like calling function modules. If the method does not have any parameters, you can say

    CALL METHOD <obj_ref>-><method_name>() .

    According to your needs, use

    CALL METHOD ldb->read_spfli().

    *--Serdar

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.