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: 

subscreens with alv grid control

Former Member
0 Kudos

Hi Everyone,

I have a requirement which is like, I have a a main screen, and couple of subscreens containing ALV grid control.

The data for populating in this alv grid control is generated by calling form modules. How do I achieve this, Can anyone suggest me a good approach for this?

Sample codes will be greatly appreciated.

Thanks in advance,

Prabs.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

In the PBO of the screen, have a init routine before you call the sub-screen, in which you fetch all the data that is required.

Does this answer ur question ?

Remember to reward points to the answer(s) that helped you.

4 REPLIES 4

Former Member
0 Kudos

U can do this using TAB STRIP CONTROL

U can have a look into this for creating subscreen area

in Tabstrip.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap code samples/alv grid/abap code sample for tab strip in alv.pdf

Hope this helps u.

Former Member
0 Kudos

In the PBO of the screen, have a init routine before you call the sub-screen, in which you fetch all the data that is required.

Does this answer ur question ?

Remember to reward points to the answer(s) that helped you.

Former Member
0 Kudos

Hi Judith,

Thanks for your link, unfortunately I could not open the link. It gives me this following error:

403

The requested operation is forbidden for this resource. You do not have the permissions required to access this resource.

Thanks,

Prabs.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Check this link if you need help in sub-screen.

http://www.sapgenie.com/abap/code/abap19.htm

Here is the sample code for Tabstrip control.In that I am using single grid display when first button is pressed and multi-grid display when second button in the tabstrip is pressed.

CONTROLS:  main_tab TYPE TABSTRIP.

DATA:      BEGIN OF i_main_tab,
             subscreen   LIKE sy-dynnr,
             prog        LIKE sy-repid VALUE
                              'ZZZ_TABSTRIP',
             pressed_tab LIKE sy-ucomm VALUE c_main_tab-tab1,
           END OF i_main_tab.


MODULE status_9001 OUTPUT.

  SET PF-STATUS 'ZSTATUS'.
  SET TITLEBAR 'ZTITLE'.

  main_tab-activetab = i_main_tab-pressed_tab.
  CASE i_main_tab-pressed_tab.
    WHEN c_main_tab-tab1.
       IF o_custom_container1 IS INITIAL.
* Creating Object
         PERFORM f9000_objects_create.
* Building the field catalog
         PERFORM f9001_build_field_cat TABLES i_fcat
                                    USING 'ZZZ_GRID'.
* For Layout
         PERFORM f9002_layout USING sy-title c_x c_a c_x.
         i_main_tab-subscreen = '9100'.
* Displaying data
          CALL METHOD o_alvgrid1->set_table_for_first_display
          EXPORTING
             is_variant                    = w_variant
             i_save                        = c_a
             is_layout                     = w_layout
          CHANGING
             it_outtab                     = i_grid[]
             it_fieldcatalog               = i_fcat[]
          EXCEPTIONS
             invalid_parameter_combination = 1
             program_error                 = 2
             too_many_lines                = 3
             OTHERS                        = 4.
          IF sy-subrc <> 0.
            MESSAGE i005 WITH text-009."Error in ALV report display
            LEAVE LIST-PROCESSING.
          ENDIF.
  endif.
    when c_main_tab-tab2.

      if o_custom_container2 is initial.

        perform f9000_objects_create1 using:
*                   create custom container
                    'o_custom_container2' '' '' '',
*                   Create splitter container
                    'o_splitter' o_custom_container2 '2' '1',
*                   Create event reciever
                    'o_eventreceiver' '' '' ''.
*       Creating containers for the split grids
        call method o_splitter->get_container exporting row      = 1
                                                        column   = 1
                                 receiving container = o_container1.

        call method o_splitter->get_container exporting row      = 2
                                                        column   = 1
                                 receiving container = o_container2.
*       Set where the splits on the screen comes
        call method o_splitter->set_row_height
          exporting
            id                = 1
            height            = 45
          exceptions
            cntl_error        = 1
            cntl_system_error = 2
            others            = 3.
       if sy-subrc ne 0.
        perform f9003_error_handle using text-E04.
       endif.
        perform f9000_objects_create1 using:
*       Create the alv grids
                    'o_alvgrid2' o_container1 '' '',
                    'o_alvgrid3' o_container2 '' ''.
        set handler o_eventreceiver->handle_double_click for o_alvgrid2.

        perform f9001_build_field_cat tables i_fcat1
                                using 'ZZZ_GRID1'.

        perform f9001_build_field_cat tables i_fcat2
                                using 'ZZZ_GRID2'.
*       For Layout
        PERFORM f9002_layout USING sy-title c_x c_a c_x.
        i_main_tab-subscreen = '9200'.
        if not i_grid1[] is initial.
          call method o_alvgrid2->set_table_for_first_display
          exporting
             is_variant                    = w_variant
             i_save                        = c_a
             is_layout                     = w_layout
          CHANGING
             it_outtab                     = i_grid1[]
             it_fieldcatalog               = i_fcat1[]
          exceptions
             invalid_parameter_combination = 1
             program_error                 = 2
             too_many_lines                = 3
             others                        = 4.
          if sy-subrc <> 0.
            message i005 with text-009."Error in ALV report display
            leave list-processing.
          endif.
*  Populate the GRID2 data
          read table i_grid1 into w_grid1 index 1.
          if sy-subrc = 0.
             if not i_grid2[] is initial.
*  Generate the grid2 data.
              call method o_alvgrid3->set_table_for_first_display
                 exporting
                     is_variant                    = w_variant
                     i_save                        = c_a
                     is_layout                     = w_layout
                  CHANGING
                     it_outtab                     = i_grid2[]
                     it_fieldcatalog               = i_fcat2[]
                exceptions
                   invalid_parameter_combination = 1
                   program_error                 = 2
                   too_many_lines                = 3
                   others                        = 4.
             endif.
          endif.
        else.
* No data for the entered selection criteria
          message i005 with text-010.
          leave list-processing.
        endif.
    endif.
    WHEN OTHERS.
*      DO NOTHING
   ENDCASE.

ENDMODULE.                 " STATUS_9001  OUTPUT


MODULE main_tab_active_tab_get INPUT.

  CASE sy-ucomm.
    WHEN c_main_tab-tab1.
      i_main_tab-pressed_tab = c_main_tab-tab1.
      i_main_tab-subscreen = '9100'.
    WHEN c_main_tab-tab2.
      i_main_tab-pressed_tab = c_main_tab-tab2.
      i_main_tab-subscreen = '9200'.
    WHEN OTHERS.
*      DO NOTHING
  ENDCASE.

ENDMODULE.                 " MAIN_TAB_ACTIVE_TAB_GET  

MODULE user_command_9001 INPUT.

  CASE sy-ucomm.
    WHEN 'BACK'.
      PERFORM exit_program.
      SET SCREEN '0'.
    WHEN 'EXIT' OR  'CANC'.
      PERFORM exit_program.
      LEAVE PROGRAM.
  ENDCASE.

ENDMODULE.                 " USER_COMMAND_9000  INPUT

* For screen 9001 we need to write Flow logic as below. For subscreens, Flow logic is 
* not required.

PROCESS BEFORE OUTPUT.

 MODULE STATUS_9001.
 CALL SUBSCREEN main_tab_sca
      INCLUDING i_main_tab-prog i_main_tab-subscreen.

*
PROCESS AFTER INPUT.

  MODULE user_command_9001.
  MODULE main_tab_active_tab_get.

The perform I have used is not defined here.If you need clarifications,get back.