Application Development and Automation 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: 
Read only

Regarding object oriented

spandana_babu
Participant
0 Likes
680

Hi,

I am new to the oops concept..

i know how to write methods...

can any one guide to use these oops concept in *REPORTS*,&

hw can i implement (inheritance, polymorphism,& other concepts..)

can any one give sample report for using all oops concepts

how can implement the methods in Reports..

Thanks& Regards

Spandana

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
637

An excellent introduction is the following document:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d97...

You will find plenty of sample reports in the reuse library (transaction SE83) and in the Development Workbench Demos (transaction DWDM).

check out any example program starting with BCALV*

You can refer these documents also.

http://esnips.com/doc/b708766f-a934-42a1-8064-c4de75b48fc4/Sample-Program-of-alv-using-oops.ppt

http://esnips.com/doc/a2e42503-cf0f-4418-94ee-580f5900a81f/alv-with-oop.doc

http://esnips.com/doc/2d953590-e8c5-490c-a607-d1ab7cf517d7/ALV.pdf

3 REPLIES 3
Read only

Former Member
0 Likes
637

Hi,

refer some links.

www.sapgenie.com

www.abap4u.com

http://help.sap.com/saphelp_nw2004s/helpdata/en/5e/88d440e14f8431e10000000a1550b0/frameset.htm

download the PDF from following link.

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf

The ALV object Grid methods allow the same functionality as ALV grid report function modules but are displayed within

a screen (dialog program). SAP has provided a suit of programs which demonstrate how to For examples see standard SAP

programs as detailed below:

BCALV_EDIT_01 This report illustrates the simplest case of using an editable/noneditable ALV Grid Control.

BCALV_EDIT_02 This report illustrates how to set chosen cells of an ALV Grid Control editable.

BCALV_EDIT_03 In this example the user may change values of fields SEATSOCC (occupied seats) and/or PLANETYPE.

The report checks the input value(s) semantically and provides protocol messages in case of error

BCALV_EDIT_04 This report illustrates how to add and remove lines to a table using the ALV Grid Control and how to

implement the saving of the new data.

BCALV_EDIT_05 This example shows how to use checkboxes within an ALV Grid Control. You learn:

(1) how to define a column for editable checkboxes for an attribute of your list

(2) how to evaluate the checked checkboxes

(3) how to switch between editable and non-editable checkboxes

BCALV_EDIT_06 This example shows how to define a dropdown listbox for all cells of one column in an editable ALV

Grid Control.

BCALV_EDIT_07 This example shows how to define dropdown listboxes for particular cells of your output table.

regards,

Kiran Sure

Read only

Former Member
0 Likes
637

hi if you wants to use oo in reports than u can go for alv.there you can get alot of options for using oo.

as a sample look into the below report whcih used 00 for events and displaying the list.

&----


*& Report yi_amra_yiamraber *

*& *

&----


*& *

*& *

&----


report yi_amra_yiamraber no standard page heading.

tables: yiamra_ber,SWW_WI2OBJ.

include <icon>.

include <symbol>.

type-pools: slis.

class cl_gui_resources definition load.

constants: con_true type char1 value 'X',

con_on type char1 value '1',

con_off type char1 value '0',

con_exit like sy-ucomm value 'EXIT',

con_back like sy-ucomm value 'BACK',

con_canc like sy-ucomm value 'CANC'.

data: g_okcode type sy-ucomm,

g_container_d0100 type ref to cl_gui_custom_container,

g_container_name_d0100 type scrfname value 'D0100_CONTAINER',

g_grid_d0100 type ref to cl_gui_alv_grid.

DATA: objkey LIKE sweinstcou-objkey.

DATA: ls_ibfobject TYPE sibflporb.

data : v_WI_ID type SWW_WI2OBJ-WI_ID.

DATA BEGIN OF GT_yiamra_ber OCCURS 0 .

INCLUDE STRUCTURE yiamra_ber .

DATA cellstyles TYPE lvc_t_styl.

DATA text(28) TYPE c.

DATA printer(10) TYPE c.

DATA workflow(13) TYPE c.

DATA END OF GT_yiamra_ber .

DATA ls_style TYPE lvc_s_styl.

DATA: X_FIELDCAT TYPE LVC_S_FCAT.

DATA:L_POS TYPE I VALUE 1.

data: gs_layout TYPE lvc_s_layo.

***********************************************************************

  • class Definition.

***********************************************************************

CLASS lcl_event_handler DEFINITION .

PUBLIC SECTION .

METHODS:

*To control button clicks

handle_button_click

FOR EVENT button_click OF cl_gui_alv_grid

IMPORTING es_col_id

es_row_no.

*PRIVATE SECTION.

  • METHODS:

  • perform_copy_checks

  • IMPORTING

  • er_data_changed TYPE REF TO cl_alv_changed_data_protocol.

ENDCLASS. "lcl_event_handler DEFINITION

&----


*& Class (Implementation) lcl_event_handler

&----


  • Text

----


CLASS lcl_event_handler IMPLEMENTATION.

METHOD handle_button_click .

PERFORM handle_button_click USING es_col_id

es_row_no.

ENDMETHOD.

ENDCLASS. "lcl_event_handler

************************************************************************

  • Display Data

************************************************************************

start-of-selection.

end-of-selection.

call screen 0100.

&----


*& Module d0100_set_status OUTPUT

&----


  • text

----


module d0100_set_status output.

perform d0100_set_status.

endmodule. " d0100_set_status OUTPUT

&----


*& Module d0100_prepare_container OUTPUT

&----


  • text

----


module d0100_prepare_container output.

perform d0100_prepare_container.

endmodule. " d0100_prepare_container OUTPUT

&----


*& Module d0100_exit INPUT

&----


  • text

----


module d0100_exit input.

perform d0100_exit changing g_okcode.

endmodule. " d0100_exit INPUT

&----


*& Module d0100_fcode INPUT

&----


  • text

----


module d0100_fcode input.

perform d0100_fcode changing g_okcode.

endmodule. " d0100_fcode INPUT

&----


*& Form d0100_set_status

&----


  • text

----


form d0100_set_status.

set pf-status 'D0100' .

set titlebar 'D0100'.

SELECT * FROM yiamra_ber

INTO corresponding fields of TABLE GT_yiamra_ber

WHERE LFDNR IN LFDNR

AND POSNR IN POSNR

AND UNAME IN UNAME

AND ROLLE In ROLLE

AND PRCTR IN PRCTR

AND PRCTRGRP IN PRCTRGRP

AND KOSTL IN KOSTL

AND KOSTLGRP IN KOSTLGRP

AND ABRECHNST IN ABREC

AND ANFORDERER IN ANFORD

AND DATUMNEU IN DATUMU

AND DATUMANF IN DATUMA

AND STATUS IN STATUS

AND DATUMADM IN DATUM

AND DATUMBEG IN DATUMB

AND DATUMEND IN DATUME.

loop at gt_yiamra_ber.

CONCATENATE GT_yiamra_ber-lfdnr GT_yiamra_ber-posnr INTO objkey.

ls_ibfobject-catid = 'BO'.

ls_ibfobject-typeid = 'YIAMRAROLL'.

ls_ibfobject-instid = objkey.

clear v_WI_ID.

select single WI_ID from SWW_WI2OBJ into v_WI_ID where INSTID = objkey.

IF sy-subrc = 0.

ls_style-fieldname = 'WORKFLOW'.

ls_style-style = cl_gui_alv_grid=>mc_style_button.

INSERT ls_style INTO TABLE GT_yiamra_ber-cellstyles.

  • GT_yiamra_ber-anfordern = icon_workflow_event_producer.

  • GT_yiamra_ber-printer = icon_print.

GT_yiamra_ber-workflow = ICON_HISTORY.

endif.

ls_style-fieldname = 'TEXT' .

ls_style-style = cl_gui_alv_grid=>mc_style_button .

INSERT ls_style INTO TABLE gt_yiamra_ber-cellstyles.

GT_yiamra_ber-text = ICON_DISPLAY_TEXT.

MODIFY GT_yiamra_ber

INDEX sy-tabix

TRANSPORTING cellstyles Text workflow.

endloop.

endform. " d0100_set_status

&----


*& Form d0100_prepare_container

&----


  • text

----


form d0100_prepare_container.

data: ls_vari type disvariant,

lt_fcat type lvc_t_fcat.

DATA gr_event_handler TYPE REF TO lcl_event_handler .

DATA IT_UI_FUNCTIONS TYPE UI_FUNCTIONS.

APPEND '&DETAIL' TO IT_UI_FUNCTIONS.

if g_container_d0100 is initial.

create object g_container_d0100

exporting container_name = g_container_name_d0100.

create object g_grid_d0100

exporting i_parent = g_container_d0100.

CREATE OBJECT gr_event_handler .

SET HANDLER gr_event_handler->handle_button_click FOR g_grid_d0100 .

perform d0100_set_grid_vari changing ls_vari.

perform d0100_set_grid_fcat changing lt_fcat.

  • perform d0100_set_grid_fcat1 changing lt_fcat.

  • call method g_grid_d0100->INIT_TOOLBAR

  • EXPORTING

  • IT_TOOLBAR_EXCLUDING = IT_UI_FUNCTIONS.

*

call method g_grid_d0100->set_table_for_first_display

EXPORTING

is_layout = gs_layout

IT_TOOLBAR_EXCLUDING = IT_UI_FUNCTIONS

CHANGING

it_outtab = gt_yiamra_ber[]

it_fieldcatalog = lt_fcat.

call method cl_gui_control=>set_focus

EXPORTING

control = g_grid_d0100.

endif.

endform. " d0100_prepare_container

&----


*& Form d0100_exit

&----


  • text

----


form d0100_exit changing c_okcode type sy-ucomm.

data: l_okcode like sy-ucomm.

l_okcode = c_okcode.

clear c_okcode.

case l_okcode.

when con_exit or con_back or con_canc.

call method g_grid_d0100->free.

call method g_container_d0100->free.

call method cl_gui_cfw=>flush.

clear g_container_d0100.

clear g_grid_d0100.

set screen 0.

leave screen.

endcase.

endform. " d0100_exit

&----


*& Form d0100_fcode

&----


  • text

----


form d0100_fcode changing c_okcode type sy-ucomm.

data: l_okcode like sy-ucomm.

l_okcode = c_okcode.

clear c_okcode.

call method cl_gui_cfw=>dispatch.

case l_okcode.

when con_exit or con_back or con_canc.

call method g_container_d0100->free.

call method cl_gui_cfw=>flush.

clear g_container_d0100.

clear g_grid_d0100.

set screen 0.

leave screen.

endcase.

endform. " d0100_fcode

&----


*& Form d0100_set_grid_fcat

&----


  • text

----


form d0100_set_grid_fcat changing ct_fcat type lvc_t_fcat.

data: ls_fcat type lvc_s_fcat.

gs_layout-stylefname = 'CELLSTYLES'.

*+++ STEP 1: retrieve the fieldcatalog

  • call function 'LVC_FIELDCATALOG_MERGE'

  • EXPORTING

  • i_structure_name = 'YIAMRA_BER'

  • CHANGING

  • ct_fieldcat = ct_fcat[]

  • EXCEPTIONS

  • inconsistent_interface = 1

  • program_error = 2

  • others = 3.

  • if sy-subrc eq 0.

*+++ STEP 2: modify the fieldcatalog.

  • loop at ct_fcat into ls_fcat.

clear ls_fcat.

ls_fcat-fieldname = 'LFDNR' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'LFDNR' .

APPEND LS_FCAT TO CT_FCAT.

clear ls_fcat.

ls_fcat-fieldname = 'POSNR' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'POSNR' .

APPEND LS_FCAT TO CT_FCAT.

clear ls_fcat.

ls_fcat-fieldname = 'UNAME' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'UNAME' .

APPEND LS_FCAT TO CT_FCAT.

clear ls_fcat.

ls_fcat-fieldname = 'ROLLE' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'ROLLE' .

APPEND LS_FCAT TO CT_FCAT.

clear ls_fcat.

ls_fcat-fieldname = 'PRCTR' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'PRCTR' .

APPEND LS_FCAT TO CT_FCAT.

clear ls_fcat.

ls_fcat-fieldname = 'PRCTRGRP' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'PRCTRGRP' .

APPEND LS_FCAT TO CT_FCAT.

clear ls_fcat.

ls_fcat-fieldname = 'KOSTL' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'KOSTL' .

APPEND LS_FCAT TO CT_FCAT.

clear ls_fcat.

ls_fcat-fieldname = 'KOSTLGRP' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'KOSTLGRP' .

APPEND LS_FCAT TO CT_FCAT.

clear ls_fcat.

ls_fcat-fieldname = 'ABRECHNST' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'ABRECHNST' .

APPEND LS_FCAT TO CT_FCAT.

clear ls_fcat.

ls_fcat-fieldname = 'ANFORDERER' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'ANFORDERER' .

APPEND LS_FCAT TO CT_FCAT.

clear ls_fcat.

ls_fcat-fieldname = 'DATUMNEU' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'DATUMNEU' .

APPEND LS_FCAT TO CT_FCAT.

clear ls_fcat.

ls_fcat-fieldname = 'DATUMANF' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'DATUMANF' .

APPEND LS_FCAT TO CT_FCAT.

clear ls_fcat.

ls_fcat-fieldname = 'STATUS' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'STATUS' .

APPEND LS_FCAT TO CT_FCAT.

clear ls_fcat.

ls_fcat-fieldname = 'DATUMADM' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'DATUMADM' .

APPEND LS_FCAT TO CT_FCAT.

clear ls_fcat.

ls_fcat-fieldname = 'DATUMBEG' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'DATUMBEG' .

APPEND LS_FCAT TO CT_FCAT.

clear ls_fcat.

ls_fcat-fieldname = 'DATUMEND' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'DATUMEND' .

APPEND LS_FCAT TO CT_FCAT.

clear ls_fcat.

ls_fcat-fieldname = 'WORKFLOW' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'WORKFLOW'.

ls_fcat-icon = 'X'.

APPEND LS_FCAT TO CT_FCAT.

clear ls_fcat.

ls_fcat-fieldname = 'TEXT' .

ls_fcat-outputlen = '10' .

ls_fcat-coltext = 'TEXT' .

ls_fcat-icon = 'X'.

APPEND LS_FCAT TO CT_FCAT.

  • modify ct_fcat from ls_fcat.

  • endloop.

  • endif.

endform. " d0100_set_grid_fcat

&----


*& Form d0100_set_grid_vari

&----


  • text

----


form d0100_set_grid_vari changing cs_vari type disvariant.

*+++ allow layout maintenance

*+++ note report is compelling

  • cs_vari-report = .

  • cs_vari-handle = .

  • cs_vari-log_group = .

  • cs_vari-username = .

  • cs_vari-variant = .

  • cs_vari-text = .

  • cs_vari-dependvars = .

endform. " d0100_set_grid_vari

&----


*& Form handle_button_click

&----


  • text

----


  • -->P_ES_COL_ID text

  • -->P_ES_ROW_NO text

----


FORM handle_button_click USING P_ES_COL_ID TYPE lvc_s_col

P_ES_ROW_NO TYPE lvc_s_roid.

DATA: objkey LIKE sweinstcou-objkey.

DATA: ls_ibfobject TYPE sibflporb.

DATA: BEGIN OF ls_output OCCURS 0 .

INCLUDE STRUCTURE yiamra_ber .

DATA cellstyles TYPE lvc_t_styl.

DATA text(28) TYPE c.

DATA printer(10) TYPE c.

DATA workflow(13) TYPE c.

DATA END OF ls_output.

READ TABLE GT_yiamra_ber INDEX p_es_row_no-row_id INTO ls_output.

IF sy-subrc <> 0.

RETURN.

ENDIF.

case P_ES_COL_ID-fieldname.

when 'TEXT'.

IF GT_yiamra_ber-rolle IS NOT INITIAL.

CALL FUNCTION 'Y_I_AMRA_ROLLE_TEXT'

EXPORTING

i_rolle = GT_yiamra_ber-rolle.

endif.

when 'WORKFLOW'.

clear: objkey.

IF sy-subrc = 0 AND p_es_col_id-fieldname = 'WORKFLOW'.

CONCATENATE ls_output-lfdnr ls_output-posnr INTO objkey.

ls_ibfobject-catid = 'BO'.

ls_ibfobject-typeid = 'YIAMRAROLL'.

ls_ibfobject-instid = objkey.

CALL FUNCTION 'SWI_WF_CONNECTIONS_DISPLAY'

EXPORTING

ibf_object = ls_ibfobject

EXCEPTIONS

not_found = 1

no_authority = 2

no_workflows_found = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

endif.

endcase.

ENDFORM. " handle_button_click

reward points if anwer is helpful

Read only

Former Member
0 Likes
638

An excellent introduction is the following document:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d97...

You will find plenty of sample reports in the reuse library (transaction SE83) and in the Development Workbench Demos (transaction DWDM).

check out any example program starting with BCALV*

You can refer these documents also.

http://esnips.com/doc/b708766f-a934-42a1-8064-c4de75b48fc4/Sample-Program-of-alv-using-oops.ppt

http://esnips.com/doc/a2e42503-cf0f-4418-94ee-580f5900a81f/alv-with-oop.doc

http://esnips.com/doc/2d953590-e8c5-490c-a607-d1ab7cf517d7/ALV.pdf