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's

Former Member
0 Likes
801

Hi all,

i am new to abap objects.

Can anyone help me how to create ALV program .

it will developop in tree or hierarchy for..

folder1 -- level 1

        • subfolder1 -- level 2

*********subfolder1 -- level 3...

Please send One Simple Code to develop this Object..It Urgent for Me ..

Thanks ,

Kumar

Hi all,

i am new to abap objects.

Can anyone help me how to create ALV program .

it will developop in tree or hierarchy for..

folder1 -- level 1

        • subfolder1 -- level 2

*********subfolder1 -- level 3...

Please send One Simple Code to develop this Object..It Urgent for Me ..

Thanks ,

Kumar

5 REPLIES 5
Read only

Former Member
0 Likes
769

Hi Kumar,

Check this link

http://www.sapdevelopment.co.uk/reporting/alv/alvtree%5Calvtree_basic.htm

BCALV_TREE_DEMO Demo for ALV tree control

Reward Points if this helps,

Satish

Read only

Former Member
0 Likes
769

Hi Kumar,

This code will useful for u,

*TYPE-POOLS : slis.

*

*TABLES : mseg.

*

*DATA : BEGIN OF itab_head OCCURS 0,

  • matnr LIKE mseg-matnr,

  • werks LIKE mseg-werks,

  • END OF itab_head.

*

*DATA : BEGIN OF itab_item OCCURS 0,

  • matnr LIKE mseg-matnr,

  • werks LIKE mseg-werks,

  • mblnr LIKE mseg-mblnr,

  • menge LIKE mseg-menge,

  • END OF itab_item.

*

*DATA : t_fcat TYPE slis_t_fieldcat_alv,

  • key_info TYPE slis_keyinfo_alv,

  • t_eve TYPE slis_t_event,

  • gt_subtot TYPE slis_t_sortinfo_alv,

  • subtot LIKE LINE OF gt_subtot,

  • t_listhead TYPE slis_t_listheader,

  • st_line TYPE slis_listheader.

*

*DATA : t_mtdoc LIKE mseg-mblnr.

*

*SELECT-OPTIONS : mat FOR mseg-matnr.

*

*INITIALIZATION.

  • PERFORM build_cat USING t_fcat.

  • PERFORM build_eve.

*

*START-OF-SELECTION.

  • PERFORM get_data.

  • PERFORM dis_data.

*

*

*&----


**& Form build_cat

*&----


    • text

*----


    • -->TEMP_FCAT text

*----


*FORM build_cat USING temp_fcat TYPE slis_t_fieldcat_alv.

*

  • DATA : wa_fcat TYPE slis_fieldcat_alv.

*

  • wa_fcat-tabname = 'ITAB_HEAD'.

  • wa_fcat-fieldname = 'MATNR'.

  • wa_fcat-seltext_m = 'Material'.

  • APPEND wa_fcat TO temp_fcat.

  • CLEAR wa_fcat.

*

  • wa_fcat-tabname = 'ITAB_HEAD'.

  • wa_fcat-fieldname = 'WERKS'.

  • wa_fcat-seltext_m = 'Plant'.

  • APPEND wa_fcat TO temp_fcat.

  • CLEAR wa_fcat.

*

  • wa_fcat-tabname = 'ITAB_ITEM'.

  • wa_fcat-fieldname = 'MBLNR'.

  • wa_fcat-seltext_m = 'Material Doc.'.

  • APPEND wa_fcat TO temp_fcat.

  • CLEAR wa_fcat.

*

  • wa_fcat-tabname = 'ITAB_ITEM'.

  • wa_fcat-fieldname = 'MENGE'.

  • wa_fcat-seltext_m = 'Quantity'.

    • wa_fcat-do_sum = 'Y'.

  • APPEND wa_fcat TO temp_fcat.

  • CLEAR wa_fcat.

*

    • subtot-spos = 1.

    • subtot-fieldname = 'MATNR'.

    • subtot-tabname = 'ITAB_HEAD'.

    • subtot-up = 'X'.

    • subtot-group = 'X'.

    • subtot-subtot = 'X'.

    • subtot-expa = 'X'.

    • APPEND subtot TO gt_subtot.

*

*ENDFORM. "build_cat

*

*&----


**& Form build_eve

*&----


    • text

*----


*FORM build_eve.

*

  • DATA : wa_eve TYPE slis_alv_event.

*

  • CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

  • EXPORTING

  • i_list_type = 0

  • IMPORTING

  • et_events = t_eve

    • EXCEPTIONS

    • LIST_TYPE_WRONG = 1

    • OTHERS = 2

  • .

  • IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

*

    • READ TABLE t_eve INTO wa_eve WITH KEY name = 'TOP_OF_PAGE'.

    • IF sy-subrc = 0.

    • wa_eve-form = 'TOP_OF_PAGE'.

    • MODIFY t_eve FROM wa_eve INDEX sy-tabix.

    • ENDIF.

**

*

*ENDFORM. "build_eve

*&----


**& Form get_data

*&----


    • text

*----


*FORM get_data.

*

  • SELECT matnr werks mblnr menge FROM mseg INTO CORRESPONDING FIELDS OF TABLE itab_item

  • WHERE matnr IN mat.

*

*ENDFORM. "get_data

*

*&----


**& Form dis_data

*&----


    • text

*----


*FORM dis_data.

*

  • key_info-header01 = 'MATNR'.

  • key_info-item01 = 'MATNR'.

  • key_info-header02 = 'WERKS'.

  • key_info-item02 = 'WERKS'.

*

  • REFRESH itab_head.

  • LOOP AT itab_item.

  • ON CHANGE OF itab_item-matnr OR itab_item-werks.

  • MOVE-CORRESPONDING itab_item TO itab_head.

  • APPEND itab_head.

  • ENDON.

  • ENDLOOP.

*

  • CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

  • EXPORTING

  • i_callback_program = 'ZHEIRALV_PRDS'

    • i_callback_user_command = 'USER_COMMAND'

  • it_fieldcat = t_fcat

  • it_sort = gt_subtot

  • it_events = t_eve[]

  • i_tabname_header = 'ITAB_HEAD'

  • i_tabname_item = 'ITAB_ITEM'

  • is_keyinfo = key_info

  • TABLES

  • t_outtab_header = itab_head

  • t_outtab_item = itab_item

    • EXCEPTIONS

    • PROGRAM_ERROR = 1

    • OTHERS = 2

  • .

  • IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

*

*

*ENDFORM. "dis_data

*

&----


*& Form user_Command

&----


  • text

----


  • -->U_COMM text

  • -->SELFIELD text

----


*FORM user_command USING u_comm TYPE sy-ucomm selfield TYPE slis_selfield.

*

  • CASE u_comm.

  • WHEN '&IC1'.

  • READ TABLE itab_item INDEX selfield-tabindex.

  • t_mtdoc = itab_item-mblnr.

  • SET PARAMETER ID 'MBN' FIELD t_mtdoc.

  • CALL TRANSACTION 'MIGO' AND SKIP FIRST SCREEN.

  • ENDCASE.

*ENDFORM. "user_Command

&----


*& Form top_of_page

&----


  • text

----


*FORM top_of_page.

*

  • CLEAR st_line.

  • st_line-typ = 'H'.

  • st_line-info = 'Dhwani Shah'.

  • APPEND st_line TO t_listhead.

*

  • CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

  • EXPORTING

  • it_list_commentary = t_listhead

    • I_LOGO =

    • I_END_OF_LIST_GRID =

    • I_ALV_FORM =

  • .

*

*

*ENDFORM. "top_of_page

Regards,

Vijay

Read only

0 Likes
769

Hi Vijay,

thanks for u r Reply,

Please same output i want to in tree Structeurs.....

send me Aserly as Possible.....

Please do needfull.

Read only

Former Member
0 Likes
769

HI

small program

REPORT YSIMPLEALVINTERACTIVE .

TABLES : VBAK,VBAP,LIKP,VBRK,VTTK.

PARAMETERS : P_KUNNR LIKE VBAK-KUNNR.

SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN,

S_ERDAT FOR VBAK-ERDAT.

DATA:WA TYPE YLINE22,

ITAB TYPE YROW22.

DATA : REPID LIKE SY-REPID,

CONTAINER TYPE SCRFNAME VALUE 'ALVCONTROL',

CUST TYPE REF TO CL_GUI_CUSTOM_CONTAINER,

GRID TYPE REF TO CL_GUI_ALV_GRID.

*CLASS DEFINITATION.

CLASS CL_GRID DEFINITION.

PUBLIC SECTION .

METHODS: DC FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING

E_ROW E_COLUMN.

ENDCLASS. "

*CLASS IMPLEMENTATION.

CLASS CL_GRID IMPLEMENTATION.

METHOD DC.

DATA : WA1 TYPE YLINE22.

READ TABLE ITAB INDEX E_ROW-INDEX INTO WA1.

SET PARAMETER ID 'AVN' FIELD WA1-VBELN.

CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN .

ENDMETHOD. "DC

ENDCLASS. "CL_GRID IMPLEMENTATION

  • CALLING CLASS.

DATA : OBJ_CL_GRID TYPE REF TO CL_GRID.

START-OF-SELECTION.

PERFORM CALLSUB.

IF SY-SUBRC = 0.

CALL SCREEN 100.

ELSE.

MESSAGE I000(0) WITH 'no data for your salesorder'.

ENDIF.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

REPID = SY-REPID.

IF CUST IS INITIAL.

CREATE OBJECT CUST EXPORTING CONTAINER_NAME = CONTAINER .

CREATE OBJECT GRID EXPORTING I_PARENT = CUST.

CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

I_STRUCTURE_NAME = 'YLINE22'

CHANGING

IT_OUTTAB = ITAB.

CREATE OBJECT OBJ_CL_GRID.

SET HANDLER OBJ_CL_GRID->DC FOR GRID.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

FORM CALLSUB.

SELECT VBAPVBELN VBAPKWMENG VBAPNETWR LIPSERDAT VTTP~ERDAT

VBRK~FKDAT INTO TABLE ITAB FROM VBAK

INNER JOIN VBAP ON VBAKVBELN = VBAPVBELN INNER JOIN LIPS ON VBAP~VBELN

= LIPSVGBEL INNER JOIN VTTP ON LIPSVBELN = VTTP~VBELN INNER JOIN VBRP

ON LIPSVBELN = VBRPVGBEL INNER JOIN VBRK ON VBRKVBELN = VBRKVBELN

WHERE

VBAK~KUNNR = P_KUNNR AND

VBAKVBELN IN S_VBELN AND VBAKERDAT IN S_ERDAT.

ENDFORM. "CALL

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

CASE SY-UCOMM.

WHEN'EXIT'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE.

Check this link

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

http://www.sapdev.co.uk/reporting/alv/alvscr.htm

We can implement OOPS concepts in SAP using ABAP objets concept.

ABAP Objects is a new concept in R/3 Release 4.0. The term has two meanings. On the one hand, it stands for the entire ABAP runtime environment. On the other hand, it represents the object-oriented extension of the ABAP language.

The Runtime Environment

The new name ABAP Objects for the entire ABAP runtime environment is an indication of the way in which SAP has, for some time, been moving towards object orientation, and of its commitment to pursuing this line further. The ABAP Workbench allows you to create R/3 Repository objects such as programs, authorization objects, lock objects, Customizing objects, and so on. Using function modules, you can encapsulate functions in separate programs with a defined interface. The Business Object Repository (BOR) allows you to create SAP Business Objects for internal and external use (DCOM/CORBA). Until now, object-oriented techniques have been used exclusively in system design, and have not been supported by the ABAP language.

The Object-Oriented Language Extension

ABAP Objects is a complete set of object-oriented statements that has been introduced into the ABAP language. This object-oriented extension of ABAP builds on the existing language, and is fully compatible with it. You can use ABAP Objects in existing programs, and can also use "conventional" ABAP in new ABAP Objects programs.

ABAP Objects supports object-oriented programming. Object orientation (OO), also know as the object-oriented paradigm, is a programming model that unites data and functions in objects. The rest of the ABAP language is primarily intended for structured programming, where data is stored in a structured form in database tables and function-oriented programs access and work with it.

The object-oriented enhancement of ABAP is based on the models of Java and C++. It is compatible with external object interfaces such as DCOM and CORBA. The implementation of object-oriented elements in the kernel of the ABAP language has considerably increased response times when you work with ABAP Objects. SAP Business Objects and GUI objects - already object-oriented themselves - will also profit from being incorporated in ABAP Objects.

Please check these links ...

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

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

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

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

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

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

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

Have a look at my sample reports

Sample report ZUS_SDN_THREE_ALV_GRIDS

Sample report ZUS_SDN_TWO_ALV_GRIDS

Read only

Former Member
0 Likes
769

Hi

http://www.sapdev.co.uk/reporting/alv/alvtree.htm

see this link you will get all ALV tree programs