Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to use Select-options in ABAP OO?

I'm trying to convert my ABAP/4 program to ABAP OO, but I couldn't find any example how to use select-options in ABAP OO. All the example I could find worked with paramterers:-(

I'm on SAP R/3 46C...is there a demo program for this?

I'd like to convert an easy reporting program, where the data filling would happen in a method instead of a form, what I use normally in ABAP/4.

I didn't know how to define the selection screen, since it didn't accepted an internal table without header line....but I know internal table and header line/work area should be separated in ABAP OO :-(((

So my code, which I'm sure is incorrect....

  • internal table with header line:-(((((

TYPES: ty_catsdb TYPE STANDARD TABLE OF catsdb

             WITH NON-UNIQUE KEY zzaufnr zzvornr.

DATA: it_catsdb_p LIKE TABLE OF catsdb WITH HEADER LINE.

...

*eject

*=======================================================================

*             Selection screen

*=======================================================================

SELECTION-SCREEN BEGIN OF BLOCK sel WITH FRAME TITLE text-sb1.

SELECT-OPTIONS: so_aufnr FOR it_catsdb_p-zzaufnr

                      MEMORY ID aun

                      MATCHCODE OBJECT vmva, "Sales Order

                so_vornr FOR it_catsdb_p-zzvornr

                      MEMORY ID kpo, "Item

                so_pernr FOR it_catsdb_p-pernr

                      MEMORY ID per

                      MATCHCODE OBJECT prem. "Personnel Number

PARAMETERS: pa_date LIKE it_catsdb_p-laeda

                      DEFAULT sy-datum. "Entered date

SELECTION-SCREEN END OF BLOCK sel .

....

*----


*

*       CLASS lcl_catsdb_post DEFINITION

*----


*

*       ........ *

*----


*

CLASS lcl_catsdb_post DEFINITION.

  PUBLIC SECTION.

    CLASS-METHODS:

      fill_it_catsdb_post

      IMPORTING

           cl_aufnr LIKE so_aufnr

           cl_vornr LIKE so_vornr

           cl_pernr LIKE so_pernr

           cl_date LIKE pa_date

      RETURNING

          value(cl_it_catsdb_p) TYPE ty_catsdb.

ENDCLASS.

*----


*

*       CLASS lcl_catsdb_post IMPLEMENTATION

*----


*

*       ........ *

*----


*

CLASS lcl_catsdb_post IMPLEMENTATION.

  METHOD fill_it_catsdb_post.

    SELECT dzzaufnr dzzvornr d~pernr

         dworkdate dlaeda

         dmeinh dcatshours

         dstatus dcounter d~refcounter

         dkokrs dbelnr

         d~raufnr

         d~lstar

         c~transfer

    FROM catsdb AS d INNER JOIN catsco AS c

      ON dcounter = ccounter

    INTO CORRESPONDING FIELDS OF TABLE cl_it_catsdb_p

    WHERE d~zzaufnr <> space

      AND d~zzvornr <> space

      AND d~zzaufnr IN so_aufnr "Sales Order

      AND d~zzvornr IN so_vornr "Item

      AND d~laeda = pa_date "Changed On Date

      AND c~transfer = flagged "Transferred to CO

      AND d~pernr IN so_pernr. "Personnel Number

  ENDMETHOD.

ENDCLASS.

.....

*----


*

*   Main Program

*----


*

START-OF-SELECTION.

*--> Confirmation

  CALL METHOD lcl_catsdb_post=>fill_it_catsdb_post

  EXPORTING

     cl_aufnr = so_aufnr

     cl_vornr = so_vornr

     cl_pernr = so_pernr

     cl_date = pa_date

  RECEIVING

     cl_it_catsdb_p = it_catsdb_p[].

.....

Any idea how to correct this part of the code?

Thanks in advance,

Incho

Tags:
Not what you were looking for? View more on this topic or Ask a question