Application Development and Automation 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: 
Read only

alv report using oops ABAP

Former Member
0 Likes
6,276

hi friendz,

can any one of u give an example, how to build alv report using oops abap ?

thanks in advance.

points for sure

regards,

Vijaya

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
2,594

Hello Vijaya

In the following thread

you will find some simple reports making extensive use of the controls available in SAP which are OO-based.

Regards

Uwe

14 REPLIES 14
Read only

former_member508729
Active Participant
0 Likes
2,594

Hi,

Just go to se38 and type bcalv* and press f4 u will get lot of examples.

Regards

Ashutosh

Reward points if helpful

Read only

Former Member
0 Likes
2,594

Check out the package SLIS for examples on ALVs

Regards,

Manoj

Read only

Former Member
0 Likes
2,594

check

Regards

prabhu

Read only

Former Member
0 Likes
2,594

Hi,

Go to slis package and check for programs starting with bcalv. u will get an idea about the alv with oops.

if you want a detail sample program with steps explained, then i can mail it to you if you can give me your email id.

Read only

0 Likes
2,594

could you please also send me detailed sample program on oops alv. my email address is <removed by moderator>.

thanks and regards.

Read only

2,594

Thanks for coming to SAP Community for answers. Please post your question as a new question here: https://answers.sap.com/questions/ask.html

Since you're new in asking questions here, check out our tutorial about asking and answering questions (if you haven't already), as it provides tips for preparing questions more effectively, that draw responses from our members. Please note, that your post here won't be answered.

Read only

Former Member
0 Likes
2,594

Hi,

Go to slis package and check for programs starting with bcalv. u will get an idea about the alv with oops.

if you want a detail sample program with steps explained, then i can mail it to you if you can give me your email id.

Read only

0 Likes
2,594

hi Pradeep,

my email-id is [email protected].

points will be awarded

thanks

Read only

0 Likes
2,594

Hi,

Check these programs and links.

OOPS ALV

standard pgms

ABAP_OBJECTS_ENJOY_0 Template for Solutions of ABAP Object Enjoy Course

ABAP_OBJECTS_ENJOY_1 Model Solution 1: ABAP Objects Enjoy Course

ABAP_OBJECTS_ENJOY_2 Model Solution 2: ABAP Objects Enjoy Course

ABAP_OBJECTS_ENJOY_3 Model Solution 3: ABAP Objects Enjoy Course

ABAP_OBJECTS_ENJOY_4 Model Solution 4: ABAP Objects Enjoy Course

ABAP_OBJECTS_ENJOY_5 Model Solution 5: ABAP Objects Enjoy Course

DEMO_ABAP_OBJECTS Complete Demonstration for ABAP Objects

DEMO_ABAP_OBJECTS_CONTROLS GUI Controls on Screen

DEMO_ABAP_OBJECTS_EVENTS Demonstration of Events in ABAP Objects

DEMO_ABAP_OBJECTS_GENERAL ABAP Objects Demonstration

DEMO_ABAP_OBJECTS_INTERFACES Demonstration of Interfaces in ABAP Objects

DEMO_ABAP_OBJECTS_METHODS Demonstration of Methods in ABAP Objects

DEMO_ABAP_OBJECTS_SPLIT_SCREEN Splitter Control on Screen

some helful links.

Go through the below links,

For Materials:

1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291

2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt

3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf

4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf

5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt

6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf

7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt

😎 http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8

1) http://www.erpgenie.com/sap/abap/OO/index.htm

2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm

Read only

Former Member
0 Likes
2,594

Hi,

check your mail. i have sent it

Read only

Former Member
0 Likes
2,594

Hi Vijaya,

I hope the following code upto your requirement.

&----


*& Report ZMAT_ALV_GRID *

*& *

&----


*& *

*& *

&----


REPORT ZCL_CLASS1.

TYPES: BEGIN OF T_MARA,

MATNR TYPE MARA-MATNR,

MAKTX TYPE MAKT-MAKTX,

WERKS TYPE MARD-WERKS,

LGORT TYPE MARD-LGORT,

LABST TYPE MARD-LABST,

END OF T_MARA.

*DATA: IT_MARA TYPE STANDARD TABLE OF T_MARA.

DATA: IT_MARA TYPE T_MARA OCCURS 0.

DATA: O_CONT TYPE REF TO CL_GUI_CUSTOM_CONTAINER,

O_GRID TYPE REF TO CL_GUI_ALV_GRID.

DATA: X_FLDCAT TYPE LVC_S_FCAT.

DATA: IT_FLDCAT TYPE LVC_T_FCAT.

DATA: I_LAYOUT TYPE LVC_S_LAYO.

DATA: X_SORT TYPE LVC_S_SORT.

DATA: I_SORT TYPE LVC_T_SORT.

TABLES: MARA.

SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.

PARAMETERS: P_CHK AS CHECKBOX.

START-OF-SELECTION.

PERFORM GET_DATA.

PERFORM GENERATE_FLDCAT.

PERFORM GENERATE_LAYOUT.

PERFORM DO_SORT.

SET SCREEN 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'MAIN'.

  • SET TITLEBAR 'xxx'.

PERFORM BUILD_ALV.

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

&----


*& Form BUILD_ALV

&----


  • text

----


FORM BUILD_ALV .

CREATE OBJECT O_CONT

EXPORTING

CONTAINER_NAME = 'MAT_CONTAINER'

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

LIFETIME_DYNPRO_DYNPRO_LINK = 5

others = 6.

CREATE OBJECT O_GRID

EXPORTING

I_PARENT = O_CONT

EXCEPTIONS

ERROR_CNTL_CREATE = 1

ERROR_CNTL_INIT = 2

ERROR_CNTL_LINK = 3

ERROR_DP_CREATE = 4

others = 5.

CALL METHOD O_GRID->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

  • I_STRUCTURE_NAME =

  • IS_VARIANT =

  • I_SAVE =

  • I_DEFAULT = ' '

IS_LAYOUT = I_LAYOUT

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

IT_OUTTAB = IT_MARA

IT_FIELDCATALOG = IT_FLDCAT[]

IT_SORT = I_SORT

  • IT_FILTER =

EXCEPTIONS

INVALID_PARAMETER_COMBINATION = 1

PROGRAM_ERROR = 2

TOO_MANY_LINES = 3

others = 4.

ENDFORM. " BUILD_ALV

&----


*& Form GET_DATA

&----


  • text

----


FORM GET_DATA .

SELECT A~MATNR

B~MAKTX

C~WERKS

C~LGORT

C~LABST

INTO TABLE IT_MARA

FROM MARA AS A

INNER JOIN MAKT AS B

ON BMATNR = AMATNR

INNER JOIN MARD AS C

ON CMATNR = AMATNR

WHERE A~MATNR IN S_MATNR

AND B~SPRAS = SY-LANGU.

ENDFORM. " GET_DATA

&----


*& Form GENERATE_FLDCAT

&----


  • text

----


FORM GENERATE_FLDCAT .

*CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

  • EXPORTING

    • I_BUFFER_ACTIVE =

  • I_STRUCTURE_NAME = 'ZSMARA'

    • I_CLIENT_NEVER_DISPLAY = 'X'

    • I_BYPASSING_BUFFER =

    • I_INTERNAL_TABNAME = ' '

  • CHANGING

  • CT_FIELDCAT = IT_FLDCAT

  • EXCEPTIONS

  • INCONSISTENT_INTERFACE = 1

  • PROGRAM_ERROR = 2

  • OTHERS = 3.

X_FLDCAT-COL_POS = 1.

X_FLDCAT-FIELDNAME = 'MATNR'.

X_FLDCAT-OUTPUTLEN = '18'.

X_FLDCAT-REPTEXT = 'Material No'.

APPEND X_FLDCAT TO IT_FLDCAT.

X_FLDCAT-COL_POS = 2.

X_FLDCAT-FIELDNAME = 'MAKTX'.

X_FLDCAT-OUTPUTLEN = '48'.

X_FLDCAT-REPTEXT = 'Material Desc'.

X_FLDCAT-TOOLTIP = 'Material Desc'.

APPEND X_FLDCAT TO IT_FLDCAT.

X_FLDCAT-COL_POS = 3.

X_FLDCAT-FIELDNAME = 'WERKS'.

X_FLDCAT-OUTPUTLEN = '5'.

X_FLDCAT-REPTEXT = 'Plant'.

X_FLDCAT-TOOLTIP = 'Plant'.

APPEND X_FLDCAT TO IT_FLDCAT.

X_FLDCAT-COL_POS = 4.

X_FLDCAT-FIELDNAME = 'LGORT'.

X_FLDCAT-OUTPUTLEN = '5'.

X_FLDCAT-REPTEXT = 'S.Loc'.

X_FLDCAT-TOOLTIP = 'S.Loc'.

APPEND X_FLDCAT TO IT_FLDCAT.

X_FLDCAT-COL_POS = 5.

X_FLDCAT-FIELDNAME = 'LABST'.

X_FLDCAT-OUTPUTLEN = '20'.

X_FLDCAT-REPTEXT = 'Quantity'.

X_FLDCAT-TOOLTIP = 'Quantity'.

X_FLDCAT-DO_SUM = 'X'.

APPEND X_FLDCAT TO IT_FLDCAT.

ENDFORM. " GENERATE_FLDCAT

&----


*& Form GENERATE_LAYOUT

&----


  • text

----


FORM GENERATE_LAYOUT .

I_LAYOUT-ZEBRA = 'X'.

I_LAYOUT-FRONTEND = 'X'.

I_LAYOUT-GRID_TITLE = 'ALV GRID USING OOPS'.

I_LAYOUT-NUMC_TOTAL = 'X'.

ENDFORM. " GENERATE_LAYOUT

&----


*& Form DO_SORT

&----


  • text

----


FORM DO_SORT .

X_SORT-FIELDNAME = 'MATNR'.

X_SORT-UP = 'X'.

X_SORT-SUBTOT = 'X'.

IF P_CHK = 'X'.

X_SORT-EXPA = SPACE.

ELSE.

X_SORT-EXPA = 'X'.

ENDIF.

APPEND X_SORT TO I_SORT.

ENDFORM. " DO_SORT

inorder to execute this code perfectly, do the following things.

1. Create a Graphical Screen 100.

2. Place a Custom Control on that screen and give name as MAT_CONTAINER.

3. activate the screen.

and execute the program.

if this suits requirement award points.

satish

Read only

Former Member
0 Likes
2,594

chk these programs

BCALV_EDIT_01
BCALV_EDIT_02
BCALV_EDIT_03
BCALV_EDIT_04
BCALV_EDIT_05
BCALV_EDIT_06
BCALV_EDIT_07
BCALV_EDIT_08

Read only

uwe_schieferstein
Active Contributor
0 Likes
2,595

Hello Vijaya

In the following thread

you will find some simple reports making extensive use of the controls available in SAP which are OO-based.

Regards

Uwe