‎2007 Aug 09 4:14 PM
‎2007 Aug 09 4:20 PM
Create a prog called ZR_COLORS and add this code.
Then create a screen 100 for prog ZR_COLORS and add a custom control called 'CUSTOM_GRID_CONTAINER'.
Run it.
REPORT ZR_Colors.
data: begin of i_vbak2 occurs 0.
include structure vbak.
data: end of i_vbak2.
data: begin of i_vbak occurs 0.
include structure vbak.
data: cellcolors type lvc_t_scol. " note that is an int table within
data: end of i_vbak. " an int table !!!
types: begin of r_vbak.
include structure vbak.
types: cellcolors type lvc_t_scol.
types: end of r_vbak.
data: i_vbak_out type table of r_vbak.
data: cellcolor type lvc_s_scol.
data: layout type LVC_S_LAYO.
data: grid1 type ref to cl_gui_alv_grid,
field_catalog type lvc_t_fcat,
grid1_container type ref to cl_gui_custom_container.
data: lt_fieldcat type LVC_T_FCAT.
data: wa_fieldcat type LVC_s_FCAT.
start-of-selection.
select * from vbak into table i_vbak2
where erdat > '20041201'
and erdat < '20041216'.
loop at i_vbak2.
move-corresponding i_vbak2 to i_vbak.
append i_vbak.
endloop.
layout-edit = 'X'.
layout-zebra = 'X'.
layout-cwidth_opt = 'X'.
Set first cell in Net value column.
read table i_vbak index 2.
cellcolor-fname = 'NETWR'.
cellcolor-color-col = '3'.
cellcolor-color-int = '1'.
cellcolor-NOKEYCOL = 'X'.
append cellcolor to i_vbak-cellcolors.
modify i_vbak index 2.
Set 2nd cell in Net value column.
read table i_vbak index 4.
cellcolor-fname = 'NETWR'.
cellcolor-color-col = '6'.
cellcolor-color-int = '1'.
cellcolor-NOKEYCOL = 'X'.
append cellcolor to i_vbak-cellcolors.
modify i_vbak index 4.
Identify the internal table name with the colors reference.
layout-CTAB_FNAME = 'CELLCOLORS'.
Instantiate the grid container.
create object grid1_container
exporting
container_name = 'CUSTOM_GRID_CONTAINER'.
Instantiate the grid itself within the container.
create object grid1
exporting
i_parent = grid1_container
i_appl_events = 'X'.
i_vbak_out[] = i_vbak[].
layout-frontend = 'E'.
data: lt_exclude type ui_functions.
data: r_exclude type ui_func.
r_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
append r_exclude to lt_exclude.
Call method of grid1 class object to build/display the grid.
call method grid1->set_table_for_first_display
EXPORTING i_structure_name = 'VBAK'
IT_TOOLBAR_EXCLUDING = lt_exclude
is_layout = layout
changing
it_outtab = i_vbak_out.
it_fieldcatalog = lt_fieldcat.
call screen '0100'.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'E100'.
SET TITLEBAR '100'.
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE USER_COMMAND_0100 INPUT.
case sy-ucomm.
when 'EXIT' or 'BACK' or 'CANCEL'.
leave program.
endcase.
ENDMODULE. " USER_COMMAND_0100 INPUT
‎2007 Aug 09 4:20 PM
Create a prog called ZR_COLORS and add this code.
Then create a screen 100 for prog ZR_COLORS and add a custom control called 'CUSTOM_GRID_CONTAINER'.
Run it.
REPORT ZR_Colors.
data: begin of i_vbak2 occurs 0.
include structure vbak.
data: end of i_vbak2.
data: begin of i_vbak occurs 0.
include structure vbak.
data: cellcolors type lvc_t_scol. " note that is an int table within
data: end of i_vbak. " an int table !!!
types: begin of r_vbak.
include structure vbak.
types: cellcolors type lvc_t_scol.
types: end of r_vbak.
data: i_vbak_out type table of r_vbak.
data: cellcolor type lvc_s_scol.
data: layout type LVC_S_LAYO.
data: grid1 type ref to cl_gui_alv_grid,
field_catalog type lvc_t_fcat,
grid1_container type ref to cl_gui_custom_container.
data: lt_fieldcat type LVC_T_FCAT.
data: wa_fieldcat type LVC_s_FCAT.
start-of-selection.
select * from vbak into table i_vbak2
where erdat > '20041201'
and erdat < '20041216'.
loop at i_vbak2.
move-corresponding i_vbak2 to i_vbak.
append i_vbak.
endloop.
layout-edit = 'X'.
layout-zebra = 'X'.
layout-cwidth_opt = 'X'.
Set first cell in Net value column.
read table i_vbak index 2.
cellcolor-fname = 'NETWR'.
cellcolor-color-col = '3'.
cellcolor-color-int = '1'.
cellcolor-NOKEYCOL = 'X'.
append cellcolor to i_vbak-cellcolors.
modify i_vbak index 2.
Set 2nd cell in Net value column.
read table i_vbak index 4.
cellcolor-fname = 'NETWR'.
cellcolor-color-col = '6'.
cellcolor-color-int = '1'.
cellcolor-NOKEYCOL = 'X'.
append cellcolor to i_vbak-cellcolors.
modify i_vbak index 4.
Identify the internal table name with the colors reference.
layout-CTAB_FNAME = 'CELLCOLORS'.
Instantiate the grid container.
create object grid1_container
exporting
container_name = 'CUSTOM_GRID_CONTAINER'.
Instantiate the grid itself within the container.
create object grid1
exporting
i_parent = grid1_container
i_appl_events = 'X'.
i_vbak_out[] = i_vbak[].
layout-frontend = 'E'.
data: lt_exclude type ui_functions.
data: r_exclude type ui_func.
r_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
append r_exclude to lt_exclude.
Call method of grid1 class object to build/display the grid.
call method grid1->set_table_for_first_display
EXPORTING i_structure_name = 'VBAK'
IT_TOOLBAR_EXCLUDING = lt_exclude
is_layout = layout
changing
it_outtab = i_vbak_out.
it_fieldcatalog = lt_fieldcat.
call screen '0100'.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'E100'.
SET TITLEBAR '100'.
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE USER_COMMAND_0100 INPUT.
case sy-ucomm.
when 'EXIT' or 'BACK' or 'CANCEL'.
leave program.
endcase.
ENDMODULE. " USER_COMMAND_0100 INPUT
‎2007 Aug 09 4:42 PM
Hi,
Go to Transaction DWDM. Here you will find demo programs for ALV Grid, Tree, Drag n Drop, HTML Containers, Splitter Containers using ABAP Object etc.
Also check out the package SLIS. It contains demo programs using ABAP Objects.
Reward points if the answer is helpful.
Regards,
Mukul
‎2007 Aug 10 12:23 AM
Hi,
Check the following links for OO ALV(SAP Documents)
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
http://help.sap.com/saphelp_nw04/helpdata/en/02/dcf6408fb18031e10000000a1550b0/frameset.htm
I hope it helps you.
Regards,
KK
‎2007 Aug 10 7:43 AM
Hi Boddu,
Check this links,
http://www.geocities.com/victorav15/sapr3/abap_ood.html
http://www.sap-hefte.de/download/dateien/1025/087_leseprobe.pdf
<b>Regards,
Jackie.</b>
‎2007 Aug 12 9:36 PM
‎2007 Aug 13 12:41 AM
Hi Bod,
load data into a suitable itab, then...
DATA: i_alv type ref to cl_salv_table.
cl_salv_table=>factory(
IMPORTING
r_salv_table = i_alv
CHANGING
t_table = wa_itab
).
i_alv->display( ).Cheers
G