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: 

regarding OOPS ALV..........urgent plzzzzzzzzzzzzzzz

Former Member
0 Kudos

hi all,

i have a requirement...

in the <b>ALV GRID</b> output...i have <b>3 buttons</b> on application toolbar...

when i select some <b>5 records</b> and click on <b>BUTTON 1.</b>

first time i am selecting some rows and click <b>'SEL'f</b> function code in applicatin tool bar

get_selected_rows

retrieving values

The first column which is initially blank ...'' X" shud appear when i click first button

when <b>'DSEL'</b> is selected...the first column must again become blank.

for this ii have used followin code...

WHEN 'DSEL'.

CALL METHOD cl_gui_cfw=>flush.

CALL METHOD g_grid->get_selected_rows

IMPORTING

et_index_rows = lt_rows.

IF sy-subrc EQ 0.

LOOP AT lt_rows

INTO ls_selected_line.

lf_row_index = ls_selected_line-index.

CLEAR <fs_final>.

READ TABLE i_final

INTO <fs_final>

INDEX lf_row_index.

IF sy-subrc EQ 0.

MOVE c_space TO <fs_final>-check.

MODIFY i_final INDEX sy-tabix FROM <fs_final>

TRANSPORTING check .

CALL METHOD g_grid->set_table_for_first_display

EXPORTING

is_layout = gs_layout

CHANGING

it_outtab = i_final

it_fieldcatalog = gi_fieldcat

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.

ENDLOOP.

CALL METHOD cl_gui_cfw=>flush.

CALL METHOD g_grid->refresh_table_display.

ENDIF.

i have writeen like this

3 REPLIES 3

Former Member
0 Kudos

hi,

refer

BCALV_EDIT_05.

Rgds

Reshma

Former Member
0 Kudos

check out the programs,

BCALV_FULLSCREEN_GRID_EDIT

BCALV_GRID_01

BCALV_GRID_02

BCALV_GRID_03

BCALV_GRID_04

BCALV_GRID_05

BCALV_GRID_06

BCALV_GRID_07

BCALV_GRID_08

BCALV_GRID_09

BCALV_GRID_10

BCALV_GRID_11

BCALV_GRID_AND_POPUP

BCALV_GRID_DEMO

BCALV_GRID_DND_TREE

BCALV_GRID_DND_TREE_SIMPLE

BCALV_GRID_EDIT

BCALV_GRID_EDIT_DELTA

BCALV_GRID_EDIT_DELTA_APPL

BCALV_GRID_EDIT_DELTA_EVENT

BCALV_GRID_EDIT_DELTAM01

BCALV_GRID_EDIT_VERIFY

BCALV_GRID_EDIT_VERIFY_C01

BCALV_GRID_EDIT_VERIFY_CLASSES

BCALV_GRID_EDIT_VERIFY_E01

BCALV_GRID_EDIT_VERIFY_F01

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

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf

Go thru these links...

About ALV:

http://www.geocities.com/mpioud/Abap_programs.html

ALV Group Heading

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

and few more,

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

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

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?

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

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

Vijay
Active Contributor
0 Kudos

hi



*&---------------------------------------------------------------------*
*& Report  Z_OOPS_ALV                                                  *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

report  z_oops_alv                              .

class event_reciever definition deferred.
data: begin of it_tab occurs 0.
        include structure mara.
data : celltab type lvc_t_styl.
data: end of it_tab.

data: it_tab1 type table of mara,
      wa_mara type mara,
      it_celltab type lvc_t_styl,
      wa_celltab type lvc_s_styl,
      wa_edit type raw4 value cl_gui_alv_grid=>mc_style_enabled.

data  wa_layout type lvc_s_layo.
data: gui_container type ref to cl_gui_custom_container,
      alv type ref to cl_gui_alv_grid,
      reciever type ref to event_reciever.

*---------------------------------------------------------------------*
*       CLASS event_reciever DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class event_reciever definition.
  public section.
    methods: data_change for event data_changed of cl_gui_alv_grid
             importing sender er_data_changed.
endclass.                    "event_reciever DEFINITION

*---------------------------------------------------------------------*
*       CLASS event_reciever IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class event_reciever implementation.
  method data_change.
    data: good_cells type lvc_s_modi,
          wa_matkl type matkl.

    loop at er_data_changed->mt_good_cells into good_cells.

      call method er_data_changed->get_cell_value
        exporting
          i_row_id    = good_cells-row_id
*    I_TABIX     =
          i_fieldname = 'MATKL'
        importing
          e_value     = wa_matkl.
    endloop.
  endmethod.                    "data_change

endclass.                    "event_reciever IMPLEMENTATION

start-of-selection.

select * into table it_tab1 from mara up to 100 rows where matkl ne ' '
.

  call screen '0100'.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module status_0100 output.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.
  wa_layout-stylefname = 'CELLTAB'.
  create object gui_container
    exporting
*          PARENT                      =
      container_name              = 'CONTAINER'
*          STYLE                       =
*          LIFETIME                    = lifetime_default
*          REPID                       =
*          DYNNR                       =
*          NO_AUTODEF_PROGID_DYNNR     =
    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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.

  create object alv
    exporting
*    I_SHELLSTYLE      = 0
*    I_LIFETIME        =
      i_parent          = gui_container
*    I_APPL_EVENTS     = space
*    I_PARENTDBG       =
*    I_APPLOGPARENT    =
*    I_GRAPHICSPARENT  =
*    I_NAME            =
    exceptions
      error_cntl_create = 1
      error_cntl_init   = 2
      error_cntl_link   = 3
      error_dp_create   = 4
      others            = 5
      .
  if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.

  loop at it_tab1 into wa_mara.
    refresh it_celltab.
    move-corresponding wa_mara to it_tab.

    if wa_mara-matkl = '00101'.

      wa_celltab-fieldname = 'MATKL'.
      wa_celltab-style = wa_edit.
      append wa_celltab to it_celltab.
      wa_celltab-fieldname = 'MATNR'.
      wa_celltab-style = wa_edit.
      append wa_celltab to it_celltab.
    endif.

    it_tab-celltab = it_celltab.
    append it_tab.
  endloop.


  call method alv->set_ready_for_input
    exporting
      i_ready_for_input = 1.


  call method alv->set_table_for_first_display
    exporting
*    I_BUFFER_ACTIVE               =
*    I_BYPASSING_BUFFER            =
*    I_CONSISTENCY_CHECK           =
      i_structure_name              = 'MARA'
*    IS_VARIANT                    =
*    I_SAVE                        =
*    I_DEFAULT                     = 'X'
      is_layout                     =  wa_layout
*    IS_PRINT                      =
*    IT_SPECIAL_GROUPS             =
*    IT_TOOLBAR_EXCLUDING          =
*    IT_HYPERLINK                  =
*    IT_ALV_GRAPHICS               =
*    IT_EXCEPT_QINFO               =
    changing
      it_outtab                     = it_tab[]
*    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.

  create object reciever.
  set handler reciever->data_change for all instances.


endmodule.                 " STATUS_0100  OUTPUT

hope it clears ur doubt

regards

vijay

<b>plz dont forget to reward points if useful</b>