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: 

Tabstrip coding in report

Former Member
0 Kudos

Hai,

I want to use tabstrip(with 3 different subscreens) in my report.so could any one of you can send me the coding of this.

thanks in advance

kiran

19 REPLIES 19

Former Member
0 Kudos

Hi,

I have already posted a code sample using three tab,

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 will help u.

Get back to me if u have any queries.

Thanks & Regards,

Judith.

Kindly reward points if u find this helpful.

0 Kudos

Judith,

The link you give here is no longer available.

Do you have this content and would you make it available in SCN and give the new link, please?

Thank you.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Check this.

http://help.sap.com/saphelp_nw04/helpdata/en/17/5bf1b52ba211d2954f0000e8353423/content.htm

According to the tab pressed,you can write the coding in PAI and display the output in PBO.

Following is the sample code.I am using custom container.

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
*&---------------------------------------------------------------------*
* This is used to catch the pressed tab
*----------------------------------------------------------------------*
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 INPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_9001 INPUT
*&---------------------------------------------------------------------*
* This is used for user command
*----------------------------------------------------------------------*
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.

If you need it in selection screen,check this link.

http://www.sapdevelopment.co.uk/reporting/selscr/selscr_tabstrip.htm

0 Kudos

Hi Jayanthi,

I want to use this tabstrip in report not in module pool program.so could you send me for report.

kiran

0 Kudos

Hi,

Have u seen the code sample i sent to u.

If u cnt view that tell me i will mail u.

0 Kudos

do you mean report output?

then you can just do a call screen in your report to have tabstrip. without that its not possible.

Regards

Raja

0 Kudos

Hi Kiran,

In report,create a screen.Then call the screen from main program.Then write in PBO and PAI as posted by me earlier.The same coding will work.

Kindly reward points if it is helpful.In case of calrifications,get back.

0 Kudos

Hi Jayanthi,

I don't know if it had helped, but the post could have certainly been more readable if you had used the formatting for your code! When you make the post, there's a button called "Code" which will preserve the formatting of your code.

Regards,

Anand Mandalika.

athavanraja
Active Contributor
0 Kudos

check this demo program for tabstrip on report selection-screen.

REPORT  Y_TEST_TABSTRIP.
SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
PARAMETERS: p1(10) TYPE c,
            p2(10) TYPE c,
            p3(10) TYPE c.
SELECTION-SCREEN END OF SCREEN 100.

SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
PARAMETERS: q1(10) TYPE c,
            q2(10) TYPE c,
            q3(10) TYPE c.
SELECTION-SCREEN END OF SCREEN 200.

SELECTION-SCREEN: BEGIN OF TABBED BLOCK mytab FOR 10 LINES,
                  TAB (20) button1 USER-COMMAND push1,
                  TAB (20) button2 USER-COMMAND push2,
                  END OF BLOCK mytab.

INITIALIZATION.
  button1 = 'Selection Screen 1'.
  button2 = 'Selection Screen 2'.
  mytab-prog = sy-repid.
  mytab-dynnr = 100.
  mytab-activetab = 'PUSH1'.

AT SELECTION-SCREEN.
  CASE sy-dynnr.
    WHEN 1000.
      CASE sy-ucomm.
        WHEN 'PUSH1'.
          mytab-dynnr = 100.
        WHEN 'PUSH2'.
          mytab-dynnr = 200.
        WHEN OTHERS.
        ...
      ENDCASE.
      ...
  ENDCASE.

Regards

Raja

Former Member
0 Kudos

Hi,

Tabstrips on a selection screen

*&----


REPORT ztabstrip LINE-SIZE 120 NO STANDARD PAGE HEADING.

TABLES: mara, lfa1, ekpo.

----


selection screen

----


  • Define screen 101 as subscreen

SELECTION-SCREEN BEGIN OF SCREEN 101 AS SUBSCREEN.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t00.

SELECT-OPTIONS matnr FOR mara-matnr.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN END OF SCREEN 101.

  • Define screen 102 as subscreen

SELECTION-SCREEN BEGIN OF SCREEN 102 AS SUBSCREEN.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.

SELECT-OPTIONS: kunnr FOR lfa1-kunnr.

SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN END OF SCREEN 102.

  • Define screen 103 as subscreen

SELECTION-SCREEN BEGIN OF SCREEN 103 AS SUBSCREEN.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.

PARAMETERS werks LIKE ekpo-werks.

SELECTION-SCREEN END OF BLOCK b3.

SELECTION-SCREEN END OF SCREEN 103.

  • Define tab screen

SELECTION-SCREEN BEGIN OF TABBED BLOCK t1 FOR 20 LINES.

SELECTION-SCREEN TAB (10) name1 USER-COMMAND ucomm1 DEFAULT SCREEN 101.

SELECTION-SCREEN TAB (20) name2 USER-COMMAND ucomm2 DEFAULT SCREEN 102.

SELECTION-SCREEN TAB (30) name3 USER-COMMAND ucomm3 DEFAULT SCREEN 103.

SELECTION-SCREEN END OF BLOCK t1.

INITIALIZATION.

name1 = text-n01. "Material

name2 = text-n02. "Vendor

name3 = text-n03. "Plant

I hope this will help. Folloew the same for the reports

Regs,

Venkat Ramanan

0 Kudos

hai venkat,

i created tabstrip.but how to write the queries based upon the tabstrips.

kiran

Former Member
0 Kudos

Hi,

Depending up on the tabstrip name u have selected, u can hadle the queries.

Regs,

Venkat

0 Kudos

Hi,

I have pasted the part of the code

CONSTANTS: BEGIN OF c_main_tab,
           tab1 LIKE sy-ucomm VALUE 'MAIN_TAB_FC1',   "
           tab2 LIKE sy-ucomm VALUE 'MAIN_TAB_FC2',   "
PROCESS BEFORE OUTPUT.
 MODULE STATUS_9001.
  MODULE main_tab_active_tab_set.
  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.

  MODULE main_tab_active_tab_set.

In PBO of the screen,
* DATA FOR TABSTRIP 'MAIN_TAB'
CONTROLS:  main_tab TYPE TABSTRIP.
DATA:      BEGIN OF i_main_tab,
             subscreen   LIKE sy-dynnr,
             prog        LIKE sy-repid VALUE
                              'ZZZ_TEST',
             pressed_tab LIKE sy-ucomm VALUE c_main_tab-tab1,
           END OF i_main_tab.
MODULE main_tab_active_tab_set OUTPUT.

  main_tab-activetab = i_main_tab-pressed_tab.
  CASE i_main_tab-pressed_tab.
    WHEN c_main_tab-tab1.
*   To display report
     i_main_tab-subscreen = '9100'.
      CALL METHOD o_alvgrid1->set_table_for_first_display
      EXPORTING
         is_variant                    = w_variant
         i_save                        = c_lay
         is_layout                     = w_layout
      CHANGING
         it_outtab                     = i_output1[]
         it_fieldcatalog               = i_fieldcat[]
      EXCEPTIONS
         invalid_parameter_combination = 1
         program_error                 = 2
         too_many_lines                = 3
         OTHERS                        = 4.
  IF sy-subrc <> 0.
    MESSAGE i000 WITH text-e06."Error in ALV report display
    LEAVE LIST-PROCESSING.
  ENDIF.

    WHEN c_main_tab-tab2.
*   To display report
      i_main_tab-subscreen = '9200'.

      CALL METHOD o_alvgrid2->set_table_for_first_display
      EXPORTING
         is_variant                    = w_variant
         i_save                        = c_lay
         is_layout                     = w_layout
      CHANGING
         it_outtab                     = i_output2[]
         it_fieldcatalog               = i_fieldcat1[]
      EXCEPTIONS
         invalid_parameter_combination = 1
         program_error                 = 2
         too_many_lines                = 3
         OTHERS                        = 4.
  IF sy-subrc <> 0.
    MESSAGE i005 WITH text-e06."Error in ALV report display
    LEAVE LIST-PROCESSING.
  ENDIF.


WHEN OTHERS.
*      DO NOTHING
  ENDCASE.

ENDMODULE.                 “MAIN_TAB_ACTIVE_TAB_SET OUTPUT
*&---------------------------------------------------------------------*
*&      Module MAIN_TAB_ACTIVE_TAB_GET INPUT
*&---------------------------------------------------------------------*
*       Check & Process the selected Tab
*----------------------------------------------------------------------*
MODULE main_tab_active_tab_get INPUT.


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

ENDMODULE.                 “MAIN_TAB_ACTIVE_TAB_GET INPUT
*&---------------------------------------------------------------------*
*&      Module USER_COMMAND_9001 INPUT
*&---------------------------------------------------------------------*
*       User Command
*----------------------------------------------------------------------*
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
*&---------------------------------------------------------------------*
*&      Module MAIN_TAB_ACTIVE_TAB_SET INPUT
*&---------------------------------------------------------------------*
*       Set sunscreen
*----------------------------------------------------------------------*
MODULE main_tab_active_tab_set INPUT.

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

ENDMODULE.                 “MAIN_TAB_ACTIVE_TAB_SET INPUT
[code]

if the first tab is selected then it will call the screen 9100 and the output will be in i_output1[].

U can write queries and pass to output table.

Hope this helps. Just refer the doucment, i haev given the steps to be followed.

0 Kudos

Hi venkat,

how to know which tabstrip i have selected.

Regs,

kiran

0 Kudos

Hai Judith,

iam not using the module pool ,instead iam using report.i want tabstrip in coding.

Regs,

kiran

0 Kudos

Hi,

This <b>is not a module pool</b>, go through that properly that is an <b>ALV report with Tab strip</b>.

See it clearly and reply.

Former Member
0 Kudos

Hey,

Did u get it or not ??.. Loop at the screen and check for the tab strip selected and do ur piece of coding there.

It will work.

Regs,

Venkat

0 Kudos

Venkat,

could you send me the sample code of that for the example you have given.

Regs,

kiran

Former Member
0 Kudos

Hi,

Loop through the screen and check the screen attribut name u have selected. If it matches the tab strip name u have selected, do the necessary coding there.

What probs ??

Regs,

Venkat