‎2006 Feb 01 7:39 AM
I have created a Table Control with Wizard. My aim is to fetch the data from database then make updation in database table.For this I have created two Function Modules,one for Fetch other for Update.I am calling the FETCH func.mod. in the PBO and UPDATE in PAI.
When data is displayed if I make any changes to any updatable field and scroll down the Table in the screen then as soon as the mouse is clicked for scrolling the updated changes are lost.
Please help me out!!!!!!!!!!!
‎2006 Feb 01 7:56 AM
Check In PAI event.
There will be a module modify in chain ...endchain.
there you do some coding..
eg: MODIFY G_TC1_ITAB
FROM G_TC1_WA
INDEX TC1-CURRENT_LINE.
‎2006 Feb 01 8:05 AM
Mr.Shaikh,
The code which you have suggested is already generated by the Table Control Wizard.
Still the problem is there.....
Is there any other way out????
‎2006 Feb 01 8:50 AM
‎2006 Feb 01 8:52 AM
‎2006 Feb 01 9:00 AM
when are you updating the data to database table...have u provided button to update or it is updating once the change is made in the table control...
Check the code you have written in PBO for fetching the data...debug and see whether it is replacing the updated data or not.
or send PBO & PAI code
‎2006 Feb 01 9:13 AM
PROCESS BEFORE OUTPUT.
MODULE INITIALIZE.
*&spwizard: pbo flow logic for tablecontrol 'TBLALLOC_CYC'
module TBLALLOC_CYC_change_tc_attr.
*&spwizard: module TBLALLOC_CYC_change_col_attr.
loop at GT_NEW_ALLOC
into GT_NEW_ALLOC_WA
with control TBLALLOC_CYC
cursor TBLALLOC_CYC-current_line.
module TBLALLOC_CYC_get_lines.
*&spwizard: module TBLALLOC_CYC_change_field_attr
endloop.
MODULE STATUS_9003.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_9003.
*MODULE USER_COMMAND_9003.
*&spwizard: pai flow logic for tablecontrol 'TBLALLOC_CYC'
loop at GT_NEW_ALLOC.
chain.
field GT_NEW_ALLOC_WA-/BIC/ZALLOCCYC.
field GT_NEW_ALLOC_WA-/BIC/UFACT_FLG.
field GT_NEW_ALLOC_WA-CHANGEDBY.
field GT_NEW_ALLOC_WA-CH_ON.
field GT_NEW_ALLOC_WA-/BIC/ECHAT.
module TBLALLOC_CYC_modify on chain-request.
endchain.
endloop.
module TBLALLOC_CYC_user_command.
*&spwizard: module TBLALLOC_CYC_change_tc_attr.
*&spwizard: module TBLALLOC_CYC_change_col_attr.
module TBLALLOC_CYC_user_command.
MODULE USER_COMMAND_9003.
**********************************
MODULE INITIALIZE OUTPUT.
*****************************************************************
At the time of initialization of the screen data is to be displayed
by calling Function Module ZUFACTS_FETCH_ALLOC_CYC.
*****************************************************************
CALL FUNCTION 'ZUFACTS_FETCH_ALLOC_CYC'
TABLES
T_ALLOC = GT_NEW_ALLOC
.
*****************************************************************
Pass the value displayed in Internal Table GT_OLD_ALLOC.
*****************************************************************
GT_OLD_ALLOC[] = GT_NEW_ALLOC[].
MOVE GT_OLD_ALLOC TO GT_OLD_ALLOC.
*****Initialize the ok_code.
CLEAR OK_CODE .
ENDMODULE. " INITIALIZE OUTPUT
*************************************
MODULE USER_COMMAND_9003 INPUT.
CASE : OK_CODE.
WHEN 'SAVE'.
CALL FUNCTION 'ZUFACTS_UPDATE_ALLOC_CYC'
TABLES
T_OLD_ALLOC = GT_OLD_ALLOC
T_NEW_ALLOC = GT_NEW_ALLOC
EXCEPTIONS
NO_FIELD_UPDATED = 1
UNSUCCESSFUL_UPDATION = 2
OTHERS = 3
.
IF SY-SUBRC = 1.
MESSAGE I005 .
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF SY-SUBRC = 2.
MESSAGE E006.
ENDIF.
WHEN 'CANCEL' OR 'BACK' OR '%EX' OR 'RW'.
LEAVE TO SCREEN 0.
ENDCASE.
CLEAR OK_CODE.
ENDMODULE. " USER_COMMAND_9003 INPUT
*******************************************************
I have provided a 'SAVE' button to save the changes.
But the problem is before selecting 'SAVE'.
‎2006 Feb 01 9:23 AM
hi,
check this help document...
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/table control in abap.pdf
regards
vijay
‎2006 Feb 01 9:29 AM
‎2006 Feb 01 9:44 AM
module TBLALLOC_CYC_get_lines output.
g_TBLALLOC_CYC_lines = sy-loopc.
endmodule.
This is the logic generated while using table control wizard..
‎2006 Feb 01 11:39 AM
You just modify the initialisation code as below.
Data: g_copied.
if g_copied is initial.
CALL FUNCTION 'ZUFACTS_FETCH_ALLOC_CYC'
TABLES
T_ALLOC = GT_NEW_ALLOC
g_copied = 'X'.
ENDIF.