Skip to Content
0
Former Member
Nov 23, 2012 at 08:41 AM

Simple Report using oops

35 Views

Hi Experts,

Am trying to display simple reprt using report, actually i dnt want to displayy using oops through module pool programming.

please look my below code. am not able to dispaly the report.

plz correct.

tables: vbak.

types: begin of ty_data,
vbeln type vbeln,
auart type AUART, " Sales Document Type
vkorg type VKORG, "Sales Organization
* VTWEG type VTWEG, "Distribution Channel
* SPART type SPART, "Ditvision
end of ty_data.
data: it_data type table of ty_data,
wa_data like line of it_data,
it_fcat type LVC_T_FCAT,
wa_fcat type LVC_S_FCAT.
* gv_repid TYPE sy-repid,
* gv_dynnr TYPE sy-dynnr.
data: oref_cc type ref to cl_gui_container,
* oref_dc type ref to cl_gui_docking_container,
oref_grid type ref to cl_gui_alv_grid.
select-options s_vbeln for vbak-vbeln obligatory.
start-of-selection.
perform preapre_data.
*perform prepare_layout.
perform prepare_fieldcatalog.
perform display_alv.
*&---------------------------------------------------------------------*
*& Form PREAPRE_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM PREAPRE_DATA .
select vbeln auart vkorg from vbak
into table it_data
where vbeln in s_vbeln.
if it_data[] is initial.
leave to list-processing.
endif.
ENDFORM. " PREAPRE_DATA
*&---------------------------------------------------------------------*
*& Form PREPARE_LAYOUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM PREPARE_LAYOUT .

ENDFORM. " PREPARE_LAYOUT
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DISPLAY_ALV .

CREATE OBJECT OREF_GRID
EXPORTING
I_PARENT = CL_GUI_CUSTOM_CONTAINER=>DEFAULT_SCREEN.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD OREF_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
* IS_VARIANT =
* I_SAVE = 'X'
I_DEFAULT = 'X'
* IS_LAYOUT =
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
* IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = it_data
IT_FIELDCATALOG = it_fcat
* IT_SORT =
* IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 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.

oref_grid->refresh_table_display( ).

ENDFORM. " DISPLAY_ALV
*&---------------------------------------------------------------------*
*& Form PREPARE_FIELDCATALOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM PREPARE_FIELDCATALOG .
wa_fcat-tabname = 'IT_DATA'.
wa_fcat-fieldname = 'VBELN' .
wa_fcat-outputlen = '6' .
wa_fcat-coltext = 'Sales Order'.
append wa_fcat to it_fcat.
clear wa_fcat.
wa_fcat-tabname = 'IT_DATA'.
wa_fcat-fieldname = 'AUART' .
wa_fcat-outputlen = '12' .
wa_fcat-coltext = 'Sales Doc Type'.
append wa_fcat to it_fcat.
clear wa_fcat.
wa_fcat-tabname = 'IT_DATA'.
wa_fcat-fieldname = 'VKORG' .
wa_fcat-outputlen = '12' .
wa_fcat-coltext = 'Sales Orga'.
append wa_fcat to it_fcat.
clear wa_fcat.
ENDFORM. " PREPARE_FIELDCATALOG