2009 Feb 16 2:28 PM
Hi experts,
I want a display one internal table by alv grid oops.
There is no need of making it interactive or layout designing just to display.
I have the following code.
data: ok_code like sy-ucomm,
gt_sflight type table of sflight,
g_container type scrfname value 'cc_alv',
grid1 type ref to cl_gui_alv_grid,
g_custom_container type ref to cl_gui_custom_container.
data : begin of it_ekko1 occurs 0,
ekgrp type ekko-ekgrp,
lifnr type ekko-lifnr,
bukrs type ekko-bukrs,
ebeln type ekko-ebeln,
end of it_ekko1.
let this table be populated by some queries.****
call screen 100.
if g_custom_container is initial.
create object g_custom_container
exporting container_name = g_container.
create object grid1
exporting i_parent = g_custom_container.
call method grid1->set_table_for_first_display
exporting i_structure_name = 'it_ekko1'
changing it_outtab = it_ekko1.
endif.
can u please suggest wat r the settings i need to make for the execution of the code.
for example going to scrren painter and setting scrren 100.
any settings like strucure defining ,
is fieldcatalod a mandatory one.
it is giving error of it_outtab type non-compatible.
thanks in advance.
2009 Feb 16 2:41 PM
changing it_outtab = it_ekko1[].
" it_ekko1 is considered as an work area(it_ekko1[] is internal table with header line)Cheers,
Hi experts,
I want a display one internal table by alv grid oops.
There is no need of making it interactive or layout designing just to display.
I have the following code.
data: ok_code like sy-ucomm,
gt_sflight type table of sflight,
g_container type scrfname value 'cc_alv',
grid1 type ref to cl_gui_alv_grid,
g_custom_container type ref to cl_gui_custom_container.
data : begin of it_ekko1 occurs 0,
ekgrp type ekko-ekgrp,
lifnr type ekko-lifnr,
bukrs type ekko-bukrs,
ebeln type ekko-ebeln,
end of it_ekko1.
let this table be populated by some queries.****
call screen 100.
if g_custom_container is initial.
create object g_custom_container
exporting container_name = g_container.
create object grid1
exporting i_parent = g_custom_container.
call method grid1->set_table_for_first_display
exporting i_structure_name = 'it_ekko1'
changing it_outtab = it_ekko1.
endif.
can u please suggest wat r the settings i need to make for the execution of the code.
for example going to scrren painter and setting scrren 100.
any settings like strucure defining ,
is fieldcatalod a mandatory one.
it is giving error of it_outtab type non-compatible.
thanks in advance.
2009 Feb 16 2:36 PM
Hi,
there are a lot examples in this forum and in R/3.
Search in R/3 for BCALV* etc. or try tcode dwdm.
Regards, Dieter
2009 Feb 16 2:41 PM
changing it_outtab = it_ekko1[].
" it_ekko1 is considered as an work area(it_ekko1[] is internal table with header line)Cheers,
2009 Feb 16 2:49 PM
Hi mukundan,
ur correct but the output screen is not coming.
do i need to write PBO,PAO modules or any slight change in the code required.
The screen is complete blank.
Thanks.
2009 Feb 18 6:31 AM
Pass field catalog
changing it_outtab = it_ekko1[]
it_fieldcatalog = it_fcat.
Cheers
2009 Feb 18 6:58 AM
Hi,
Double click on Screen 100.
There give short description and click on layout.
Then click on button on left side with C on it.
Drag it and create a container and give this name in create object r_container exporting parameter.
Give it a name and save,activate.
Then goto flowlogic ---> uncomment modules and double click them ,
these will come into your program .
Create a module in PBO and double cllick.
In the program ,create instances in this module.
Field catalog is needed when u are using extra fields or some fields of standard tables.
2009 Feb 18 7:08 AM
Hi,
refer the below code.
DATA :
R_CONTAINER1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
R_GRID1 TYPE REF TO CL_GUI_ALV_GRID.
DATA :
FS_SFLIGHT TYPE SFLIGHT,
FS_SBOOK TYPE SBOOK.
START-OF-SELECTION.
SELECT * FROM SFLIGHT
INTO TABLE T_SFLIGHT.
CALL SCREEN 100.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'YH1312_SF'.
SET TITLEBAR 'Flight details'.
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Module SFLIGHT OUTPUT
&----
text
----
MODULE SFLIGHT OUTPUT.
CREATE OBJECT R_CONTAINER1
EXPORTING
CONTAINER_NAME = 'CONTAINER'.
CREATE OBJECT R_GRID1
EXPORTING
I_PARENT = R_CONTAINER1.
CALL METHOD R_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'SFLIGHT'
is_variant =
i_save =
i_default = 'X'
is_layout =
CHANGING
IT_OUTTAB = T_SFLIGHT
it_fieldcatalog =
it_sort =
it_filter =
.
SET HANDLER DCLICK=>ON_DOUBLE FOR R_GRID1.
ENDMODULE. " SFLIGHT OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK' OR 'EXIT' OR 'RETURN'.
SET SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
This works fine.
2009 Feb 18 8:31 AM
thanks Sreesudha,
this code is looking good and wil work.
I wil give reply after implementing as of now server is down .
2009 Feb 18 9:30 AM
Hi,
Use this wiki for Learn to display data in ALV Grid using Object Oriented Programming, for a basic example for OOPs ALV Display:-
Hope this helps you.
Thanks & Regards,
Tarun
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |