‎2007 Oct 03 11:45 AM
Hi,
I am doing oops alv. The following code is not showing any syntax error.But output shown blank screen.
parameters : p_vbeln like vbrp-vbeln.
*----------------------------------------------------------------------*
* CLASS c1 DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class c1 definition.
public section.
methods : constructor importing cust_cont type char10 optional.
methods : get_data importing p_vbeln type vbeln,
show_data.
private section.
data : o_cont type ref to cl_gui_custom_container,
o_grid type ref to cl_gui_alv_grid,
it_vbrp type table of vbrp.
endclass. "c1 DEFINITION
*----------------------------------------------------------------------*
* CLASS c1 IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class c1 implementation.
method : constructor.
*--linking the screen custom control class to custom container.
create object o_cont
exporting
container_name = 'CUST_CONT'.
*--linking custom container as a part of alv grid class object
*show that grid will sit on screen custom container as the custom
*container is alread link with the custom control.
create object o_grid
exporting
i_parent = o_cont.
endmethod. ":
*--Get billing items
method get_data.
select * from vbrp into table it_vbrp
where matnr = p_vbeln.
if not it_vbrp is initial.
call method show_data.
endif.
endmethod. ":
*--show alv grid
method show_data.
call method o_grid->set_table_for_first_display
exporting
i_structure_name = 'VBRP'
* IS_VARIANT =
* I_SAVE =
* 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_vbrp
* IT_FIELDCATALOG =
* 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.
endmethod. "show_data
endclass. ":
data : obj type ref to c1.
start-of-selection.
set screen 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
module status_0100 output.
set pf-status 'MENU'.
if obj is initial.
create object obj
exporting cust_cont = 'INV_CONT'.
call method obj->get_data
exporting
p_vbeln = p_vbeln.
endif.
endmodule. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
module user_command_0100 input.
case sy-ucomm.
when 'BACK' or 'EXIT'.
leave program.
endcase.
endmodule. " USER_COMMAND_0100 INPUTRegards
Srinu
‎2007 Oct 03 11:48 AM
Hav u checked that the internal table passed to ALV contains data ?
‎2007 Oct 03 11:49 AM
are you sure that you have created a custom control on screen and name of it is 'CUST_CONT'..
Regards
Anuj Goyal
‎2007 Oct 03 12:01 PM
‎2007 Oct 03 12:07 PM
Hi,
Now i am getting output. I given wrong custom control name earlier. Now i changed.
Thanks for your response
Srinu
‎2007 Oct 03 11:49 AM
‎2007 Oct 03 11:49 AM
try putting break point at the select and check data is coming into it_vbrp or not.
no need to put the structure name 'vbrp'.
hey sorry u right, as u r not giving fieldcat , u r giving structure name. thats correct.
check whether the containet name is same or not also.
Message was edited by:
Hymavathi Oruganti
‎2007 Oct 03 11:52 AM