Table Control Example
Hi Experts,
Can any give me Complete Example for Table control like
1) Addition, or New Entrey, INsert ,
2) Delete,
3)Clear,
4)SAVE,
5) Change,
6)Find
Thanks
Point is given to ..
hi,
first declare one internal table with all the fields u want in table control.
Then make table control by wizard using that internal table....
And then made buttons in GUI STATUS....
In USER_COMMAND_1000 module of PAI write,
MODULE user_command_1000 INPUT.
CASE ok_code.
WHEN 'BACK' OR 'UP' OR 'CANC'.
LEAVE PROGRAM.
WHEN 'SAVE'.
ur code.....
WHEN 'CHANGE'.
ur code.....
WHEN 'DELETE'.
ur code.....
WHEN 'CLEAR'.
CLEAR empcod.
CLEAR empnam.
ENDCASE.
ENDMODULE. " USER_COMMAND_1000 INPUT
Similar Messages
-
Copy selected lines in the table control
Hi friends,
I Have a screen 200 in which i have a button COPY and table control.
In my table control i have 6 lines of data.
now my requirement is when i select any lines ie : let us say i ahve selected 1 , 3 , 5 lines of my table control and when i click on the button COPY of that screen. i need those 3 selected lines 1 , 3 , 5 to be copied again in the table control
example :
line 1 selected
line2
line3 selected
line4
line5 selected .
line6
now my table control should be
line1
line2
line3
line4
line5
line6
line1
line3
line5
How can i do that
Regards
Priyanka.I have similar issue...i need help how to accomplish automatic addition on every line. example (see below)
this is how it looks right now
DATE EMPLOYEE DEPT JOB LOT OPER# LX_HRS OP_SETUP LX_TYPE COMPLETE
2/23/2009 M.Paquiao NB 1960 001 10 1.50 14.00 S NO
2/24/2009 1.00 14.00 S NO
2/25/2009 4.50 14.00 S NO
2/27/2009 3.00 14.00 S NO
2/28/2009 1.50 14.00 R YES
3/1/2009 2.00 14.00 R YES
this what I need it to do when I meant automatic addition of each line:
DATE EMPLOYEE DEPT JOB LOT OPER# LX_HRS OP_SETUP LX_TYPE COMPLETE
2/23/2009 M.Paquiao NB 1960 001 10 1.50 14.00 S NO
2/24/2009 2.50 14.00 S NO
2/25/2009 7.00 14.00 S NO
2/27/2009 10.00 14.00 S NO
2/28/2009 11.50 14.00 R YES
3/1/2009 13.50 14.00 R YES
As you can see everything is the same but on column LX_HRS, the first example one is not doing anything addition but on the second example is now doing addition. This additions were done manually, how can I tell crystal to add each line, in the example above, the
first example second example: (addition is involved)
date lx_hrs date lx_hrs
2/23/09 1.50 2/23/09 1.50
2/24/09 1.00 2/24/09 2.50 (sum of : 1.50 + 1.00 was added)
2/25/09 4.50 2/25/09 7.00 (sum of 2.50 (on date 2/24/09 & 4.50 from date 2/25/09 of the first example). -
Table control but without wizard.
For instance for the table spfli, I want to design and use a table. The necessary steps for a good display and use are what?
Thanks in advance.Hi,
CHeck this sample code ... if u need more assistance means give ur mail id i will send u a document
Working with the table control - Example
Scenario:
Screen 601 has a table control named CTRL_ANVSTED.
The table should be filled with records from the table zanvstedm
For this purpose you use an internal table called TBL_ANVSTED
Declare the table control
CONTROLS CTRL_ANVSTED TYPE TABLEVIEW USING SCREEN 601.
*Internal table used to hold data
DATA: TBL_ANVSTED LIKE ZANVSTEDM OCCURS 100 WITH HEADER LINE,
Flag for initial reading
Data: FLAG_INITIAL TYPE I VALUE 0.
PROCESS BEFORE OUTPUT.
Read data into the table control and the internal table
PF status etc.
MODULE INITIALIZE_601.
Read data from table anvstedm into internal table tbl_anvsted.
MODULE INIT_TBL_ANVSTED.
Fill control with data from ythe internal table
LOOP WITH CONTROL CTRL_ANVSTED.
MODULE FILL_CTRL_ANVSTED.
ENDLOOP.
MODULE INIT_TBL_ANVSTED OUTPUT.
Read data from table anvstedm into internal table tbl_anvsted.
IF FLAG_INITIAL = 0.
FLAG_INITIAL = 1.
SELECT * FROM ZANVSTEDM INTO TABLE TBL_ANVSTED.
ENDIF.
ENDMODULE.
MODULE FILL_CTRL_ANVSTED OUTPUT.
Fill control with data from the internal table
READ TABLE TBL_ANVSTED INDEX CTRL_ANVSTED-CURRENT_LINE.
IF SY-SUBRC NE 0.
EXIT FROM STEP-LOOP.
ENDIF.
ENDMODULE.
PROCESS AFTER INPUT.
Write changes in table control to internal table
LOOP WITH CONTROL CTRL_ANVSTED.
MODULE CTRL_ANVSTED.
ENDLOOP.
MODULE CTRL_ANVSTED INPUT.
Write changes in table control to internal table
MODIFY TBL_ANVSTED INDEX CTRL_ANVSTED-CURRENT_LINE.
ENDMODULE.
Using a Table control with an internal table
Table control : TC1
Internal table : it_zsd00003
In the attributes of the table control, select w/SelColumn to get a selection
column on the table control, and give a name (In this example IT_ZSD00003-LINESEL).
Remember to include the field IT_ZSD00003-LINESEL in the
internal table ( linesel(1) type c, ).
When used with an internal table, remember to program
the update functionality of the database tables. Update and
validation can be done when leaving the screen or in PAI using controlname-
current_line (E.g. TC1-current_line ) to indentify the entry in the internal table.
process before output.
module status_0100.
loop at it_zsd00003 with control tc1 cursor tc1-
current_line.
module tc1_set_field_attr. "Optional
endloop.
module status_0100 output.
set pf-status 'SCREEN0100'.
OPTIONAL: If it_zsd00003 hasn't allready been filled with
data, you can do it the first time PBO is called
module read_data.
Setting the number of lines of the table control
describe table it_zsd00003 lines tc1-lines.
Optional: Place the cursor on line g_current_line e.g. after a
validation error has occured
if not ( g_current_line is initial ).
tc1-top_line = g_current_line.
clear g_current_line.
endif.
endmodule. " STATUS_0100 OUTPUT
module read_data.
if flag is initial.
perform read_data.
flag = 1.
endif.
endmodule.
module tc1_set_field_attr output.
Optional: Protect some of the columns on the
table control
loop at screen.
if screen-group1 = 'X'.
screen-input = 0.
modify screen.
endif.
endloop.
endif.
endmodule. " tc1_set_field_attr OUTPUT
process after input.
loop at it_zsd00003.
module modify_tc1.
endloop.
module user_command_0100.
module modify_tc1 input.
Modify an existing entry
modify it_zsd00003 index tc1-current_line.
OR
Appending a new entry
append it_zsd00003.
endmodule. " modify_tc1 INPUT
Deleting a single line selected with the selection column:
form delete_record.
loop at it_zsd00003.
if it_zsd00003-linesel = 'X'.
exit.
endif.
endloop.
delete from zsd00003
where zdriftscenter = it_zsd00003-zdriftscenter
endform.
Sorting a table control
While were on the subject. You may need a sort routine in
case the user selects a column and desires to sort on
its contents. All you need is a sort icon on the
applications toolbar of the screens GUI to return the OK-
code
of 'SORT'. You will need to copy this to the PAI of every
screen and change the name of the module, and the actual
itab for this screen
MODULE SORT_screen100 INPUT.
CASE SAVE_OK_CODE.
WHEN 'SORT'.
LOOP AT T1-COLS INTO WA.
IF WA-SELECTED = 'X' .
SPLIT WA-SCREEN-NAME AT '-' INTO FILE FLD.
SORT itab BY (FLD).
ENDIF.
ENDLOOP.
ENDCASE.
ENDMODULE. " SORT_screen100 INPUT
Tom Quinn
ESRI, Redlands, CA.
Scrolling the table control
Now let's look at scrolling.
(assume that the name of your table control is T1)
In the screen logic you will have:
Loop with control T1.
module get_Looplines.
Endloop.
Module get_looplines.
Looplines = sy-loopc.
Endmodule.
In the PBO of the screen you will have a module that loads
the itab and determines the total number of lines read.
Module load_itab.
. (select database table and
append to itab)
describe table itab lines linecount.
Endmodule.
We now have all the values necessary to construct a scroll
module.
MODULE SCROLL INPUT.
CASE SAVE_OK_CODE.
WHEN 'P--'.
T1-TOP_LINE = 1.
WHEN 'P-'.
T1-TOP_LINE = T1-TOP_LINE - LOOPLINES.
IF T1-TOP_LINE < 1.
T1-TOP_LINE = 1.
ENDIF.
WHEN 'P+'.
T1-TOP_LINE = T1-TOP_LINE + LOOPLINES.
IF T1-TOP_LINE > LINECOUNT.
T1-TOP_LINE = LINECOUNT - LOOPLINES + 1.
ENDIF.
WHEN 'P++'.
T1-TOP_LINE = LINECOUNT - LOOPLINES + 1.
ENDCASE.
ENDMODULE. " SCROLL INPUT
Or else you can use the below code
WHEN 'P--'.
CLEAR SY-UCOMM.
CTR1-TOP_LINE = 1.
WHEN 'P-'.
CLEAR SY-UCOMM.
CTR1-TOP_LINE = CTR1-TOP_LINE - LINECOUNT1.
IF CTR1-TOP_LINE < 1.
CTR1-TOP_LINE = 1.
ENDIF.
WHEN 'P+'.
DESCRIBE TABLE ITAB1 LINES N1.
CTR1-TOP_LINE = CTR1-TOP_LINE + LINECOUNT1.
IF CTR1-TOP_LINE > N1.
CTR1-TOP_LINE = N1.
ENDIF.
CLEAR SY-UCOMM.
WHEN 'P++'.
DESCRIBE TABLE ITAB1 LINES N1.
CLEAR SY-UCOMM.
CTR1-TOP_LINE = N1.
Other hints for using the table contro
1. Setting the number of lines.
2. Scrolling to a spcefic line.
1. Setting the number of lines.
tc1-lines = 500.
> The problem is not in module scroll_code but rather the
lack of module =
> LINE_COUNT in your PBO. I have found this very reliable
and absolutely =
> necessary in getting the scrolling in table function to
work. This module
> =
> has the following code in it:
>
> module line_count output.
> describe table itab lines tc1-lines.
> endmodule.
2. Scrolling to a spcefic line.
tc1-top_line = 500. -
What is the difference between table control and ALV grid control?
Hi,
1.Table control example
Follow the steps to update the database table records.
1.TOP INCLUDE code
TABLES: EKKO.
DATA: OK_CODE TYPE SY-UCOMM.
CONTROLS: TC100 TYPE TABLEVIEW USING SCREEN 100.
DATA: IT_EKKO LIKE EKKO OCCURS 0 WITH HEADER LINE.
DATA: CUR TYPE I.
DATA: I_EKKO2 LIKE EKKO OCCURS 0 WITH HEADER LINE.
DATA: V_FNAM TYPE I,V_FVAL(10) TYPE N.
2.Create screen with number(e.g 123) and click on layout tab
Give the table control name as TC100.
SELECT THE FIELDS FROM INTERNAL TABLE (IT_EKKO). DRAG THE TEXT FIELDS INTO THE TABLE CONTROL FOR FIELD HEADINGS.
Create 4 pushbuttons(insert,fetch,delete and exit)
CLICK ON Element list TAB AND ENTER THE OK_CODE.
CLICK ON FLOWLOGIC TAB.
3.Flowlogic code
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
LOOP AT IT_EKKO CURSOR CUR WITH CONTROL TC100.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT IT_EKKO.
MODULE MODIFY_ITAB.
ENDLOOP.
MODULE USER_COMMAND_0100.
4.Double click on MODIFY_ITAB and write as
module MODIFY_ITAB input.
APPEND IT_EKKO TO I_EKKO2.
endmodule. " MODIFY_ITAB INPUT
5.Activate PAI and double click on it and write the code as
module USER_COMMAND_0100 input.
CASE OK_CODE.
WHEN 'INS'.
LOOP AT I_EKKO2.
MODIFY EKKO FROM I_EKKO2.
ENDLOOP.
SELECT * FROM EKKO INTO TABLE IT_EKKO.
IF SY-SUBRC = 0.
MESSAGE S003(ZCSMSG).
ENDIF.
WHEN 'FETCH'.
SELECT * FROM EKKO INTO TABLE IT_EKKO UP TO 2000 ROWS.
TC100-LINES = SY-DBCNT.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
endmodule. " USER_COMMAND_0100 INPUT
6.Create Transaction code and execute it.
2.Grid control example
TABLES VBAK.
TYPE-POOLS SLIS.
Data Declaration
TYPES: BEGIN OF T_VBAK,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
ERNAM TYPE VBAK-ERNAM,
AUDAT TYPE VBAK-AUDAT,
VBTYP TYPE VBAK-VBTYP,
NETWR TYPE VBAK-NETWR,
VKORG TYPE VBAK-VKORG,
VKGRP TYPE VBAK-VKGRP,
LINE_COLOR(4) TYPE C,
END OF T_VBAK.
DATA: IT_VBAK TYPE STANDARD TABLE OF T_VBAK INITIAL SIZE 0,
WA_VBAK TYPE T_VBAK.
ALV Data Declaration
DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
GD_REPID TYPE SY-REPID.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BLD_FLDCAT.
PERFORM BLD_LAYOUT.
PERFORM DISPLAY_ALV_REPORT.
Build Field Catalog for ALV Report
FORM BLD_FLDCAT.
FLDCAT-FIELDNAME = 'VBELN'.
FLDCAT-SELTEXT_M = 'Sales Document'.
FLDCAT-COL_POS = 0.
*FLDCAT-EMPHASIZE = 'C411'.
FLDCAT-OUTPUTLEN = 20.
FLDCAT-KEY = 'X'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'ERDAT'.
FLDCAT-SELTEXT_L = 'Record Date created'.
FLDCAT-COL_POS = 1.
FLDCAT-KEY = 'X'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'ERNAM'.
FLDCAT-SELTEXT_L = 'Cteated Object Person Name'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'AUDAT'.
FLDCAT-SELTEXT_M = 'Document Date'.
FLDCAT-COL_POS = 3.
FLDCAT-EMPHASIZE = 'C110'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'VBTYP'.
FLDCAT-SELTEXT_L = 'SD Document category'.
FLDCAT-COL_POS = 4.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'NETWR'.
FLDCAT-SELTEXT_L = 'Net Value of the SO in Document Currency'.
FLDCAT-COL_POS = 5.
FLDCAT-OUTPUTLEN = 60.
FLDCAT-DO_SUM = 'X'.
FLDCAT-DATATYPE = 'CURR'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'VKORG'.
FLDCAT-SELTEXT_L = 'Sales Organization'.
FLDCAT-COL_POS = 6.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'VKGRP'.
FLDCAT-SELTEXT_M = 'Sales Group'.
FLDCAT-COL_POS = 7.
FLDCAT-EMPHASIZE = 'C801'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
ENDFORM.
Build Layout for ALV Grid Report
FORM BLD_LAYOUT.
GD_LAYOUT-NO_INPUT = 'X'.
GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GD_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
GD_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'.
GD_LAYOUT-CONFIRMATION_PROMPT = 'X'. This asks the confirmation
before leaving the screen.
ENDFORM.
Display report using ALV grid
FORM DISPLAY_ALV_REPORT.
GD_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GD_REPID
IS_LAYOUT = GD_LAYOUT
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = 'SALES DOCUMENT HEADER'
IT_FIELDCAT = FLDCAT[]
I_SAVE = 'X'
TABLES
T_OUTTAB = IT_VBAK
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.
ENDFORM.
Retrieve data from VBAK table and populate itab IT_VBAK
FORM DATA_RETRIEVAL.
DATA LD_COLOR(1) TYPE C.
SELECT VBELN ERDAT ERNAM AUDAT VBTYP NETWR VKORG
UP TO 20 ROWS
FROM VBAK
INTO TABLE IT_VBAK.
LOOP AT IT_VBAK INTO WA_VBAK.
LD_COLOR = LD_COLOR + 1.
IF LD_COLOR = 8.
LD_COLOR = 1.
ENDIF.
CONCATENATE 'C' LD_COLOR '10' INTO WA_VBAK-LINE_COLOR.
MODIFY IT_VBAK FROM WA_VBAK.
ENDLOOP.
ENDFORM.
FORM TOP_OF_PAGE.
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
W_HEADER TYPE SLIS_LISTHEADER.
W_HEADER-TYP = 'H'.
W_HEADER-INFO = 'WELCOME HEADER LIST'.
APPEND W_HEADER TO T_HEADER.
W_HEADER-TYP = 'S'.
W_HEADER-KEY = 'REPORT:'.
W_HEADER-INFO = SY-REPID.
APPEND W_HEADER TO T_HEADER.
W_HEADER-TYP = 'S'.
W_HEADER-KEY = 'DATE:'.
CONCATENATE SY-DATUM6(2) ' / ' SY-DATUM4(2) ' / ' SY-DATUM(4) INTO W_HEADER-INFO.
APPEND W_HEADER TO T_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_HEADER.
ENDFORM.
Refer the following link
http://www.****************
Reward,if useful.
Thanks,
Chandu -
Hi gurus what is table control can explin with example
hi gurus what is table control can explin with example
TABLE CONTROL
These are the screen elements used to display tabular data they can be called
as screen tables( like STEP LOOP).To use table control we have to create it on the screen using SCREEN PAINTER(SE51) and declare a control variable of TYPE TABLEVIEW using CONTROLS statement in the ABAP program. We have to use LOOP .. ENDLOOP statement in both PBO and PAI with or without AT int_table parameter. IF AT int_table parameter is not used than we have to place a MODULE call between the LOOP...ENDLOOP statement to fill the screen table rows from the ABAP program in PBO and program our own scrolling functions
using OK_CODE field.
Having a parallel loop(at screen table rows & int table rows) by using parameter
AT int_table makes the ABAP code simple.
A special structure of type CXTAB_CONTROL is used to set/get various
attributes of table control at runtime like CURRENT_LINE ,TOP_LINE.
ABAP declaration
CONTROLS: tab_con TYPE TABLEVIEW USING SCREEN nnnn
Here tab_con is the same name we used in screen for the table control.
This ABAP statement will declare a control variable that will be used to access
the table control , and set it's various attributes like number of fixed columns(tab_con-FIXED_COLS) ,total number of records it will display(tab_con-LINES).It is of type CXTAB_CONTROL and is a deep structure(structure containing structures).
REFRESH CONTROL tab_con FROM SCREEN nnnn
This ABAP statement will initialize the table control on the screen nnnn to its initial values.
PBO processingI
n PBO we have to use the screen LOOP ...ENDLOOP statement , with or without
intenal table.
LOOP WITH CONTROL tab_con.
MODULE fill_tab_con.
ENDLOOP.
Here a module should be called between the loop endloop statement to transfer
data from th ABAP program to the screen table through a structure.This module
should use the CURRENT_LINE attribute of the table control variable to get the
current screen table record index to read the data from the internal table into a work area.
e.g.
READ TABLE int_table INDEX tab_con-CURRENT_LINE
The record read will be placed in the header line of the internal table and will be available to the similarly named screen fields or if these are different it can be written explicitly. e.g.
screen_field_name = int_table-field_name
LOOP AT int_table INTO workarea WITH CONTROL tab_con CURSOR i FROM
n1 TO n2.
ENDLOOP.
Here the module call is not required to fill the screen table.The CURSOR parameter is a integer of type I indicating which absolute internal table line
should be the first to display on the table control .FROM n1 TO n2 can be used
to restrict the starting line and ending line number of the internal table , they are of type SY-TABIX.
In both cases before the LOOP statement a module should be called which
is generally for setting of status ,in which we should fill the LINES attribute
(tab_con-LINES ) of the control with the total number of internal table records,doing this ensures correct and automatic scrolling.
The ABAP statement DESCRIBE TABLE int_table LINES lines can be used
to get the total lines in an int table.
PAI Processing
We have to use LOOP ... ENDLOOP in PAI so that data can transfer fro table control to ABAP program. If we want to write changes to the data we should
call a module between the LOOP ... ENDLOOP. The MODULE call to process user commands (SY-UCOM) should be called after the ENDLOOP statement.
e.g.
PROCESS AFTER INPUT
MODULE mod AT EXIT-COMMAND.
LOOP AT itab_table or LOOP "depending on whether we are using AT int_table
MODULE modify_int_table.
ENDLOOP.
MODULE user_command.
In the MODULE call modify_int_table we can use
MODIFY int_table FROM workarea INDEX tab_con-CURRENT_LINE
or we can use
int_table-field_name = screen_field_name. -
How to add new field to table control data not displayed
hi
I have added some nwe fields to already existing table control added three new fields...
though the recoreds are inserted in teh table properly with the three new fields user id data and time fields
but on display only the data is not shown in these three columns though the data is coming in internal table...but not to the screen output
pls suggest where the problme may be
nishantFirst try the small button Configuration on top right of the table control, as displayed when you run the program. Hit 'Administrator' and see if the fields are checked as invisible. Uncheck them, activate and save.
If the fields are not in that list at all, then check if the table control is initialized for the screen you use. For example
CONTROLS: tc_ent_lines TYPE TABLEVIEW USING SCREEN '0100'.
but you copied your screen and use the same table control in the new screen 0200. Then all you have to do is
REFRESH CONTROL 'TC_ENT_LINES' FROM SCREEN '0200'.
before you show the screen. -
Deleting the values from table control
HI,
I need to remove the selected line from the Table control on my screen.
The point is that the Internal table does not have any records,.
for example in the Customer Create screen,
while entering the bank details we will enter it in a tbale contraol.
but the records doesnt exist in the database. but the record gets deleted from the table control only if we press delete button.
please guide me.
please note : I want to delete the record from Table Control on the screen and I dont have any corresponding database records..
regardsHi..
The solution to your problem - deleting values from table control.
Here: it_wizard is the internal table which is holding the value of table control.
wa_wizard is the work are of the internal table it_wizard.
it_delete is the internal table which holds the deleted record of table control.
wa_delete is the work area of the internal table it_delete
Also here the field ZSEL is the character field which is used to select the entire record in the table control.
LOOP AT it_wizard into wa_wizard WHERE zsel = 'X'.
MOVE-CORRESPONDING wa_wizard TO wa_delete.
APPEND wa_delete TO it_delete.
delete table it_wizard from wa_wizard.
DELETE FROM zfin_goods WHERE ZFG = WA_delete-ZFG.
ENDLOOP
if sy-subrc eq 0.
Message 'Delete Successful' type 'S'.
endif.
The above code will delete the record from both the table control.internal table and the database table.
I think this will help you to great extent.
Ward regards,
Bhuvaneswari
Edited by: BHUVANESWARI THIRUNAVUKKARASU on Jan 7, 2009 10:39 AM -
How to give line items in flatfile while doing BDC for Table control
Hi all,
I am writing BDC for Multiple line items and Transaction is : FSE5N.
How do i give the data in the flat file. I mean how do we give the multiple line items in flat file , i.e for second line item again we have to header data or not ?
ex:
1015;ALL;demo;kr;INR;01;0001;3000172;100
1015;ALL;demo;kr;INR;01;0001;3000172;200
for first lineitem : 3000172;100
for 2nd line item : 3000172; 200.
header data : 1015;ALL;demo;kr;INR;01;0001.
Thanks in advance
krupaliHii ,
u can give in the same format as u have done in the example.
A B C D E F G H I
1015;ALL;demo;kr;INR;01;0001;3000172;100
1015;ALL;demo;kr;INR;01;0001;3000172;200
and while writing the loop u can give
loop at it_head.
loop at it_head where a = it_head-A and b = it_head-B ..........upto G = it_head-G.
endloop.
endloop.
check this
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
Neeraj -
Work area field value not getting populated in table control grid.
Hi all,
I am currently facing an issue where I have declared a variable and have fetched the workarea field name in it. To be exact, the variable contains the workarea name whose value I am finally populating to the table control. Now although the workarea name when manually copied and pasted in field name in debugging mode exhibits the value of the it, Im unable to fetch the same value in the variable as I have only the work area name in it. I need the value of the workarea-field to be in the variable.Please provide your valuable suggestions for this issue...
Regards,
Edited by: Vishwanath Sreedharen on Jan 2, 2012 3:25 PMHi Nabheet,
Please consider the below example...
DATA: l_var(30) TYPE C.
CONCATENATE 'wa' '-' I_FIELD2-NAME INTO l_var.
The i_field2-name contains the name of a custom table field CP_CUSTOM_GRP. So now the l_var contains wa_cp_custom_grp.
Now consider the wa_cp_custom_grp has a value 'BA'.
Now my issue is the l_var contains wa_cp_custom_grp but not its value(too obvious)... Would like to know whether is there a way through which the value of this wa_cp_custom_grp 'BA' could be populated to the variable l_var... -
I need more than 255 charater value return from the table control screen.
Hi guys,
I used this function module to get the dynamic table control value changes, but it export me back only 255 character value.
because the 'DYNPFIELDS' internal table structure hold only 255 character. kindly help me in this reg to get more than 255 character length.
or any other solution.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = '/A1SSPC/USR_RALG_FILL'
DYNUMB = '1000'
TABLES
DYNPFIELDS = TBDYNPFIELDS.
kindly provide me if you have any solution.
reg,
hariHi,
Try using the Text Editor for more info go throught the Control Examples
Utilities--> Examples --> Control Examples in SE38
Regards
Ramchander Rao.K -
How to disable single cell in table control.
Hi my requirement is to disable single cell in the table control. Please let me know How to do this.
If possible please provide good module pool examples.
HarishHi,
I´m not quite sure if this is gonna work. You have to make a loop over the screen and then you can change some characteristics of it, which includes the Input option:
LOOP AT SCREEN.
IF screen-group1 = 'ABC'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
I´ve used this code for selection screens but could help you. Check in SE11 all options for SCREEN. -
How to use PF status in Table Control?
I have made 1 table control. Now I need to use three buttons like SELECT, DESELECT, DELETE the rows of table control using PF STATUS. Can you plz help with the Code.
Hi.
Refer this code.
The following example processes a table control with LOOP with parallel loop using an internal table. By using function codes you can sort columns and delete rows from the internal table. The ready for input status of the table control fields is controlled using a function code.
REPORT demo_dynpro_tabcont_loop_at.
CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
DATA: cols LIKE LINE OF flights-cols,
lines TYPE i.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA: itab TYPE TABLE OF demo_conn.
TABLES demo_conn.
SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.
LOOP AT flights-cols INTO cols WHERE index GT 2.
cols-screen-input = '0'.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
DESCRIBE TABLE itab LINES lines.
flights-lines = lines.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE read_table_control INPUT.
MODIFY itab FROM demo_conn INDEX flights-current_line.
ENDMODULE.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'TOGGLE'.
LOOP AT flights-cols INTO cols WHERE index GT 2.
IF cols-screen-input = '0'.
cols-screen-input = '1'.
ELSEIF cols-screen-input = '1'.
cols-screen-input = '0'.
ENDIF.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
WHEN 'SORT_UP'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'SORT_DOWN'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'DELETE'.
READ TABLE flights-cols INTO cols
WITH KEY screen-input = '1'.
IF sy-subrc = 0.
LOOP AT itab INTO demo_conn WHERE mark = 'X'.
DELETE itab.
ENDLOOP.
ENDIF.
ENDCASE.
ENDMODULE.
Reward all helpfull answers.
Regards.
Jay -
F4 help for a field on table control
Hi All,
I have to display F4 help for a purticular field on the table control depending on one of the value in the row if the table.
There will be multiple entries in the table control and the F4 help for the field should change according to the value of other field in the row.
Can anybdy help me out doing this.....
Edited by: Alvaro Tejada Galindo on Feb 21, 2008 10:46 AMCheck the FM: HELP_VALUES_GET_WITH_TABLE_EXT
Check the documentation for example code.
regards,
Ravi -
Hi,
I have a table control. How to get the index of the row selected in the table control?
Please help. Very urgent
ThanksHi Kushaal Choudri,
Procedure for Table control line selection and modifying master table using
those values.
1).
U should take one variable in your internal table or in structure which
is used for table control fields
ex :
data :begin of itab occurs 0 ,
mark type c ,
matnr like mara-matnr ,
matkl like mara-matkl,
maktx like makt-maktx,
end of itab .
Controls: TABC types TABLEVIEW using screen 100.
2).
This mark variable should be given in Table control properties.
follow the path
double click on the table control-->attributes .->select
w/SelColumn and in that itab-mark. Check in the figure.
[http://bp2.blogger.com/_O5f8iAlgdNQ/R99gOUH8CXI/AAAAAAAAA9I/d3gOum1fJ6s/s1600-h/pic28145-796618.jpg|http://bp2.blogger.com/_O5f8iAlgdNQ/R99gOUH8CXI/AAAAAAAAA9I/d3gOum1fJ6s/s1600-h/pic28145-796618.jpg]
3).
After that. Take this example.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
LOOP AT ITAB WITH CONTROL tabc
ENDLOOP.
PROCESS AFTER INPUT.
MODULE CANCEL AT EXIT-COMMAND.
LOOP AT ITAB.
Module read_table_control.
ENDLOOP.
module user_command_0100.
==============================
In this Module read_table_control, You should write the following code
MODULE read_table_control INPUT.
MODIFY itab INDEX tabc-current_line."( This will update the ITAB table MARK field with 'X ' whatever we have selected on table control.)
ENDMODULE.
4)
If you want to Delete some of the records from Table control
follow this code u2026Create one pushbutton and give Fucnction code to that
and write below code
WHEN 'DELETE'.
LOOP AT itab WHERE mark = 'X'.
DELETE itab.
ENDLOOP.
ENDCASE.
I hope that it helps u .
Regards,
Venkat.O -
How to refer to a particular field in Table Control.
Hi,
How can we refer to a particular field in a table control like 5th row 6th column. The actual requirement of mine is, i have a column with listbox. For each row i need to have different values for the list box. So i need to refer to that particular field in the column and assign the list values. Please kindly help.
Regards,
Vinay.hi,
TABLE CONTROL -
http://www.geekinterview.com/Interview-Questions/SAP-R-3
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbaa4735c111d1829f0000e829fbfe/content.htm
http://www.sapgenie.com/abap/example_code.htm
http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
http://www.sapgenie.com/links/abap.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
Eg of table Control:
http://members.aol.com/_ht_a/skarkada/sap/table_control/
table_control.htm
http://www.sapdesignguild.org/resources/MiniSG/3_Managing/3_Functions_Table_Control.htm
Table control in BDC
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/45/adee2396f711d1b46b0000e8a52bed/frameset.htm
Regards,
Laxmi
Maybe you are looking for
-
Does anyone know of if and when apple will be releasing a security update to upgrade the PHP? I have a client that has to be PCI compliant and it is failing the test because it is on version 5.4.6. Are updates like this normally done by apple in os u
-
Problems backing up w/ iPhoto 6
While installing iPhoto 6 some dialogue boxes asked me about converting some photos in one folder, one of which I'd been sent by another person over email...photos of me that they'd taken at an event. I selected "yes" or something. When my first week
-
LMS 3.0.1 upgrade to LMS 3.2
Hi Pros, Can anyone help me to know the step by step procedures for upgrading LMS to 3.2 from 3.0.1. Thanks swami
-
Hi Mark, I have a problem with my thinkpad. upon loading xp i get an error message ORDINAL 522 MISSING FROM LIBRARY. I don't have any icons on my desktop and my control panel and start menu is also missing. I backed up my laptop as i had a virus an
-
"fill down" from dell containing letter X results in succeeding letters
If I use the letter X as a placeholder in a cell and want to fill cells in successive rows with the same letter, I get y in the next cell, z in the next, etc. How can I tell Numbers to duplicate X in the succeeding rows?