Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Hi,

   This code snippet shows how to create Tabs in a Normal Report Program.

The first tab has the customer details, the second tab has the account details and the third one has the transaction details.

Error rendering macro 'code': Invalid value specified for parameter 'lang'
*&---------------------------------------------------------------------*
*& Report  Z_TABS
*&
*&---------------------------------------------------------------------*
*&Tab Strip in Report Program
*&
*&---------------------------------------------------------------------*
REPORT  Z_ARU_TABS.
TABLES: ZCUST_MASTER2,ZACC_MASTER2,ZTRANS_MASTER2.
*---------------------------------------------------------------------*
*   Internal Tables                                                *
*---------------------------------------------------------------------*

DATA : BEGIN OF WI_ZCUST_MASTER2 OCCURS 0,
        ZCUSTID LIKE ZCUST_MASTER2-ZCUSTID,
        ZCUSTNAME LIKE ZCUST_MASTER2-ZCUSTNAME,
        ZADDR LIKE ZCUST_MASTER2-ZADDR,
        ZCITY LIKE ZCUST_MASTER2-ZCITY,
        ZSTATE LIKE ZCUST_MASTER2-ZSTATE,
        ZCOUNTRY LIKE ZCUST_MASTER2-ZCOUNTRY,
        ZPHONE LIKE ZCUST_MASTER2-ZPHONE,
        ZEMAIL LIKE ZCUST_MASTER2-ZEMAIL,
        ZFAX LIKE ZCUST_MASTER2-ZFAX,
        ZSTAT LIKE ZCUST_MASTER2-ZSTAT,
END OF WI_ZCUST_MASTER2.

DATA : BEGIN OF WI_ZACC_MASTER2 OCCURS 0,
         ZACCNO LIKE ZACC_MASTER2-ZACCNO,
         ZCUSTID  LIKE ZACC_MASTER2-ZCUSTID,
         ZACCTYPE LIKE ZACC_MASTER2-ZACCTYPE,
         ZBAL LIKE ZACC_MASTER2-ZBAL,
         ZACCDATE LIKE ZACC_MASTER2-ZACCDATE,
         ZSTAT LIKE ZACC_MASTER2-ZSTAT,
END OF WI_ZACC_MASTER2.

*---------------------------------------------------------------------*
*   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 CUSTID FOR ZCUST_MASTER2-ZCUSTID.
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: ACCNO FOR ZACC_MASTER2-ZACCNO.
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 TRANID LIKE ZTRANS_MASTER2-ZTRANID.
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.   "CUSTOMER ID
  NAME2 = TEXT-N02.   "ACCOUNT NUMBER
  NAME3 = TEXT-N03.   "TRANSACTION ID
START-OF-SELECTION.
  SKIP SY-LSIND.
*-------------------------------------------------------------*
* To Display Customer id Tab Details
*-------------------------------------------------------------*
  SELECT * FROM ZCUST_MASTER2 INTO CORRESPONDING FIELDS OF TABLE WI_ZCUST_MASTER2 WHERE ZCUSTID IN CUSTID.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM = SY-REPID
      I_STRUCTURE_NAME   = 'ZCUST_MASTER2'
      I_GRID_TITLE       = 'Customer Details'
    TABLES
      T_OUTTAB           = WI_ZCUST_MASTER2
    EXCEPTIONS
      PROGRAM_ERROR      = 1
      OTHERS             = 2.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
*-------------------------------------------------------------*
* To Display Account Number Tab Details
*-------------------------------------------------------------*
  SELECT * FROM ZACC_MASTER2 INTO CORRESPONDING FIELDS OF TABLE WI_ZACC_MASTER2 WHERE ZACCNO IN ACCNO.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM = SY-REPID
      I_STRUCTURE_NAME   = 'ZACC_MASTER2'
      I_GRID_TITLE       = 'Account Details'
    TABLES
      T_OUTTAB           = WI_ZACC_MASTER2
    EXCEPTIONS
      PROGRAM_ERROR      = 1
      OTHERS             = 2.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Regards,

Arunsri B.S