‎2008 Feb 12 3:53 AM
Dear Experts
I have created one table control se51 from where I should be able to upload the data in Z table in se11 and additional functionality of modify, delete using push buttons could u please send me a sample code.
Regards
Shashikant
‎2008 Feb 12 4:29 AM
Hi Shashikant Chandratre ,
For your requirement no need for modulepool. You can do by using table maitenance generator. The system generates code automatically.
Steps Involved in Table Maintenance generator:
1) Go to utilities->Table Maintenance Generator.
2) Provide Authorization group and Function Group
3) Maintenance type one step or two step
4) Create it.
After this go to utilities->table contents-> create entries
Here u can enter new records or delete, modify the existing records.
You can this requirement by using se51 also, but u have to write the code. So its time consuming.
If u have any doubts, drop a message.....
Reward me if it useful.
Edited by: B Nagamalleswara Rao on Feb 12, 2008 5:30 AM
‎2008 Feb 12 4:31 AM
Hi,
This is a sample project i had done previously. I have 3 tables - zuser_master3, "TABLE WITH USERNAME AND PASSWORD DETAILS
zcust_master3, "TABLE WITH CUSTOMER DETAILS
zacc_master3, "TABLE WITH ACCOUNT DETAILS
ztrans_master3. "TABLE WITH TRANSACTION DETAILS
I need to display the records in a MPP program table controls. I must be able to add, modify and delete records. I have attached the part of coding for delete and modify below.
wi_acca - internal table.
Please use your own tables/fields and execute the code.
In the screen flow logic,
PROCESS BEFORE OUTPUT.
MODULE status_0104.
LOOP AT wi_acca CURSOR cursor2 WITH CONTROL table2.
MODULE SETSCREENFIELDS2.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE user_command_0104.
LOOP AT wi_acca.
MODULE tabmodify2.
MODULE tabdelete2.
module disable2.
ENDLOOP.
__Coding for modify:__
ODULE tabmodify2 INPUT.
CASE sy-ucomm.
WHEN 'SAVE'.
GET CURSOR LINE line4.
IF flag3 = 'X'.
IF table2-current_line = line4.
IF wi_acca-status = 'INACTIVE'.
CLEAR wi_acca-balance.
ELSE.
MODIFY wi_acca INDEX table2-current_line.
IF sy-subrc = 0.
MODIFY zacc_master3 FROM TABLE wi_acca.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDCASE.
ENDMODULE
In the include:(Declaration)
DATA : wi_custa TYPE zcust_master3 OCCURS 0 WITH HEADER LINE,
wi_acca TYPE zacc_master3 OCCURS 0 WITH HEADER LINE,
wi_transa TYPE ztrans_master3 OCCURS 0 WITH HEADER LINE.
CONTROLS table2 TYPE TABLEVIEW USING SCREEN 0104.
Data :cursor2 TYPE i.
Coding for delete:
MODULE tabdelete2 INPUT.
GET CURSOR LINE line2.
IF answer2 = '1'.
IF flag4 = 'X'.
IF table2-current_line = line2.
MODIFY wi_acca INDEX table2-current_line.
MODIFY zacc_master3 FROM TABLE wi_acca.
set2 = 1.
ENDIF.
ENDIF.
ENDIF.
ENDMODULE. " tabdelete2 INPUT
Hope it helps.
Saipriya
‎2008 Feb 12 4:54 AM
Hi,
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 processing
In 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.
Module modify_int_table.
-
Module User_command.
Case Sy-ucomm.
When ' DELETE'.
-
When 'UPDATE'.
-
.
Please go through this links...this will help u alot.
Regards.