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 with OOPS concept!!

Former Member
0 Likes
1,230

HI

Request u tp provide me with standard ALV Program where OOPS concept is being used!!

Regards

Gunjan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,198
DATA: alv_grid TYPE REF TO cl_gui_alv_grid,
 custom_container TYPE REF TO cl_gui_custom_container,
 field_cat TYPE lvc_t_fcat,
 layout TYPE lvc_s_layo.

DATA BEGIN OF i_list OCCURS 0.
        INCLUDE STRUCTURE MARA.
DATA END OF i_list.

DATA ok_code TYPE ok_code.
SELECT * FROM MARA INTO TABLE i_list
 UP TO 100 ROWS.

CALL SCREEN 100.


*---------------------------------------------------------------------*
*  MODULE STATUS_0100
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
MODULE alv_display OUTPUT.
  SET PF-STATUS 'STATUS'.
  PERFORM display_alv.
ENDMODULE.                   "STATUS_0100

*---------------------------------------------------------------------*
*  MODULE USER_COMMAND_0100 INPUT
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  CASE ok_code.
*    when 'SAVE'.
*      perform save_data.
    WHEN 'BACK'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDMODULE.                    "USER_COMMAND_0100 INPUT



*&--------------------------------------------------------------------*
*&      Form  display_alv
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM display_alv.
  IF alv_grid IS INITIAL.
    CREATE OBJECT custom_container
      EXPORTING
*    PARENT                      =
        container_name              = 'CONTRL'
        .


    CREATE OBJECT alv_grid
      EXPORTING
        i_parent          = custom_container
        .

    CALL METHOD alv_grid->set_table_for_first_display
      EXPORTING
        i_structure_name              = 'MARA'
      CHANGING
        it_outtab                     = i_list[]
*    IT_FIELDCATALOG               =
*    IT_SORT                       =
*    IT_FILTER                     =
*  EXCEPTIONS
*    INVALID_PARAMETER_COMBINATION = 1
*    PROGRAM_ERROR                 = 2
*    TOO_MANY_LINES                = 3
*    others                        = 4
            .

  ELSE.

    CALL METHOD alv_grid->refresh_table_display
*  EXPORTING
*    IS_STABLE      =
*    I_SOFT_REFRESH =
*  EXCEPTIONS
*    FINISHED       = 1
*    others         = 2
            .




  ENDIF.

ENDFORM.                    "display_alv

HI

Request u tp provide me with standard ALV Program where OOPS concept is being used!!

Regards

Gunjan

10 REPLIES 10
Read only

Former Member
0 Likes
1,199
DATA: alv_grid TYPE REF TO cl_gui_alv_grid,
 custom_container TYPE REF TO cl_gui_custom_container,
 field_cat TYPE lvc_t_fcat,
 layout TYPE lvc_s_layo.

DATA BEGIN OF i_list OCCURS 0.
        INCLUDE STRUCTURE MARA.
DATA END OF i_list.

DATA ok_code TYPE ok_code.
SELECT * FROM MARA INTO TABLE i_list
 UP TO 100 ROWS.

CALL SCREEN 100.


*---------------------------------------------------------------------*
*  MODULE STATUS_0100
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
MODULE alv_display OUTPUT.
  SET PF-STATUS 'STATUS'.
  PERFORM display_alv.
ENDMODULE.                   "STATUS_0100

*---------------------------------------------------------------------*
*  MODULE USER_COMMAND_0100 INPUT
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  CASE ok_code.
*    when 'SAVE'.
*      perform save_data.
    WHEN 'BACK'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDMODULE.                    "USER_COMMAND_0100 INPUT



*&--------------------------------------------------------------------*
*&      Form  display_alv
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM display_alv.
  IF alv_grid IS INITIAL.
    CREATE OBJECT custom_container
      EXPORTING
*    PARENT                      =
        container_name              = 'CONTRL'
        .


    CREATE OBJECT alv_grid
      EXPORTING
        i_parent          = custom_container
        .

    CALL METHOD alv_grid->set_table_for_first_display
      EXPORTING
        i_structure_name              = 'MARA'
      CHANGING
        it_outtab                     = i_list[]
*    IT_FIELDCATALOG               =
*    IT_SORT                       =
*    IT_FILTER                     =
*  EXCEPTIONS
*    INVALID_PARAMETER_COMBINATION = 1
*    PROGRAM_ERROR                 = 2
*    TOO_MANY_LINES                = 3
*    others                        = 4
            .

  ELSE.

    CALL METHOD alv_grid->refresh_table_display
*  EXPORTING
*    IS_STABLE      =
*    I_SOFT_REFRESH =
*  EXCEPTIONS
*    FINISHED       = 1
*    others         = 2
            .




  ENDIF.

ENDFORM.                    "display_alv
Read only

Former Member
0 Likes
1,198

hi,

check the programs BCALV_EDIT_*

Read only

Former Member
0 Likes
1,198

Hi,

Have a look at below link. Its a PDF document Which will give you information abt OO ALV.

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

Also have a look at below link.

http://help.sap.com/saphelp_nw2004s/helpdata/en/5e/88d440e14f8431e10000000a1550b0/frameset.htm

I hope it helps.

*MARK all helpful answers

Read only

Former Member
0 Likes
1,198

Hi Gunjan,

Refer the following progs:

BCALV_GRID_01 to BCALV_GRID_11,BCALV_GRID_DEMO.

Regards,

Chetan.

PS:Reward points if this is helpful.

Read only

anversha_s
Active Contributor
0 Likes
1,198

hi,

some links.

www.sapgenie.com

www.abap4u.com

http://help.sap.com/saphelp_nw2004s/helpdata/en/5e/88d440e14f8431e10000000a1550b0/frameset.htm

download the PDF from following link.

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

The ALV object Grid methods allow the same functionality as ALV grid report function modules but are displayed within

a screen (dialog program). SAP has provided a suit of programs which demonstrate how to For examples see standard SAP

programs as detailed below:

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.

rgds

Anver

<b><i>if hlped pls mark points</i></b>

Read only

Former Member
0 Likes
1,198

Hi Gunjan,

check this below link it contains lot of programs check it out

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

mark the helpful answers

Regards,

Naveen

Read only

Former Member
0 Likes
1,198

thx for ur replies....

but was looking for something without call screen...

Read only

0 Likes
1,198

You cannot develop ALV reports using OOPs without calling a SCREEN.

Regards,

Ravi

Read only

uwe_schieferstein
Active Contributor
0 Likes
1,198

Hello Gunjan

Here is a version without any container on the displaying dynpro.

*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_ALVLIST_FULLSCREEN
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
 
REPORT  zus_sdn_alvlist_fullscreen.
 
 
DATA:
  gt_kna1           TYPE STANDARD TABLE OF kna1.
 
 
DATA:
  go_docking        TYPE REF TO cl_gui_docking_container,
  go_alvgrid        TYPE REF TO cl_gui_alv_grid.
 
 
 
START-OF-SELECTION.
* Select some data
  SELECT * FROM  kna1 INTO TABLE gt_kna1.
 
* Create docking container and dock at left side
  CREATE OBJECT go_docking
    EXPORTING
      parent                      = cl_gui_container=>screen0
*      REPID                       =
*      DYNNR                       =
      side                        =
                  cl_gui_docking_container=>dock_at_left
*      EXTENSION                   = 50
*      STYLE                       =
*      LIFETIME                    = lifetime_default
*      CAPTION                     =
*      METRIC                      = 0
      ratio                       = 90  " 90% of screen
    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.
 
* Set very high extension -> not overruled by screen resizing
  CALL METHOD go_docking->set_extension
    EXPORTING
      extension  = 99999
    EXCEPTIONS
      CNTL_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.
 
 
 
 
* Create ALV grid
  CREATE OBJECT go_alvgrid
    EXPORTING
      i_parent          = go_docking
    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.
 
 
 
 
 
 
  CALL METHOD go_alvgrid->set_table_for_first_display
    EXPORTING
*      I_BUFFER_ACTIVE               =
*      I_BYPASSING_BUFFER            =
*      I_CONSISTENCY_CHECK           =
      i_structure_name              = 'KNA1'
*      IS_VARIANT                    =
*      I_SAVE                        =
*      I_DEFAULT                     = 'X'
*      IS_LAYOUT                     =
*      IS_PRINT                      =
*      IT_SPECIAL_GROUPS             =
*      IT_TOOLBAR_EXCLUDING          =
*      IT_HYPERLINK                  =
*      IT_ALV_GRAPHICS               =
*      IT_EXCEPT_QINFO               =
*      IR_SALV_ADAPTER               =
    CHANGING
      it_outtab                     = gt_kna1
*      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.
 
* Empty dynpro without any elements
  CALL SCREEN '0100'.
* NOTE: dynpro flow logic contains only the two modules shown below  
 
 
END-OF-SELECTION.
 
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.
 
* Link to current dynpro
  CALL METHOD go_docking->link
    EXPORTING
      repid                       = syst-cprog
      dynnr                       = syst-dynnr
*      CONTAINER                   =
    EXCEPTIONS
      cntl_error                  = 1
      cntl_system_error           = 2
      lifetime_dynpro_dynpro_link = 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.
 
 
ENDMODULE.                 " STATUS_0100  OUTPUT
 
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  SET SCREEN 0. LEAVE SCREEN.
ENDMODULE.                 " USER_COMMAND_0100  INPUT

Regards

Uwe

Read only

uwe_schieferstein
Active Contributor
0 Likes
1,198

Hello Gunjan

Sample programs can be found using transaction:

- <b>SE83</b> (reuse library)

- <b>DWDM</b> (Development Workbench Demos)

Regards

Uwe