Skip to Content
0
Feb 13, 2015 at 03:24 PM

Displaying empty alv screen in oops alv report

699 Views

HI Experts,

i am new to oops alv , i am trying to create an simple oops alv report , but the output is showing empty screen as screen shot.

i created an container and used basic oops classes to display an alv report, but not understanding where i am wrong.needed help.

*&---------------------------------------------------------------------*
*& Report ZPS_REVVSWBS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZPS_REVVSWBS.

TYPES :BEGIN OF ty_proj,
pspnr TYPE proj-pspnr,
PSPID TYPE proj-pspid,
POST1 TYPE proj-post1,
objnr TYPE proj-objnr,
END OF ty_proj.



TYPES : BEGIN OF ty_prps,
pspnr TYPE prps-pspnr,
posid TYPE prps-post1,
objnr type prps-objnr,
psphi TYPE prps-psphi,
poski TYPE prps-poski,
pkokr TYPE prps-pkokr,
STUFE TYPE prps-stufe,
FAKKZ TYPE prps-fakkz,
END OF ty_prps.

TYPES :BEGIN OF ty_rpsco,
objnr TYPE rpsco-objnr,
lednr TYPE rpsco-lednr,
wrttp type rpsco-wrttp,
trgkz TYPE rpsco-wrttp,
gjahr TYPE rpsco-gjahr,
acpos TYPE rpsco-acpos,
WLP00 TYPE BP_WPL,
WLP01 TYPE BP_WPL,
WLP02 TYPE BP_WPL,
WLP03 TYPE BP_WPL,
WLP04 TYPE BP_WPL,
WLP05 TYPE BP_WPL,
WLP06 TYPE BP_WPL,
WLP07 TYPE BP_WPL,
WLP08 TYPE BP_WPL,
WLP09 TYPE BP_WPL,
WLP10 TYPE BP_WPL,
WLP11 TYPE BP_WPL,
WLP12 TYPE BP_WPL,
WLP13 TYPE BP_WPL,
WLP14 TYPE BP_WPL,
WLP15 TYPE BP_WPL,
WLP16 TYPE BP_WPL,
pspnr TYPE prps-pspnr,
END OF ty_rpsco.



data : it_final TYPE TABLE OF ty_final,
w_final TYPE ty_final.

data:it_proj TYPE TABLE OF ty_proj,
wa_proj TYPE ty_proj.
data :it_prps TYPE TABLE OF ty_prps,
wa_prps type ty_prps.
DATA :it_rpsco TYPE TABLE OF ty_rpsco,
wa_rpsco TYPE ty_rpsco.
data :ind TYPE sy-tabix.

data:it_fieldcat TYPE lvc_t_fcat ,
ty_fieldcat TYPE lvc_s_fcat .

DATA : alv_grid TYPE REF TO cl_gui_alv_grid,
ty_lay TYPE lvc_s_layo.
data :alv_container TYPE REF TO cl_gui_custom_container.

TABLES :proj,prps.
SELECTION-SCREEN : BEGIN OF BLOCK b1.
PARAMETERS : p_pspid TYPE proj-pspid .
select-OPTIONS :p_pspnr for prps-pspnr NO INTERVALS.
PARAMETERS :p_gjahr TYPE gjahr OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK b1.

AT SELECTION-SCREEN on p_pspid.


if p_pspid is NOT INITIAL and p_pspid ne '*'.
SELECT SINGLE pspnr pspid post1 objnr from proj into wa_proj WHERE pspid = p_pspid .
if wa_proj is INITIAL.
MESSAGE 'Project defination Does Not Exist' TYPE 'E'.
ENDIF.
endif.

AT SELECTION-SCREEN.
if p_pspid is NOT INITIAL and p_pspnr is NOT INITIAL.
MESSAGE 'Enter any one' TYPE 'I'.
ENDIF.

START-OF-SELECTION.
SELECT pspnr posid objnr psphi poski pkokr stufe fakkz into TABLE it_prps from prps where
pspnr in p_pspnr and pkokr = '1000' and stufe = '5' and fakkz = 'X'.
if it_prps IS NOT INITIAL.
SELECT objnr lednr wrttp trgkz gjahr acpos WLP00 WLP01 WLP02 WLP03 WLP04 WLP05 WLP06 WLP07 WLP08 WLP09 WLP10 WLP11 WLP12
WLP13 WLP14 WLP15 WLP16
from rpsco INTO TABLE it_rpsco FOR ALL ENTRIES IN it_prps
WHERE
objnr = it_prps-objnr and wrttp = '04' and gjahr = p_gjahr and acpos = 'YS0030'.
endif.

if it_rpsco is INITIAL.
MESSAGE ' Data does not Exist' TYPE 'E' .
ENDIF.



call SCREEN 0100.




*&---------------------------------------------------------------------*
*& Form ALV_FIELDCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM ALV_FIELDCAT .
CLEAR ty_fieldcat.
* ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 1.
ty_fieldcat-fieldname = 'PSPNR'.
ty_fieldcat-tabname = 'IT_RPSCO'.
ty_fieldcat-coltext = 'WBS'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.

ty_fieldcat-col_pos = 2.
ty_fieldcat-fieldname = 'WLP00'.
ty_fieldcat-tabname = 'IT_RPSCO'.
ty_fieldcat-coltext = 'Carry Forward'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.

ty_fieldcat-col_pos = 3.
ty_fieldcat-fieldname = 'WLP01'.
ty_fieldcat-tabname = 'IT_RPSCO'.
ty_fieldcat-coltext = 'Period 1'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.


ty_fieldcat-col_pos = 3.
ty_fieldcat-fieldname = 'WLP02'.
ty_fieldcat-tabname = 'IT_RPSCO'.
ty_fieldcat-coltext = 'Period 2'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.


ty_fieldcat-col_pos = 4.
ty_fieldcat-fieldname = 'WLP03'.
ty_fieldcat-tabname = 'IT_RPSCO'.
ty_fieldcat-coltext = 'Period 3'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.

ty_fieldcat-col_pos = 5.
ty_fieldcat-fieldname = 'WLP04'.
ty_fieldcat-tabname = 'IT_RPSCO'.
ty_fieldcat-coltext = 'Period 4'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.






ENDFORM. " ALV_FIELDCAT
*&---------------------------------------------------------------------*
*& Form ALV_DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM ALV_DISPLAY .
* DATA : c_alv TYPE REF TO cl_gui_alv_grid.
* CREATE OBJECT c_alv.
CALL METHOD ALV_grid->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
is_layout = ty_lay
CHANGING
it_outtab = it_RPSCO[]
it_fieldcatalog = it_fieldcat.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " ALV_DISPLAY
*&---------------------------------------------------------------------*
*& Form ALV_LAYOUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM ALV_LAYOUT .
ty_laY-grid_title = 'TABLES'.
ty_lay-zebra = 'X'.

ty_lay-no_toolbar = 'X'.
ENDFORM. " ALV_LAYOUT
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS '0100'.
SET TITLEBAR '0100'.


ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.

WHEN 'BACK' OR 'CANC' or 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Module ALV_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE ALV_0100 OUTPUT.
*create controlsd

create OBJECT alv_container
EXPORTING container_name = 'ALV_CONTAINER'.
*

CREATE OBJECT ALV_GRID
EXPORTING I_parent = ALV_CONTAINER.

*populating fieldcatlog
PERFORM alv_fieldcat.
*alv layout
PERFORM ALV_LAYOUT.
*alv display
PERFORM aLV_DISPLAY.
ENDMODULE. " ALV_0100 OUTPUT




Attachments

Capture.JPG (40.5 kB)