Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ALV using OOPS

Former Member
0 Kudos

Hi,

There are 2 methods of displaying alv

1. FM

2. Classes and methods

Which one is better and why and how?

Also how do you display using classes?

thanks in advance

chirantan

5 REPLIES 5

aris_hidalgo
Contributor
0 Kudos

Hi,

ALV using FM are the old way of using ALV in a report whereas the new ones uses classes. In SE38, type in BC*ALV or SALV* to check the ALV examples using OOP.

Hope it helps...

P.S. Please award points if it helps...

Former Member
0 Kudos

ALV OOPS Blog

/people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid

Simple ALV report

http://www.sapgenie.com/abap/controls/alvgrid.htm

http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox

ALV Interactive Reports

ALV Easy Reference Guide OOPS

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a41...

ALV

1. Please give me general info on ALV.

http://www.sapfans.com/forums/viewtopic.php?t=58286

http://www.sapfans.com/forums/viewtopic.php?t=76490

http://www.sapfans.com/forums/viewtopic.php?t=20591

http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.

2. How do I program double click in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=11601

http://www.sapfans.com/forums/viewtopic.php?t=23010

Check the program in the following link:

http://sap-img.com/abap/display-secondary-list-using-alv-grid.htm

3. How do I add subtotals (I have problem to add them)...

http://www.sapfans.com/forums/viewtopic.php?t=20386

http://www.sapfans.com/forums/viewtopic.php?t=85191

http://www.sapfans.com/forums/viewtopic.php?t=88401

http://www.sapfans.com/forums/viewtopic.php?t=17335

http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_basic.htm

4. How to add list heading like top-of-page in ABAP lists?

http://www.sapfans.com/forums/viewtopic.php?t=58775

http://www.sapfans.com/forums/viewtopic.php?t=60550

http://www.sapfans.com/forums/viewtopic.php?t=16629

5. How to print page number / total number of pages X/XX in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)

6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.

http://www.sapfans.com/forums/viewtopic.php?t=64320

http://www.sapfans.com/forums/viewtopic.php?t=44477

7. How can I set the cell color in ALV?

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/coloring%2ba%2brow%2band%2bcolumn%2bin%2...

8. How do I print a logo/graphics in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=81149

http://www.sapfans.com/forums/viewtopic.php?t=35498

http://www.sapfans.com/forums/viewtopic.php?t=5013

9. How do I create and use input-enabled fields in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=84933

http://www.sapfans.com/forums/viewtopic.php?t=69878

10. How can I use ALV for reports that are going to be run in background?

http://www.sapfans.com/forums/viewtopic.php?t=83243

http://www.sapfans.com/forums/viewtopic.php?t=19224

11. How can I display an icon in ALV? (Common requirement is traffic light icon).

http://www.sapfans.com/forums/viewtopic.php?t=79424

http://www.sapfans.com/forums/viewtopic.php?t=24512

12. How can I display a checkbox in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=88376

http://www.sapfans.com/forums/viewtopic.php?t=40968

http://www.sapfans.com/forums/viewtopic.php?t=6919

13. Top-of-page in ALV

14. ALV Group Heading

http://www.sap-img.com/fu037.htm

How to add list heading like top-of-page in ABAP lists?

http://www.sapfans.com/forums/viewtopic.php?t=58775

http://www.sapfans.com/forums/viewtopic.php?t=60550

http://www.sapfans.com/forums/viewtopic.php?t=16629

15. ALV output to PDF conversion

It has an example code for PDF Conversion.

http://www.erpgenie.com/abap/code/abap51.htm

Go thru these programs they may help u to try on some hands on

ALV Demo program

BCALV_DEMO_HTML

BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode

BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode

BCALV_GRID_DEMO Simple ALV Control Call Demo Program

BCALV_TREE_DEMO Demo for ALV tree control

BCALV_TREE_SIMPLE_DEMO

BC_ALV_DEMO_HTML_D0100

REgards.

Former Member
0 Kudos

Hi Sir ,

Please have a look below .Hope it is suitable and simpler solution for your question.

Please do reward if useful.

Thankx.

The better one is the second option ...ie through classes and their methods.

Check any program starting with BCALV_GRID* for internactive examples, specifically BCALV_GRID_02 for the hotspot(double click) functionality.

see example program

se38 type bcalv* see example progarm

This posting has an example of using a splitter container:

This posting has a discussion about using TOP-OF-PAGE:

This posting has an example of using picture control:

This posting has an example of putting a picture on top of an ALV grid:

Former Member
0 Kudos

ALV using Classes and Methods is better than FMs

Bcoz it handles, multiple instances efficiently.

Former Member
0 Kudos

Hello Chirantan Chanana,

ALV using FM or OOPS, it doen't make any difference. But ALV using OOPS is the latest version than ALV using FM. Using OOPS there are extra options for ALV are available.

First go through these links... Here you can find simple information about ALV using OOPS.

http://www.erpgenie.com/abap/controls/alvgrid.htm#Set%20the%20title%20of%20the%20grid

http://www.sapdev.co.uk/reporting/alv/alvobjgrid/alvobject_sort.htm

http://www.saptechnical.com/Tutorials/OOPS/MainPage.htm

and this is example code....

&----


*& Report ZLCL_ALV_INVOICE *

*& *

&----


*& *

*& *

&----


REPORT ZLCL_ALV_INVOICE .

TABLES: VBRK.

DATA: ITAB LIKE VBRP OCCURS 1 WITH HEADER LINE.

DATA: O_CONT TYPE REF TO CL_GUI_CUSTOM_CONTAINER,

O_GRID TYPE REF TO CL_GUI_ALV_GRID.

START-OF-SELECTION.

SET SCREEN 100.

&----


*& Form GET_DATA

&----


text

-


FORM GET_DATA .

SELECT *

FROM VBRP

INTO TABLE ITAB

WHERE VBELN = VBRK-VBELN.

ENDFORM. " GET_DATA

&----


*& Module STATUS_0100 OUTPUT

&----


text

-


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'MENU'.

IF O_CONT IS INITIAL.

CREATE OBJECT O_CONT

EXPORTING

CONTAINER_NAME = 'INV_CONT' "Screen custom control name

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

LIFETIME_DYNPRO_DYNPRO_LINK = 5

OTHERS = 6

.

IF SY-SUBRC 0.

MESSAGE I000(Z00) WITH 'Error in custom container'.

EXIT.

ENDIF.

CREATE OBJECT O_GRID

EXPORTING

I_PARENT = O_CONT "Custom container class object

EXCEPTIONS

ERROR_CNTL_CREATE = 1

ERROR_CNTL_INIT = 2

ERROR_CNTL_LINK = 3

ERROR_DP_CREATE = 4

OTHERS = 5.

IF SY-SUBRC 0.

MESSAGE I000(Z00) WITH 'Error in alv grid linking'.

EXIT.

ENDIF.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


text

-


MODULE USER_COMMAND_0100 INPUT.

CASE SY-UCOMM.

WHEN 'BACK'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module SHOW_ALV_GRID INPUT

&----


text

-


MODULE SHOW_ALV_GRID INPUT.

PERFORM GET_DATA.

CALL METHOD O_GRID->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

I_STRUCTURE_NAME = 'VBRP'

CHANGING

IT_OUTTAB = ITAB[]

EXCEPTIONS

INVALID_PARAMETER_COMBINATION = 1

PROGRAM_ERROR = 2

TOO_MANY_LINES = 3

OTHERS = 4.

IF SY-SUBRC 0.

MESSAGE I000(Z00) WITH 'Error in showing alv grid'.

EXIT.

ENDIF.

ENDMODULE. " SHOW_ALV_GRID INPUT

you can understand very easily

Regards

--

Sasidhar Reddy Matli.