Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Table Control in Module Pool Programming

Former Member
0 Kudos

In my Module Pool program I have created a Table Control on my screen. In my Table one column is the Checkbox. When I make changes in any of the Checkbox and scroll the Table or scroll with mouse,the data is lost.I am updating the database table and for that I have created a 'SAVE' button.But to make the changes I have to Scroll the Table on the screen and the changed data is lost.

Please guide me or if possible then tell me the Flow Logic of Module Pool with Table Control??

Thanks for the Help....

10 REPLIES 10

hymavathi_oruganti
Active Contributor
0 Kudos

for that,

what ever logic u r writing for checking, u code it in PBO too, because when u scroll down, it is going to PBO and refreshes.

u can debug and see. the problem is only with PBO.

0 Kudos

I have created the Table Control by using Wizard so the codes are automatically generated for PBO and PAI. I am updating the database table in PAI. and in PBO I have fetched the record from database.

0 Kudos

can u send the PAI and PBO code

0 Kudos

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

0 Kudos

hi anurita,

what ever sudheer suggested is correct, thats what i suggested above.

0 Kudos

As per Sudhir's reply ,in my MODULE INITIALIZE looping is there..

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.

And my MODULE INITIALIZE just calls the function module to fetch the data from database.

So where is the error???

Former Member
0 Kudos

Hi,

Modify your internal table when you make changes

and save the data.

Regards

Amole

Former Member
0 Kudos

Hi,

In PBO you need to move data to screen fields,then if you scroll your data will not be lost.bcos when ever you scroll it calls the PBO.

process before output.

loop at i_item with control tc103 cursor tc103-current_line.

  • Moving data from internal table to screen

module data_to_screen.

endloop.

process after input.

  • Shipments information

loop at i_item.

  • Modify table

module screen_to_table.

endloop.

Hope this helps.

Regards,

Sudheer

0 Kudos

I have written a module 'INITIALIZE' which calls the fun module to fill the data to screen from the database.You can see the code of MODULE INITIALIZE in the PBO. Suggest me is it not enough???

0 Kudos

in loop and enloop, in module initialize nothing is written.

u move data from itab to screen