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 with change data

ashish_gupta11
Explorer
0 Kudos

Hi expert ,

I m using TC in program . i have 3 button 'Display' ' Change' 'Exit'.

when i click on display the data is display in table control . after that when i want to change selected row by open new form with field display in tab .but when i select a particular row for change new window is not open . i used "call screen 102 " after that but not working .

help me .

thanks ,

Ashish

1 ACCEPTED SOLUTION

I355602
Advisor
Advisor
0 Kudos

Hi Ashish Gupta(AG),

When you display records in the table control and you get all the records from the database table.

Now at CHANGE button, you want modify the existing record.

Use this code to modify your data. Its working.

First populate your internal table from the database table.

In the table control keep the name of the I/O fields same as of <internal_table-field_name>.

for example : movie_tab-rel_year.

When you navigate to table control (probably on another screen).

Automatically, the records from internal table are populated on to the table control.

Now if you make some changes in your data and click 'CHANGE', use this code to modify your data in database table.

****AT SCREEN FLOW LOGIC********************************************************************************

PROCESS AFTER INPUT.

LOOP WITH CONTROL MOVIE.

MODULE SAVE_DATA.

ENDLOOP.

**********************************************************************************************************************

****MODULE SAVE_DATA*************************************************************************************

MODULE SAVE_DATA INPUT.

OK_CODE = SY-UCOMM.

CASE OK_CODE.

WHEN 'CHANGE'.

MODIFY MOVIE_TAB INDEX MOVIE-CURRENT_LINE. "table_control-current_line

UPDATE Y00MOVIES FROM TABLE MOVIE_TAB. "updates database table

ENDCASE.

ENDMODULE.

***********************************************************************************************************************

Hope this solves your problem.

Regards.

Tarun Gambhir.

3 REPLIES 3

Former Member
0 Kudos

hi

The LINE parameter in the GET or SET statement refers to the system field SY-STEPL, the special loop index in the flow logic.

You calculate the internal table line that corresponds to the selected table control line as follows:

Line = <ctrl>-TOP_LINE + cursor position - 1.

The GET CURSOR statement sets the return code as follows:

SY-SUBRC = 0 if the cursor was positioned on a field

SY-SUBRC = 4 if it was not.

You can position the cursor on a particular element in the table control using the LINE parameter in the following statement:

SET CURSOR FIELD <field_name> LINE <line>.

You can also use the OFFSET and LINE parameters together.

regards

Neha

Former Member
0 Kudos

Hi,

use CALL SCREEN '100'.

Thanks,

Krishna..

I355602
Advisor
Advisor
0 Kudos

Hi Ashish Gupta(AG),

When you display records in the table control and you get all the records from the database table.

Now at CHANGE button, you want modify the existing record.

Use this code to modify your data. Its working.

First populate your internal table from the database table.

In the table control keep the name of the I/O fields same as of <internal_table-field_name>.

for example : movie_tab-rel_year.

When you navigate to table control (probably on another screen).

Automatically, the records from internal table are populated on to the table control.

Now if you make some changes in your data and click 'CHANGE', use this code to modify your data in database table.

****AT SCREEN FLOW LOGIC********************************************************************************

PROCESS AFTER INPUT.

LOOP WITH CONTROL MOVIE.

MODULE SAVE_DATA.

ENDLOOP.

**********************************************************************************************************************

****MODULE SAVE_DATA*************************************************************************************

MODULE SAVE_DATA INPUT.

OK_CODE = SY-UCOMM.

CASE OK_CODE.

WHEN 'CHANGE'.

MODIFY MOVIE_TAB INDEX MOVIE-CURRENT_LINE. "table_control-current_line

UPDATE Y00MOVIES FROM TABLE MOVIE_TAB. "updates database table

ENDCASE.

ENDMODULE.

***********************************************************************************************************************

Hope this solves your problem.

Regards.

Tarun Gambhir.