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: 

How to call method in report

Former Member
0 Kudos

Hi all,

i am new to object oriented i have idea abt class and methods..i want to know how we can call method in report..

for ex::

  • CALL METHOD g_grid->set_table_for_first_display

  • EXPORTING i_structure_name = 'kna1'

  • is_layout = gs_layout

  • CHANGING it_outtab = gt_outtab.

if this method i need to call then how should i do that..

to call fnction module we use pattern..so how we call method..

plz help

regards

anu

5 REPLIES 5

former_member181962
Active Contributor
0 Kudos

press pattern and choose radio-button for ooabap pattern.

former_member583013
Active Contributor
0 Kudos

Here's a small example -:)


*******************************************************
* Programa: Z_OBJECTS_ALV_EXAMPLE.                    *
* Consultor ABAP: Alvaro Tejada Galindo - ActualiSAP  *
* Fecha: 12.04.2005                                   *
* Descripción: Reporte ALV con ABAP Objects.          *
*******************************************************

REPORT Z_OBJECTS_ALV_EXAMPLE.

DATA: OK_CODE TYPE SY-UCOMM.
DATA: SPFLI_TAB TYPE TABLE OF SPFLI.

DATA: CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
      ALV_LIST TYPE REF TO CL_GUI_ALV_GRID.

SELECT *
FROM SPFLI
INTO CORRESPONDING FIELDS OF TABLE SPFLI_TAB.

CREATE OBJECT CONTAINER
       EXPORTING CONTAINER_NAME = 'LIST_AREA'.

CREATE OBJECT ALV_LIST
       EXPORTING I_PARENT = CONTAINER.


CALL METHOD ALV_LIST->SET_TABLE_FOR_FIRST_DISPLAY(
                      EXPORTING I_STRUCTURE_NAME = 'SPFLI'
                      CHANGING IT_OUTTAB = SPFLI_TAB ).


CALL SCREEN 100.


MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS '100'.
ENDMODULE.

MODULE USER_COMMAND_0100 INPUT.
OK_CODE = SY-UCOMM.
  IF OK_CODE = 'BACK'.
      SET SCREEN 0.
      LEAVE SCREEN.
      CLEAR OK_CODE.
  ENDIF.
ENDMODULE.

Greetings,

Blag.

Message was edited by: Alvaro Tejada Galindo

LucianoBentiveg
Active Contributor
0 Kudos

You can use pattern too, just click on pattern button and select "abap object pattern" (under "call function")

Regards.

Former Member
0 Kudos

Hi Anu,

We can call method in a similar fashion as you do with FMs.

Click on Ctrl+F6(Pattern). Click on the radio button

"ABAP Object Pattern".Press enter.

Now you can have following options

1.Call a method

2.Create an object

3.Raise an Event

4.In 4.7EE, you can Raise an exception also.

Hope your query is solved.

Regards,

SP.

Former Member
0 Kudos

click on the patterns on the application tool bar

then on the popup select ABAP OBJECT PATTERNS radio button.

then u will see the screen which asks you the class name & method name, if you give them , all of its parameters pasted in the abap program

regards

srikanth