Skip to Content
1
Former Member
Aug 02, 2007 at 12:04 PM

Output is not coming in ALV with oops

14 Views

Hi All,

i am not getting output in this code.

tables:mara.

data: begin of itab occurs 10,

matnr like mara-matnr,

mbrsh like mara-mbrsh,

mtart like mara-mtart,

meins like mara-meins,

end of itab.

DATA: ITAB1 like itab occurs 10 with header line.

DATA gt_fieldcat TYPE lvc_t_fcat WITH HEADER LINE.

data: ok-code like sy-ucomm.

DATA gs_layout TYPE lvc_s_layo.

data:w_variant type disvariant.

DATA: go_grid TYPE REF TO cl_gui_alv_grid,

go_custom_container TYPE REF TO cl_gui_custom_container.

start-of-selection.

CALL screen 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

CREATE OBJECT go_custom_container

EXPORTING container_name = 'ALV_CONTAINER'.

CREATE OBJECT go_grid

EXPORTING

i_parent = go_custom_container.

*CALL METHOD go_grid->set_table_for_first_display

*EXPORTING

**container_name = 'ALV_CONTAINER'.

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

  • I_STRUCTURE_NAME =

  • IS_VARIANT =

  • I_SAVE = 'A'

    • I_DEFAULT = 'X'

    *is_layout = gs_layout

    • IS_PRINT =

    • IT_SPECIAL_GROUPS =

    **it_toolbar_excluding = pt_exclude "excluding toolbar functions

    • IT_HYPERLINK =

    • IT_ALV_GRAPHICS =

    • IT_EXCEPT_QINFO =

    • IR_SALV_ADAPTER =

    *CHANGING

    *it_outtab = itab1[]

    *it_fieldcatalog = gt_fieldcat[]

    • 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.

    PERFORM prepare_field_catalog CHANGING gt_fieldcat[].

    PERFORM LAYOUT.

    perform load_data.

    ENDMODULE. " STATUS_0100 OUTPUT

    &----


    *& Form load_data

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM load_data .

    select matnr mbrsh mtart meins from mara into table itab1.

    CALL METHOD go_grid->set_table_for_first_display

    EXPORTING

    *container_name = 'ALV_CONTAINER'.

    • I_BUFFER_ACTIVE =

    • I_BYPASSING_BUFFER =

    • I_CONSISTENCY_CHECK =

    • I_STRUCTURE_NAME =

    IS_VARIANT = w_variant

    I_SAVE = 'A'

    • I_DEFAULT = 'X'

    is_layout = gs_layout

    • IS_PRINT =

    • IT_SPECIAL_GROUPS =

    *it_toolbar_excluding = pt_exclude "excluding toolbar functions

    • IT_HYPERLINK =

    • IT_ALV_GRAPHICS =

    • IT_EXCEPT_QINFO =

    • IR_SALV_ADAPTER =

    CHANGING

    it_outtab = itab1[]

    it_fieldcatalog = gt_fieldcat[]

    • 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.

    ENDFORM. " load_data

    &----


    *& Form prepare_field_catalog

    &----


    • text

    ----


    • <--P_GT_FIELDCAT[] text

    ----


    FORM prepare_field_catalog CHANGING gt_fieldcat TYPE lvc_t_fcat.

    DATA ls_fieldcat TYPE lvc_s_fcat.

    ls_fieldcat-tabname = 'ITAB1'.

    ls_fieldcat-fieldname = 'MATNR'.

    ls_fieldcat-scrtext_m = 'MATERIAL'.

    ls_fieldcat-col_pos = 1.

    ls_fieldcat-outputlen = 10.

    • ls_fieldcat-emphasize = 'C400'.

    • ls_fieldcat-key = 'X'.

    APPEND ls_fieldcat TO gt_fieldcat.

    ls_fieldcat-tabname = 'ITAB1'.

    ls_fieldcat-col_pos = 2.

    ls_fieldcat-fieldname = 'MBRSH'.

    ls_fieldcat-scrtext_m = 'INDUSTRY'.

    • ls_fieldcat-emphasize = 'C900'.

    APPEND ls_fieldcat TO gt_fieldcat.

    ls_fieldcat-tabname = 'ITAB1'.

    ls_fieldcat-col_pos = 3.

    ls_fieldcat-fieldname = 'MTART'.

    ls_fieldcat-scrtext_m = 'TYPE'.

    APPEND ls_fieldcat TO gt_fieldcat.

    ls_fieldcat-tabname = 'ITAB1'.

    ls_fieldcat-col_pos = 4.

    ls_fieldcat-fieldname = 'MEINS'.

    ls_fieldcat-scrtext_m = 'UNIT'.

    APPEND ls_fieldcat TO gt_fieldcat.

    ENDFORM. " prepare_field_catalog

    &----


    *& Module USER_COMMAND_0100 INPUT

    &----


    • text

    ----


    MODULE USER_COMMAND_0100 INPUT.

    data lv_ucomm type sy-ucomm.

    lv_ucomm = sy-ucomm.

    CASE lv_ucomm.

    WHEN 'CANCEl' OR 'EXIT'.

    perform free_objects.

    LEAVE PROGRAM.

    when 'BACK'.

    perform free_objects.

    set screen '0'.

    leave screen.

    ENDCASE.

    ENDMODULE. " USER_COMMAND_0100 INPUT

    &----


    *& Form LAYOUT

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM LAYOUT .

    gs_layout-stylefname = 'FIELD_STYLE'.

    gs_layout-zebra = 'X'.

    gs_layout-grid_title = 'MATERIAL'.

    gs_layout-sel_mode = 'A'.

    gs_layout-ctab_fname = 'COLORS'.

    ENDFORM. " LAYOUT

    &----


    *& Form free_objects

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM free_objects .

    CALL METHOD gO_GRID->FREE

    • EXCEPTIONS

    • CNTL_ERROR = 1

    • CNTL_SYSTEM_ERROR = 2

    • others = 3

    .

    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_custom_container->FREE

    • EXCEPTIONS

    • CNTL_ERROR = 1

    • CNTL_SYSTEM_ERROR = 2

    • others = 3

    .

    IF SY-SUBRC <> 0.

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

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

    ENDIF.