2007 Mar 11 9:14 PM
Hi Experts,
If some one asked me to list out the <u><b>step by step</b></u> procedure to develop a (very) simple ALV grid based on OO ABAP! So, wht culd b the answer for it?
ThanQ.
2007 Mar 12 4:45 AM
For OOALV,we define a container.Generally we use a custom container.The class used is <b>cl_gui_custom_container</b>.In the <b>layout of your screen</b>,make a custom container (icon with C written) and name it <b>CONTAINER</b> (in caps).Now create the container by going to the PATTERN button->ABAP objects.
We can now attach a control to the container.ALV,text editor,picture control are different types of controls.For ALV,we use the class <b>cl_gui_alv_grid</b>.Again you can create an instance by using the pattern button.The container name is given as the parent of the ALV in the constructor method.
We can use several methods of the ALV class to display data and for various functionalities.To display the data first time,we use <b>SET_TABLE_FOR_FIRST_DISPLAY</b> method.You can go to se24,type CL_GUI_ALV_GRID and click DISPLAY button.There you can see all the methods and attributes of the ALV class which you can use.
REPORT SAMPLE.
<b>**alv and cont are references to the respective classes.However,the objects are not created yet.</b>
DATA: alv type ref to cl_gui_alv_GRID,
cont type ref to cl_gui_custom_container,
itab_spfli type table of spfli,
ok_code type sy-ucomm.
START-OF-SELECTION.
<b>**I fill my internal table itab_spfli with the data that i want in my ALV display</b>
select * from spfli into table itab_spfli.
<b>**I call the screen.In the screen layout,i have made a container named CONTAINER</b>
call screen 100.
END-OF-SELECTION.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE STATUS_0100 OUTPUT.
seT PF-STATUS 'GUI'.
SET TITLEBAR 'xxx'.
<b>**If the container is being made for the first time,i create a container object.I m passing the name CONTAINER that i used in the screen layout here</b>
if cont is initial.
CREATE OBJECT cont
EXPORTING
CONTAINER_NAME = 'CONTAINER'.
<b>**The ALV object is created here and the parent name is the container object ie cont</b>
CREATE OBJECT ALV
EXPORTING
I_PARENT = CONT.
<b>**SET_TABLE_FOR_FIRST_DISPLAY method is called to display the data.I give the structure name SPFLI and the internal table which conatins the actual data ie itab_spfli</b>
CALL METHOD ALV->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'SPFLI'
IS_VARIANT =
I_SAVE =
I_DEFAULT =
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = itab_spfli
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.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE USER_COMMAND_0100 INPUT.
case ok_code.
when 'BACK'.
leave to screen 0.
when 'EXIT'.
leave to screen 0.
when 'SAVE'.
MODIFY spfli from table itab_spfli.
ENDCASE.
-
<b>Also try the transaction ABAPDOCU for simple ALV programs.</b>
<b>For ALV:</b>
http://help.sap.com/saphelp_erp2005/helpdata/en/99/49b844d61911d2b469006094192fe3/frameset.htm
<b>For OO concepts:</b>
http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
<b>-->download the PDF from following link.</b>
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
Regards,
Beejal
**Reward if this helps
Hi Experts,
If some one asked me to list out the <u><b>step by step</b></u> procedure to develop a (very) simple ALV grid based on OO ABAP! So, wht culd b the answer for it?
ThanQ.
2007 Mar 11 10:16 PM
2007 Mar 11 10:26 PM
Hi,
Please check this link on how to build OO ALV.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.highlightedcontent?documenturi=...ObjectModelCodeSample.zip
Also please check SAP sample programs:
BCALV_EDIT_01 This report illustrates the simplest case of using an editable/noneditable ALV Grid Control.
BCALV_EDIT_02 This report illustrates how to set chosen cells of an ALV Grid Control editable.
BCALV_EDIT_03 In this example the user may change values of fields SEATSOCC (occupied seats) and/or PLANETYPE.
The report checks the input value(s) semantically and provides protocol messages in case of error
BCALV_EDIT_04 This report illustrates how to add and remove lines to a table using the ALV Grid Control and how to
implement the saving of the new data.
BCALV_EDIT_05 This example shows how to use checkboxes within an ALV Grid Control. You learn:
(1) how to define a column for editable checkboxes for an attribute of your list
(2) how to evaluate the checked checkboxes
(3) how to switch between editable and non-editable checkboxes
BCALV_EDIT_06 This example shows how to define a dropdown listbox for all cells of one column in an editable ALV
Grid Control.
BCALV_EDIT_07 This example shows how to define dropdown listboxes for particular cells of your output table.
BCALV_EDIT_08 This report implements an ALV Grid Control with an application specific F4 help. The following aspects
are dealt with:
(1) how to replace the standard f4 help
(2) how to pass the selected value to the ALV Grid Control
(3) how to build an f4 help, whose value range depend on a value of another cell.
Regards,
Ferry Lianto
2007 Mar 11 10:29 PM
2007 Mar 12 4:45 AM
For OOALV,we define a container.Generally we use a custom container.The class used is <b>cl_gui_custom_container</b>.In the <b>layout of your screen</b>,make a custom container (icon with C written) and name it <b>CONTAINER</b> (in caps).Now create the container by going to the PATTERN button->ABAP objects.
We can now attach a control to the container.ALV,text editor,picture control are different types of controls.For ALV,we use the class <b>cl_gui_alv_grid</b>.Again you can create an instance by using the pattern button.The container name is given as the parent of the ALV in the constructor method.
We can use several methods of the ALV class to display data and for various functionalities.To display the data first time,we use <b>SET_TABLE_FOR_FIRST_DISPLAY</b> method.You can go to se24,type CL_GUI_ALV_GRID and click DISPLAY button.There you can see all the methods and attributes of the ALV class which you can use.
REPORT SAMPLE.
<b>**alv and cont are references to the respective classes.However,the objects are not created yet.</b>
DATA: alv type ref to cl_gui_alv_GRID,
cont type ref to cl_gui_custom_container,
itab_spfli type table of spfli,
ok_code type sy-ucomm.
START-OF-SELECTION.
<b>**I fill my internal table itab_spfli with the data that i want in my ALV display</b>
select * from spfli into table itab_spfli.
<b>**I call the screen.In the screen layout,i have made a container named CONTAINER</b>
call screen 100.
END-OF-SELECTION.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE STATUS_0100 OUTPUT.
seT PF-STATUS 'GUI'.
SET TITLEBAR 'xxx'.
<b>**If the container is being made for the first time,i create a container object.I m passing the name CONTAINER that i used in the screen layout here</b>
if cont is initial.
CREATE OBJECT cont
EXPORTING
CONTAINER_NAME = 'CONTAINER'.
<b>**The ALV object is created here and the parent name is the container object ie cont</b>
CREATE OBJECT ALV
EXPORTING
I_PARENT = CONT.
<b>**SET_TABLE_FOR_FIRST_DISPLAY method is called to display the data.I give the structure name SPFLI and the internal table which conatins the actual data ie itab_spfli</b>
CALL METHOD ALV->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'SPFLI'
IS_VARIANT =
I_SAVE =
I_DEFAULT =
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = itab_spfli
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.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE USER_COMMAND_0100 INPUT.
case ok_code.
when 'BACK'.
leave to screen 0.
when 'EXIT'.
leave to screen 0.
when 'SAVE'.
MODIFY spfli from table itab_spfli.
ENDCASE.
-
<b>Also try the transaction ABAPDOCU for simple ALV programs.</b>
<b>For ALV:</b>
http://help.sap.com/saphelp_erp2005/helpdata/en/99/49b844d61911d2b469006094192fe3/frameset.htm
<b>For OO concepts:</b>
http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
<b>-->download the PDF from following link.</b>
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
Regards,
Beejal
**Reward if this helps
2007 Mar 12 4:57 AM
2007 Mar 12 5:38 AM
ThnaQ Beejal,
Is it right that in OO ALVs, to build the Filed Catalogue, one must use the only LVC_T_Fieldcat and for Layout, its LVC_T_LAYO?
THnaQ.
2007 Mar 12 8:35 AM
Hello Srinivas,
Field catalog can be built <b>manually</b> or <b>semi-automatically</b>:
Check Pages <b>10-14</b> in the document below:
<b>http://www.abap4.it/download/ALV.pdf</b>
You can build a field catalog without using LVC_T_FCAT if you are building the field catalog semi-automatically by using a function module.The name of the function module is <b>LVC_FIELDCATALOG_MERGE</b>.
For layout adjustments,check pages <b>15-16</b> in the above document.
Regards,
Beejal
2007 Mar 12 3:05 PM
ThanQ.
So,
1- When we go for SLIS_T_FILEDCAT and When we go for LVC_T_FILEDCAT? What r the differences?
2-In the same way, What r the situations demand for to use SLIS_LAYOUT_ALV and What r for LVC_T_LAYO?
ThanQ.
2007 Mar 13 3:09 PM
Hi,
we use LVC_T_FCAT/LVC_S_FCAT in OO alv and
SLIS_T_FIELDCAT_ALV/ SLIS_FIELDCAT_ALV in normal alv for fieldcatalog,
similarly LVC_S_LAYO use in OO alv and
slis_layout_alv in normal alv for layout setting
Regards,
2007 Mar 13 3:11 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |