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

oops alv

Former Member
0 Likes
681

Hi,

I am doing oops alv. The following code is not showing any syntax error.But output shown blank screen.

parameters : p_vbeln like vbrp-vbeln.

*----------------------------------------------------------------------*
*       CLASS c1 DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class c1 definition.
  public section.
    methods : constructor importing cust_cont type char10 optional.
    methods : get_data importing p_vbeln type vbeln,
              show_data.
  private section.
    data : o_cont type ref to cl_gui_custom_container,
           o_grid type ref to cl_gui_alv_grid,
           it_vbrp type table of vbrp.
endclass.                    "c1 DEFINITION

*----------------------------------------------------------------------*
*       CLASS c1 IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class c1 implementation.
  method : constructor.
*--linking the screen custom control class to custom container.
    create object o_cont
      exporting
        container_name              = 'CUST_CONT'.

*--linking custom container as a part of alv grid class object
*show that grid will sit on screen custom container as the custom
*container is alread link with the custom control.
    create object o_grid
      exporting
        i_parent          = o_cont.
  endmethod.                    ":

*--Get billing items

  method get_data.
    select * from vbrp into table it_vbrp
                       where matnr = p_vbeln.

    if not it_vbrp is initial.
      call method show_data.
    endif.
  endmethod.                    ":

*--show alv grid

  method show_data.
    call method o_grid->set_table_for_first_display
      exporting
        i_structure_name              = 'VBRP'
*      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                     = it_vbrp
*      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.
  endmethod.                    "show_data
endclass.               ":

data : obj type ref to c1.

start-of-selection.

  set screen 100.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
module status_0100 output.
  set pf-status 'MENU'.
  if obj is initial.
    create object obj
        exporting cust_cont = 'INV_CONT'.
    call method obj->get_data
      exporting
        p_vbeln = p_vbeln.

  endif.
endmodule.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
module user_command_0100 input.
  case sy-ucomm.
    when 'BACK' or 'EXIT'.
      leave program.
  endcase.

endmodule.                 " USER_COMMAND_0100  INPUT

Regards

Srinu

7 REPLIES 7
Read only

Former Member
0 Likes
630

Hav u checked that the internal table passed to ALV contains data ?

Read only

former_member196517
Contributor
0 Likes
630

are you sure that you have created a custom control on screen and name of it is 'CUST_CONT'..

Regards

Anuj Goyal

Read only

0 Likes
630

Hi,

I created custom control.

Regards

Srinu

Read only

0 Likes
630

Hi,

Now i am getting output. I given wrong custom control name earlier. Now i changed.

Thanks for your response

Srinu

Read only

Former Member
0 Likes
630

This is because u didn't assign field catalog.

Regards

vasu

Read only

hymavathi_oruganti
Active Contributor
0 Likes
630

try putting break point at the select and check data is coming into it_vbrp or not.

no need to put the structure name 'vbrp'.

hey sorry u right, as u r not giving fieldcat , u r giving structure name. thats correct.

check whether the containet name is same or not also.

Message was edited by:

Hymavathi Oruganti

Read only

Former Member
0 Likes
630

Yeah .. the field catalog is missing .