table controls in tab strip

Upload: sanjeev-singh

Post on 06-Jul-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/17/2019 Table Controls in Tab Strip

    1/14

    Table Controls in Tab Strip

    Tab strip is a screen container where we can have multiple screen fields from different tables orsame table. Tab contains two parts – tab title and page area. Here the tab title works like a push

     button. In the page area of tab we need to design a sub screen. Each tab is a container of each subscreen where we can show different fields. We can have table control also in that sub screen. We

    have to looping the internal table with the table control to create a table control in a tab strip.

    In the following example we have created a main screen where an input field of Airline code is

    there. ased on that input the program will fetch data from Airline! "light schedule and "lightdatabase table. After that the program will displa# the details inside the three tabs. Here at the

    first tab we are declaring the details of Airline. This is a normal displa# because we are selecting

    onl# one input of airline code. $ow according to the function one airline can contain one or moreflight schedule and flight details. %o we are displa#ing those multiple data b# using a table

    control created in different tabs.

    %tep – &'At first we need to create the different includes of the module pool.

    INCLUDE mz_test_top . " global DataINCLUDE mz_test_o01 . " PBO-Modules

    INCLUDE mz_test_i01 . " PAI-ModulesINCLUDE mz_test_f01 . " FORM-Routines

    %tep – ('

     $ext we are declaring the variables! structures and tables at the top include.

    *-------Declaring tables for screen fields-----------------------------*TABLES: scarr, spfli, sfli!t.

    T"#ES:

    *------Airline internal structure--------------------------------------*  BE$IN %& t'_scarr,

      carri( T"#E scarr)carri(,  carr*ame T"#E scarr)carr*ame,

      c+rrco(e T"#E scarr)c+rrco(e,  END %& t'_scarr,

    *------Flight schedule internal structure------------------------------*

      BE$IN %& t'_spfli,  carri( T"#E spfli)carri(,

      co**i( T"#E spfli)co**i(,  cit'from T"#E spfli)cit'from,

      airpfrom T"#E spfli)airpfrom,

      cit'to T"#E spfli)cit'to,

      airpto T"#E spfli)airpto,  (eptime T"#E spfli)(eptime,

      arrtime T"#E spfli)arrtime,  (ista*ce T"#E spfli)(ista*ce,

      END %& t'_spfli,

  • 8/17/2019 Table Controls in Tab Strip

    2/14

    *------Flight internal structure---------------------------------------*

      BE$IN %& t'_sfli!t,  carri( T"#E sfli!t)carri(,

      co**i( T"#E sfli!t)co**i(,  fl(ate T"#E sfli!t)fl(ate,

      price T"#E sfli!t)price,  c+rre*c' T"#E sfli!t)c+rre*c',

      seatsma T"#E sfli!t)seatsma,

      seatsocc T"#E sfli!t)seatsocc,

      END %& t'_sfli!t.

    *-----Work area internal table declaration---------------------------*DATA: -a_scarr T"#E t'_scarr,

      -a_spfli T"#E t'_spfli,

      it_spfli T"#E TABLE %& t'_spfli,

      -a_sfli!t T"#E t'_sfli!t,  it_sfli!t T"#E TABLE %& t'_sfli!t.

    DATA: o_co(e T"#E s')+comm, "!ser coand ca#turing $ariable

      /_carri( T"#E scarr)carri(. "%creen field $ariable

    C%NT%LS:

    *---------Declaring the tab stri#--------------------------------------*

      ts_air T"#E TABSTI#,

    *---------Declaring the table controls---------------------------------*  tc_spfli T"#E TABLEIE2 USIN$ SCEEN 3004,

      tc_sfli!t T"#E TABLEIE2 USIN$ SCEEN 3005.

    %tep – )'

     $ow we are creating the main screen *++&. We shall have one single main screen which containsthe tab strip. %everal other tabs will contain several other sub screens.

    #%CESS BE&%E %UT#UT.

    *--------&alling the odule for '!I status of PBO----------------------*

      6%DULE stat+s_3001.

    *------&alling the sub screens (hich contains the table control--------*  CALL SUBSCEEN s+71 INCLUDIN$ s')repi( 830098.

      CALL SUBSCEEN s+79 INCLUDIN$ s')repi( 830048.  CALL SUBSCEEN s+74 INCLUDIN$ s')repi( 830058.

    #%CESS A&TE IN#UT.

    *------&alling the sub screens (hich contains the table control--------*

      CALL SUBSCEEN s+71.  CALL SUBSCEEN s+79.  CALL SUBSCEEN s+74.

    *--------&alling the odule to ca#ture the s)-uco--------------------*

      6%DULE +ser_comma*(_3001.

  • 8/17/2019 Table Controls in Tab Strip

    3/14

    Here we have call other sub screens which belong to different tabs. The sub screens are *++(!*++) , *++-.

    %tep – -'

     $ow we are creating the /I status for the main screen.

    6%DULE stat+s_3001 %UT#UT.

      SET #&)STATUS 8#&_6AIN_30018. "'!I status

      SET TITLEBA 8TI_6AIN_30018. "'!I title

    END6%DULE. " status+,, O!.P!. 

    %tep – 0'

    After that we have to create the user command functionalit# 1push button2 in 3AI.

    6%DULE +ser_comma*(_3001 IN#UT.

      CASE o_co(e.  2EN 8TAB18. ".AB tab title (orks like a #ush button  ts_air)acti/eta7 ; 8TAB18.

      2EN 8TAB98. ".AB/ tab title (orks like a #ush button  ts_air)acti/eta7 ; 8TAB98.

      2EN 8TAB48. ".AB0 tab title (orks like a #ush button

      ts_air)acti/eta7 ; 8TAB48.

      2EN 8DIS#8. "Dis#la) #ush button

      #E&%6 et_airli*e.

  • 8/17/2019 Table Controls in Tab Strip

    4/14

      #E&%6 et_fli!t_sc!e(+le.

      #E&%6 et_fli!t.

      2EN 8CL8. "&lear #ush button  #E&%6 clear_proram.

      2EN 8BAC

  • 8/17/2019 Table Controls in Tab Strip

    5/14

      ENDI&.

    END&%6. " getflightschedule*---------------------------------------------------------------------*

    * For getflight*---------------------------------------------------------------------*

    * 'et data fro Flight table*----------------------------------------------------------------------*

    &%6 et_fli!t .

      I& scarr)carri( IS N%T INITIAL.  SELECT carri( co**i( fl(ate price

      c+rre*c' seatsma seatsocc  &%6 sfli!t INT% TABLE it_sfli!t

      2EE carri( ; scarr)carri(.

      ENDI&.

    END&%6. " getflight

    %ince we are selecting one single airline code to fetch details on tab & we have selected singlerecord from airline table into work area. 5est of the selection has been done b# using the internaltables which will be displa#ed on the table controls.

    %tep – 6'

    After that we have created the 78EA5 button functionalit#.

    *---------------------------------------------------------------------*

    * For clear#rogra

    *---------------------------------------------------------------------*

    * &learing refreshing all screen fields and tables*----------------------------------------------------------------------*

    &%6 clear_proram .

      CLEA: scarr, spfli, sfli!t, /_carri(,  -a_scarr, -a_spfli, -a_sfli!t.

      E&ES: it_spfli, it_sfli!t.

    END&%6. " clear#rogra

    %tep – 9'

    %ince tab& does not contain an# user command functionalit# we haven:t created an# 3; and

    3AI on that sub screen.

  • 8/17/2019 Table Controls in Tab Strip

    6/14

    Here at tab( 1*++) sub screen2 we are declaring the table control for flight schedule. Hence wehave to loop internal table with table control at 3; and 3AI.

    #%CESS BE&%E %UT#UT.

    * MOD!23 %.A.!%+,,04

    *------A##l)ing the table control (ith the internal table--------------*

      L%%# AT it_spfli INT% -a_spfli 2IT C%NT%L tc_spfli.

      "Po#ulating the table control (ith table data  6%DULE (ispla'_tc_spfli.

      ENDL%%#.

    #%CESS A&TE IN#UT.

    *------2oo#ing the out#ut table for ne5t lines at scrolling------------*

      L%%# AT it_spfli.

      "Modif) the out#ut table (ith current line  6%DULE mo(if'_tc_spfli.  ENDL%%#.

    * MOD!23 !%3R&OMMA1D+,,04

  • 8/17/2019 Table Controls in Tab Strip

    7/14

    Here we are not declaring an# /I status and button functionalit# since we don:t need that.

    %tep – *'

     $ow we are creating the 3; module to populate the records at the table control.

    6%DULE (ispla'_tc_spfli %UT#UT.

    *---------.o acti$ate the scrolling o#tion of table control------------*  #E&%6 c+rre*t_li*e_spfli.

    *-------Mo$ing data fro (ork area to screen fields--------------------*

      spfli)carri( ; -a_spfli)carri(.  spfli)co**i( ; -a_spfli)co**i(.

      spfli)cit'from ; -a_spfli)cit'from.  spfli)airpfrom ; -a_spfli)airpfrom.

      spfli)cit'to ; -a_spfli)cit'to.

      spfli)airpto ; -a_spfli)airpto.

      spfli)(eptime ; -a_spfli)(eptime.  spfli)arrtime ; -a_spfli)arrtime.

      spfli)(ista*ce ; -a_spfli)(ista*ce.

    END6%DULE. " dis#la)tcs#fli O!.P!. 

    %tep – &+'Here we have declared a sub routine to activate the scrolling option in the table control.

    *---------------------------------------------------------------------** For currentlines#fli

    *---------------------------------------------------------------------** %crolling o#eration in flight schedule table control

    *----------------------------------------------------------------------*

    &%6 c+rre*t_li*e_spfli .

      "Describing the internal table to #o#ulate the s)-dbcnt

      DESCIBE TABLE it_spfli LINES s')(7c*t.

      "Field current line of table control needs to be #o#ulated   "(ith s)-loo#c - loo# inforation in table control

      tc_spfli)c+rre*t_li*e ; s')loopc.

      "Field lines is #o#ulated (ith the nuber of table lines  "(hich has been #rocessed )et

      tc_spfli)li*es ; s')(7c*t.

    END&%6. " currentlines#fli

    %tep – &&'

     $ow we have to modif# the internal table in table control at 3AI. The scrolling function alwa#sworks at 3AI.

  • 8/17/2019 Table Controls in Tab Strip

    8/14

    6%DULE mo(if'_tc_spfli IN#UT.

      EAD TABLE it_spfli INT% -a_spfli

      INDE= tc_spfli)c+rre*t_li*e.

      I& s')s+7rc ; 0.  6%DI&" it_spfli &%6 -a_spfli INDE= tc_spfli)c+rre*t_li*e.  ENDI&.

    END6%DULE. " odif)tcs#fli I1P!. 

    %tep – &('%imilarl# we are creating another sub screen for another tab. The screen flow logic will be

    similar as follows.

    #%CESS BE&%E %UT#UT.

    * MOD!23 %.A.!%+,,64

    *------A##l)ing the table control (ith the internal table--------------*  L%%# AT it_sfli!t INT% -a_sfli!t 2IT C%NT%L tc_sfli!t.

      "Po#ulating the table control (ith table data

      6%DULE (ispla'_tc_sfli!t.  ENDL%%#.

    #%CESS A&TE IN#UT.

    *------2oo#ing the out#ut table for ne5t lines at scrolling------------*

      L%%# AT it_sfli!t.

      "Modif) the out#ut table (ith current line  6%DULE mo(if'_tc_sfli!t.

      ENDL%%#.* MOD!23 !%3R&OMMA1D+,,64

  • 8/17/2019 Table Controls in Tab Strip

    9/14

    %tep – &)'

     $ow the 3; module is as following.

    6%DULE (ispla'_tc_sfli!t %UT#UT.

    *---------.o acti$ate the scrolling o#tion of table control------------*

      #E&%6 c+rre*t_li*e_sfli!t.

    *-------Mo$ing data fro (ork area to screen fields--------------------*

      sfli!t)carri( ; -a_sfli!t)carri(.

      sfli!t)co**i( ; -a_sfli!t)co**i(.

      sfli!t)fl(ate ; -a_sfli!t)fl(ate.  sfli!t)price ; -a_sfli!t)price.

      sfli!t)c+rre*c' ; -a_sfli!t)c+rre*c'.  sfli!t)seatsma ; -a_sfli!t)seatsma.

      sfli!t)seatsocc ; -a_sfli!t)seatsocc.

    END6%DULE. " dis#la)tcsflight O!.P!. 

    %tep – &-'%imilarl# we are creating the sub routine for scrolling option of table control.

    &%6 c+rre*t_li*e_sfli!t .

      "Describing the internal table to #o#ulate the s)-dbcnt

      DESCIBE TABLE it_sfli!t LINES s')(7c*t.

      "Field current line of table control needs to be #o#ulated   "(ith s)-loo#c - loo# inforation in table control

      tc_sfli!t)c+rre*t_li*e ; s')loopc.

      "Field lines is #o#ulated (ith the nuber of table lines

      "(hich has been #rocessed )et  tc_sfli!t)li*es ; s')(7c*t.

    END&%6. " currentlinesflight

    %tep – &0'%imilarl# we are modif#ing the internal table with current line of table control.

    6%DULE mo(if'_tc_sfli!t IN#UT.

      EAD TABLE it_sfli!t INT% -a_sfli!t

      INDE= tc_sfli!t)c+rre*t_li*e.

      I& s')s+7rc ; 0.  6%DI&" it_sfli!t &%6 -a_sfli!t INDE= tc_sfli!t)c+rre*t_li*e.

      ENDI&.

    END6%DULE. " odif)tcsflight I1P!. 

    %tep – &4'

    "inall# we create a transaction code to run the module pool from the s#stem.

  • 8/17/2019 Table Controls in Tab Strip

    10/14

     $ow we have the output of this.

    After giving the proper Airline code click the

  • 8/17/2019 Table Controls in Tab Strip

    11/14

     $ow click on the "light %chedule tab.

  • 8/17/2019 Table Controls in Tab Strip

    12/14

    After that click on the "light Information tab.

     $ow we are scrolling down to the last row of this table.

  • 8/17/2019 Table Controls in Tab Strip

    13/14

    "inall# we click on the 7lear button and all those screens will be cleared.

  • 8/17/2019 Table Controls in Tab Strip

    14/14