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.
*&---------------------------------------------------------------------*
*& Report Z_TABS *&
*&---------------------------------------------------------------------*
*&Tab Strip in Report Program *&
*&---------------------------------------------------------------------*
report z_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.
The first tab has the customer details, the second tab has the account details and the third one has the transaction details.
*&---------------------------------------------------------------------*
*& Report Z_TABS *&
*&---------------------------------------------------------------------*
*&Tab Strip in Report Program *&
*&---------------------------------------------------------------------*
report z_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.
No comments:
Post a Comment