‎2006 Dec 12 1:50 PM
hello all,
can some ne tellme abt the concept of tabstrip controls. i want even the material for studying.
thanks & regards,
seenu
‎2006 Dec 12 1:52 PM
Maybe this will help you out:
http://help.sap.com/saphelp_nw04/helpdata/en/00/deb23789e95378e10000009b38f8cf/content.htm
http://www.sapdevelopment.co.uk/reporting/selscr/selscr_tabstrip.htm
Regards,
Santosh
‎2006 Dec 12 1:55 PM
Hi,
Go through the following Document for Creation of Table Controls
1) Screen tables
A table can be created in transaction. These tables, when designed on the screen are called as SCREEN TABLES.
These are of two types.
Table Controls and Step loops
These tables are treated as Loops.
2)Features of Table Controls
Data is displayed in the form of table.
Table control gives user the feeling of an actual table.
You can scroll through the table vertically as well as horizontally.
You can select rows and columns.
You can resize the with of columns.
You can have separator lines between rows and columns.
Automatic resizing of the table when the user resizes the window.
You can update information in the table control and it can be updated in the database table by writing code for it.
3)Steps for creating table control
Declaration of table control in module pool program.
Designing of table controls on the screen.
Passing data to table control in flow logic.
4)Declaration of TC in MPP
syntax:
controls <name of table control> type tableview using screen <escreen no.f>.
5)Designing Table control on screen
Click on Table in Control bar and place it on the screen. You can adjust the length and width of the Table Control.
Name the table control.(same name as given in data declaration).
From dictionary object OR from program fields select the fields and place them in the table control
6)Passing data to table control
Usually transfer of data from program to screen is automatic.
In case of TC, you need to explicitly transfer the data to table control.
ABAP/4 provides Loop statement, which is associated with flow logic to transfer the data.
7)Passing of data contd.
PBO.
Loop at <name of internal table> with control <name of table control> cursor <scroll variable>.
modulecc.
Endloop.
PAI.
Loop at < name of internal table>.Endloop.
8)Scroll variables
Top_line : the row of table where the screen display starts.
Current_line : the row currently being processed inside a loop.
9)Transfer of data from prg to TC.
With eLoop at cf statement, the first row is placed in the header of internal table.
If any module is specified between Loop and End loop, it will be executed. In this module, generally we will be assigning this internal table fields to table control screen fields.
The row in internal table is transferred to the TC as stated in the eLoop atc..f statement.
The system encounters the eEndloopf statement and control is passed back to the next line of internal table.
In the same way all the records of the internal table are passed to the TC.
following is the example code
TABLES : mska, mchb.
data : begin of t_batch occurs 0,
matnr like mska-matnr,
werks like mska-werks,
lgort like mska-lgort,
charg like mska-charg,
vbeln like mska-vbeln,
clabs like mchb-clabs,
end of t_batch.
start-of-selection.
call screen 100.
* DECLARATION OF TABLECONTROL 'TAB_CONTROL' ITSELF
CONTROLS: TAB_CONTROL TYPE TABLEVIEW USING SCREEN 0100.
* LINES OF TABLECONTROL 'TAB_CONTROL'
DATA: G_TAB_CONTROL_LINES LIKE SY-LOOPC.
DATA: OK_CODE LIKE SY-UCOMM.
* OUTPUT MODULE FOR TABLECONTROL 'TAB_CONTROL':
* GET LINES OF TABLECONTROL
MODULE TAB_CONTROL_GET_LINES OUTPUT.
G_TAB_CONTROL_LINES = SY-LOOPC.
ENDMODULE.
* INPUT MODULE FOR TABLECONTROL 'TAB_CONTROL': PROCESS USER COMMAND
MODULE TAB_CONTROL_USER_COMMAND INPUT.
PERFORM USER_OK_TC USING 'TAB_CONTROL'
'T_BATCH'
' '
CHANGING OK_CODE.
ENDMODULE.
*----------------------------------------------------------------------*
* INCLUDE TABLECONTROL_FORMS *
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form USER_OK_TC *
*&---------------------------------------------------------------------*
FORM USER_OK_TC USING P_TC_NAME TYPE DYNFNAM
P_TABLE_NAME
P_MARK_NAME
CHANGING P_OK LIKE SY-UCOMM.
*-BEGIN OF LOCAL DATA--------------------------------------------------*
DATA: L_OK TYPE SY-UCOMM,
L_OFFSET TYPE I.
*-END OF LOCAL DATA----------------------------------------------------*
* Table control specific operations *
* evaluate TC name and operations *
SEARCH P_OK FOR P_TC_NAME.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
L_OFFSET = STRLEN( P_TC_NAME ) + 1.
L_OK = P_OK+L_OFFSET.
* execute general and TC specific operations *
CASE L_OK.
WHEN 'INSR'. "insert row
PERFORM FCODE_INSERT_ROW USING P_TC_NAME
P_TABLE_NAME.
CLEAR P_OK.
WHEN 'DELE'. "delete row
PERFORM FCODE_DELETE_ROW USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME.
CLEAR P_OK.
WHEN 'P--' OR "top of list
'P-' OR "previous page
'P+' OR "next page
'P++'. "bottom of list
PERFORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME
L_OK.
CLEAR P_OK.
* WHEN 'L--'. "total left
* PERFORM FCODE_TOTAL_LEFT USING P_TC_NAME.
*
* WHEN 'L-'. "column left
* PERFORM FCODE_COLUMN_LEFT USING P_TC_NAME.
*
* WHEN 'R+'. "column right
* PERFORM FCODE_COLUMN_RIGHT USING P_TC_NAME.
*
* WHEN 'R++'. "total right
* PERFORM FCODE_TOTAL_RIGHT USING P_TC_NAME.
*
WHEN 'MARK'. "mark all filled lines
PERFORM FCODE_TC_MARK_LINES USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME .
CLEAR P_OK.
WHEN 'DMRK'. "demark all filled lines
PERFORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME .
CLEAR P_OK.
* WHEN 'SASCEND' OR
* 'SDESCEND'. "sort column
* PERFORM FCODE_SORT_TC USING P_TC_NAME
* l_ok.
ENDCASE.
ENDFORM. " USER_OK_TC
*&---------------------------------------------------------------------*
*& Form FCODE_INSERT_ROW *
*&---------------------------------------------------------------------*
FORM fcode_insert_row
USING P_TC_NAME TYPE DYNFNAM
P_TABLE_NAME .
*-BEGIN OF LOCAL DATA--------------------------------------------------*
DATA L_LINES_NAME LIKE FELD-NAME.
DATA L_SELLINE LIKE SY-STEPL.
DATA L_LASTLINE TYPE I.
DATA L_LINE TYPE I.
DATA L_TABLE_NAME LIKE FELD-NAME.
FIELD-SYMBOLS <TC> TYPE CXTAB_CONTROL.
FIELD-SYMBOLS <TABLE> TYPE STANDARD TABLE.
FIELD-SYMBOLS <LINES> TYPE I.
*-END OF LOCAL DATA----------------------------------------------------*
ASSIGN (P_TC_NAME) TO <TC>.
* get the table, which belongs to the tc *
CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
ASSIGN (L_TABLE_NAME) TO <TABLE>. "not headerline
* get looplines of TableControl
CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_LINES_NAME.
ASSIGN (L_LINES_NAME) TO <LINES>.
* get current line
GET CURSOR LINE L_SELLINE.
IF SY-SUBRC <> 0. " append line to table
L_SELLINE = <TC>-LINES + 1.
* set top line and new cursor line *
IF L_SELLINE > <LINES>.
<TC>-TOP_LINE = L_SELLINE - <LINES> + 1 .
L_LINE = 1.
ELSE.
<TC>-TOP_LINE = 1.
L_LINE = L_SELLINE.
ENDIF.
ELSE. " insert line into table
L_SELLINE = <TC>-TOP_LINE + L_SELLINE - 1.
* set top line and new cursor line *
L_LASTLINE = L_SELLINE + <LINES> - 1.
IF L_LASTLINE <= <TC>-LINES.
<TC>-TOP_LINE = L_SELLINE.
L_LINE = 1.
ELSEIF <LINES> > <TC>-LINES.
<TC>-TOP_LINE = 1.
L_LINE = L_SELLINE.
ELSE.
<TC>-TOP_LINE = <TC>-LINES - <LINES> + 2 .
L_LINE = L_SELLINE - <TC>-TOP_LINE + 1.
ENDIF.
ENDIF.
* insert initial line
INSERT INITIAL LINE INTO <TABLE> INDEX L_SELLINE.
<TC>-LINES = <TC>-LINES + 1.
* set cursor
SET CURSOR LINE L_LINE.
ENDFORM. " FCODE_INSERT_ROW
*&---------------------------------------------------------------------*
*& Form FCODE_DELETE_ROW *
*&---------------------------------------------------------------------*
FORM fcode_delete_row
USING P_TC_NAME TYPE DYNFNAM
P_TABLE_NAME
P_MARK_NAME .
*-BEGIN OF LOCAL DATA--------------------------------------------------*
DATA L_TABLE_NAME LIKE FELD-NAME.
FIELD-SYMBOLS <TC> TYPE cxtab_control.
FIELD-SYMBOLS <TABLE> TYPE STANDARD TABLE.
FIELD-SYMBOLS <WA>.
FIELD-SYMBOLS <MARK_FIELD>.
*-END OF LOCAL DATA----------------------------------------------------*
ASSIGN (P_TC_NAME) TO <TC>.
* get the table, which belongs to the tc *
CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
ASSIGN (L_TABLE_NAME) TO <TABLE>. "not headerline
* delete marked lines *
DESCRIBE TABLE <TABLE> LINES <TC>-LINES.
LOOP AT <TABLE> ASSIGNING <WA>.
* access to the component 'FLAG' of the table header *
ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
IF <MARK_FIELD> = 'X'.
DELETE <TABLE> INDEX SYST-TABIX.
IF SY-SUBRC = 0.
<TC>-LINES = <TC>-LINES - 1.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " FCODE_DELETE_ROW
*&---------------------------------------------------------------------*
*& Form COMPUTE_SCROLLING_IN_TC
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_TC_NAME name of tablecontrol
* -->P_OK ok code
*----------------------------------------------------------------------*
FORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME
P_OK.
*-BEGIN OF LOCAL DATA--------------------------------------------------*
DATA L_TC_NEW_TOP_LINE TYPE I.
DATA L_TC_NAME LIKE FELD-NAME.
DATA L_TC_LINES_NAME LIKE FELD-NAME.
DATA L_TC_FIELD_NAME LIKE FELD-NAME.
FIELD-SYMBOLS <TC> TYPE cxtab_control.
FIELD-SYMBOLS <LINES> TYPE I.
*-END OF LOCAL DATA----------------------------------------------------*
ASSIGN (P_TC_NAME) TO <TC>.
* get looplines of TableControl
CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_TC_LINES_NAME.
ASSIGN (L_TC_LINES_NAME) TO <LINES>.
* is no line filled? *
IF <TC>-LINES = 0.
* yes, ... *
L_TC_NEW_TOP_LINE = 1.
ELSE.
* no, ... *
CALL FUNCTION 'SCROLLING_IN_TABLE'
EXPORTING
ENTRY_ACT = <TC>-TOP_LINE
ENTRY_FROM = 1
ENTRY_TO = <TC>-LINES
LAST_PAGE_FULL = 'X'
LOOPS = <LINES>
OK_CODE = P_OK
OVERLAPPING = 'X'
IMPORTING
ENTRY_NEW = L_TC_NEW_TOP_LINE
EXCEPTIONS
NO_ENTRY_OR_PAGE_ACT = 01
NO_ENTRY_TO = 02
NO_OK_CODE_OR_PAGE_GO = 03
OTHERS = 99.
ENDIF.
* get actual tc and column *
GET CURSOR FIELD L_TC_FIELD_NAME
AREA L_TC_NAME.
IF SYST-SUBRC = 0.
IF L_TC_NAME = P_TC_NAME.
* set actual column *
SET CURSOR FIELD L_TC_FIELD_NAME LINE 1.
ENDIF.
ENDIF.
* set the new top line *
<TC>-TOP_LINE = L_TC_NEW_TOP_LINE.
ENDFORM. " COMPUTE_SCROLLING_IN_TC
*&---------------------------------------------------------------------*
*& Form FCODE_TC_MARK_LINES
*&---------------------------------------------------------------------*
* marks all TableControl lines
*----------------------------------------------------------------------*
* -->P_TC_NAME name of tablecontrol
*----------------------------------------------------------------------*
FORM FCODE_TC_MARK_LINES USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME.
*-BEGIN OF LOCAL DATA--------------------------------------------------*
DATA L_TABLE_NAME LIKE FELD-NAME.
FIELD-SYMBOLS <TC> TYPE cxtab_control.
FIELD-SYMBOLS <TABLE> TYPE STANDARD TABLE.
FIELD-SYMBOLS <WA>.
FIELD-SYMBOLS <MARK_FIELD>.
*-END OF LOCAL DATA----------------------------------------------------*
ASSIGN (P_TC_NAME) TO <TC>.
* get the table, which belongs to the tc *
CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
ASSIGN (L_TABLE_NAME) TO <TABLE>. "not headerline
* mark all filled lines *
LOOP AT <TABLE> ASSIGNING <WA>.
* access to the component 'FLAG' of the table header *
ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
<MARK_FIELD> = 'X'.
ENDLOOP.
ENDFORM. "fcode_tc_mark_lines
*&---------------------------------------------------------------------*
*& Form FCODE_TC_DEMARK_LINES
*&---------------------------------------------------------------------*
* demarks all TableControl lines
*----------------------------------------------------------------------*
* -->P_TC_NAME name of tablecontrol
*----------------------------------------------------------------------*
FORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME .
*-BEGIN OF LOCAL DATA--------------------------------------------------*
DATA L_TABLE_NAME LIKE FELD-NAME.
FIELD-SYMBOLS <TC> TYPE cxtab_control.
FIELD-SYMBOLS <TABLE> TYPE STANDARD TABLE.
FIELD-SYMBOLS <WA>.
FIELD-SYMBOLS <MARK_FIELD>.
*-END OF LOCAL DATA----------------------------------------------------*
ASSIGN (P_TC_NAME) TO <TC>.
* get the table, which belongs to the tc *
CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
ASSIGN (L_TABLE_NAME) TO <TABLE>. "not headerline
* demark all filled lines *
LOOP AT <TABLE> ASSIGNING <WA>.
* access to the component 'FLAG' of the table header *
ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
<MARK_FIELD> = SPACE.
ENDLOOP.
ENDFORM. "fcode_tc_mark_linesi hope it will help u, here we use internal table t_batch for making Table control from wizard.
For documentation you can go to saphelp.com
and for another example you can goto transaction code abapdocu
then screens - complex screen
Regards,
Pankaj Singh
<i><b>***** Reward all helpful answers</b></i>
‎2006 Dec 12 2:01 PM
Hi,
Iam sorry,i misinterpreted your question to be table control..
this is for tabstrip --
Choose the Tabstrip Wizard in the screen and place it in the screen and ´give continue.
It will ask for the number of tabs. Default is 2.
Then Name the tabs according to ur requirement.
Then in the PBO
write like this
CAll subscreen sub1 including the sy-repid '0100'.
and so on.
Hope this is enough for u to create a tabstrip with wizard.
It will automatically writes the code for u.
SAMPLE CODE -
[code]REPORT demo_dynpro_tabstrip_server.
CONTROLS mytabstrip TYPE TABSTRIP.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA number TYPE sy-dynnr.
mytabstrip-activetab = 'PUSH2'.
number = '0120'.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE user_command INPUT.
save_ok = ok_code.
CLEAR ok_code.
IF save_ok = 'OK'.
MESSAGE i888(sabapdocu) WITH 'MYTABSTRIP-ACTIVETAB ='
mytabstrip-activetab.
ELSE.
mytabstrip-activetab = save_ok.
CASE save_ok.
WHEN 'PUSH1'.
number = '0110'.
WHEN 'PUSH2'.
number = '0120'.
WHEN 'PUSH3'.
number = '0130'.
ENDCASE.
ENDIF.
ENDMODULE.
regards,
pankaj singh
‎2006 Dec 12 2:02 PM
Hi,
Iam sorry,i misinterpreted your question to be table control..
this is for tabstrip --
Choose the Tabstrip Wizard in the screen and place it in the screen and ´give continue.
It will ask for the number of tabs. Default is 2.
Then Name the tabs according to ur requirement.
Then in the PBO
write like this
CAll subscreen sub1 including the sy-repid '0100'.
and so on.
Hope this is enough for u to create a tabstrip with wizard.
It will automatically writes the code for u.
SAMPLE CODE -
[code]REPORT demo_dynpro_tabstrip_server.
CONTROLS mytabstrip TYPE TABSTRIP.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA number TYPE sy-dynnr.
mytabstrip-activetab = 'PUSH2'.
number = '0120'.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE user_command INPUT.
save_ok = ok_code.
CLEAR ok_code.
IF save_ok = 'OK'.
MESSAGE i888(sabapdocu) WITH 'MYTABSTRIP-ACTIVETAB ='
mytabstrip-activetab.
ELSE.
mytabstrip-activetab = save_ok.
CASE save_ok.
WHEN 'PUSH1'.
number = '0110'.
WHEN 'PUSH2'.
number = '0120'.
WHEN 'PUSH3'.
number = '0130'.
ENDCASE.
ENDIF.
ENDMODULE.
regards,
pankaj singh