Skip to Content
author's profile photo Former Member
Former Member

Alv grid Should Display In Three Tabstrips

Hi Experts,

Could you please tell me how to display alv in three tabstrips using oops abap

Best answer rewarded

Regards

Fareedas

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Apr 08, 2008 at 01:04 PM

    Follow the following code for the 3rd tabstrip (I have done it for 2).

    *&---------------------------------------------------------------------*
    *& Report  ZTEST_READ_CLUSTER
    *&
    *&---------------------------------------------------------------------*
    *&
    *&
    *&---------------------------------------------------------------------*
    
    REPORT  ztest_read_cluster.
    
    TABLES: vbak, likp.
    
    TYPES: BEGIN OF types_vbak ,
           vbeln TYPE vbeln,
           vkorg TYPE vkorg,
           netwr TYPE netwr,
           END OF types_vbak,
    
           BEGIN OF types_likp ,
           vbeln TYPE vbeln_vl,
           vstel TYPE vstel,
           vkorg TYPE vkorg,
           netwr TYPE netwr,
           END OF types_likp.
    
    
    DATA: w_cntx_menu TYPE REF TO cl_rsdme_ui_context_menu_gen,
          t_vbak      TYPE STANDARD TABLE OF types_vbak,
          t_likp      TYPE STANDARD TABLE OF types_likp,
          w_sale      TYPE char01.
    CONSTANTS: c_check TYPE c VALUE 'X'.
    ** ALV relavent Data
    DATA: w_grid TYPE REF TO cl_gui_alv_grid,
          wl_ref_container TYPE REF TO cl_gui_custom_container,
          w_container      TYPE scrfname   VALUE 'C_CONTAINER',
          t_fcat TYPE lvc_t_fcat,
          t_sort TYPE lvc_t_sort.
    
    CONTROLS: c_tab TYPE TABSTRIP.
    
    DATA: c_dynnr TYPE sy-dynnr.
    
    
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-011.
    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,
                    s_delvr FOR likp-vbeln.
    SELECTION-SCREEN: END OF BLOCK b1.
    
    START-OF-SELECTION.
    
    
      SELECT vbeln
             vkorg
             netwr
             FROM vbak INTO TABLE t_vbak
             WHERE vbeln IN s_vbeln.
    
      IF sy-subrc = 0.
        SORT t_vbak BY vbeln.
      ENDIF.
    
      SELECT vbeln
             vstel
             vkorg
             netwr
             FROM likp INTO TABLE t_likp
             WHERE vbeln IN s_delvr.
    
      IF sy-subrc = 0.
        SORT t_likp BY vbeln.
      ENDIF.
    
      CALL SCREEN '9001'.
    *&---------------------------------------------------------------------*
    *&      Module  STATUS_9001  OUTPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE status_9001 OUTPUT.
    
      SET PF-STATUS ' '.
      SET TITLEBAR 'MAIN'.
    
      IF c_tab-activetab IS INITIAL OR
         c_dynnr         IS INITIAL.
    
        c_tab-activetab = 'TAB1'.
        c_dynnr = '9002'.
    
      ENDIF.
    
    
    ENDMODULE.                 " STATUS_9001  OUTPUT
    *&---------------------------------------------------------------------*
    *&      Module  USER_COMMAND_9001  INPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE user_command_9001 INPUT.
    
      CASE sy-ucomm.
    
        WHEN 'BACK' OR
             '%EX'  OR
             'CANC'.
    
          SET SCREEN 0.
    
        WHEN 'TAB1'.
          c_dynnr = '9002'.
    
        WHEN 'TAB2'.
          c_tab-activetab = 'TAB2'.
          c_dynnr = '9003'.
    
        WHEN 'TAB3'.
          c_tab-activetab = 'TAB3'.
          c_dynnr = '9004'.
    
      ENDCASE.
    
    
    ENDMODULE.                 " USER_COMMAND_9001  INPUT
    *&---------------------------------------------------------------------*
    *&      Module  STATUS_9002  OUTPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE status_9002 OUTPUT.
    
    ** Create the Container
      CREATE OBJECT wl_ref_container
        EXPORTING
          container_name = w_container.
    ** Create the Grid object
      CREATE OBJECT w_grid
        EXPORTING
          i_parent          = wl_ref_container
        EXCEPTIONS
          error_cntl_create = 1
          error_cntl_init   = 2
          error_cntl_link   = 3
          error_dp_create   = 4
          OTHERS            = 5.
      CHECK sy-subrc = 0.
    
      PERFORM sub_fill_fcat_sale.
    
      CALL METHOD w_grid->set_table_for_first_display
        CHANGING
          it_outtab                     = t_vbak
          it_fieldcatalog               = t_fcat
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
    
    
    ENDMODULE.                 " STATUS_9002  OUTPUT
    *&---------------------------------------------------------------------*
    *&      Module  STATUS_9004  OUTPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE status_9003 OUTPUT.
    
    ** Create the Container
      CREATE OBJECT wl_ref_container
        EXPORTING
          container_name = w_container.
    ** Create the Grid object
      CREATE OBJECT w_grid
        EXPORTING
          i_parent          = wl_ref_container
        EXCEPTIONS
          error_cntl_create = 1
          error_cntl_init   = 2
          error_cntl_link   = 3
          error_dp_create   = 4
          OTHERS            = 5.
      CHECK sy-subrc = 0.
    
      PERFORM sub_fill_fcat_delv.
    
      CALL METHOD w_grid->set_table_for_first_display
        CHANGING
          it_outtab                     = t_likp
          it_fieldcatalog               = t_fcat
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
    
    ENDMODULE.                 " STATUS_9004  OUTPUT
    *&---------------------------------------------------------------------*
    *&      Form  sub_fill_fcat
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    FORM sub_fill_fcat_sale .
    
      DATA: wa_fcat TYPE lvc_s_fcat.
    
      REFRESH t_fcat.
    
      CLEAR wa_fcat.
      wa_fcat-row_pos   = 1.
      wa_fcat-fieldname = wa_fcat-rollname = 'VBELN'.
      APPEND wa_fcat TO t_fcat.
    
      CLEAR wa_fcat.
      wa_fcat-row_pos   = 2.
      wa_fcat-fieldname = wa_fcat-rollname = 'VKORG'.
      APPEND wa_fcat TO t_fcat.
    
      CLEAR wa_fcat.
      wa_fcat-row_pos   = 3.
      wa_fcat-fieldname = wa_fcat-rollname = 'NETWR'.
      APPEND wa_fcat TO t_fcat.
    
    ENDFORM.                    " sub_fill_fcat
    *&---------------------------------------------------------------------*
    *&      Form  sub_fill_fcat_delv
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    FORM sub_fill_fcat_delv .
    
      DATA: wa_fcat TYPE lvc_s_fcat.
    
      REFRESH t_fcat.
    
      CLEAR wa_fcat.
      wa_fcat-row_pos   = 1.
      wa_fcat-fieldname = 'VBELN'.
      wa_fcat-rollname  = 'VBELN_VL'.
      APPEND wa_fcat TO t_fcat.
    
      CLEAR wa_fcat.
      wa_fcat-row_pos   = 2.
      wa_fcat-fieldname = wa_fcat-rollname =  'VKORG'.
      APPEND wa_fcat TO t_fcat.
    
      CLEAR wa_fcat.
      wa_fcat-row_pos   = 3.
      wa_fcat-fieldname = wa_fcat-rollname =  'VSTEL'.
      APPEND wa_fcat TO t_fcat.
    
      CLEAR wa_fcat.
      wa_fcat-row_pos   = 4.
      wa_fcat-fieldname = wa_fcat-rollname =  'NETWR'.
      APPEND wa_fcat TO t_fcat.
    
    
    ENDFORM.                    " sub_fill_fcat_delv
    

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.