Application Development and Automation 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: 
Read only

Checking whether an internal table value/record is modified

Former Member
0 Likes
2,196

Hi all,

I am developing a module program to allow the user to maintain price list for the product.

For this I am using a table control to display the existing price list. the list would be around 50 records.

Now, if the user modifies a single record in the table control list and goes to modify the second, third... records, I want to indicate/highlight(some icons) the changed line item/records. finally I want to update only the changed record/line item to the database table from the internal table.

Also, I want to display a status message when the user presses save button, if there is no changes made to the already listed values.

How can I achieve this?

Thanks,

Rajan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,420

Hi,

The flow logic of your table control screen will be like:


PROCESS BEFORE OUTPUT.
  MODULE STATUS_8001.

  LOOP WITH CONTROL MOVIE.  "movie is your table control name
    MODULE PASS_DATA.            "This module reads the data from the internal 
                                                   "table into the table control 
  ENDLOOP.

PROCESS AFTER INPUT.
  MODULE USER_COMMAND_8001.

  LOOP WITH CONTROL MOVIE.
    MODULE DISPLAY_DATA.           "This module will modify the table control
                                                       "changes back into the internal table

  ENDLOOP.

  
******SCREEN 8001***READING DATA FROM MOVIE_TAB TO TABLE CONTROL********
MODULE PASS_DATA OUTPUT.

  SORT MOVIE_TAB.
  READ TABLE MOVIE_TAB INDEX MOVIE-CURRENT_LINE.

ENDMODULE.                 " GET_DATA  OUTPUT.



******SCREEN 8001****MODIFYING INTERNAL TABLE FROM TABLE CONTROL********
MODULE DISPLAY_DATA INPUT.

*  IF MOVIE_TAB-FLAG = 'X'.

  MODIFY MOVIE_TAB INDEX MOVIE-CURRENT_LINE.

*  ENDIF.

ENDMODULE.                 " DISPLAY_DATA  INPUT


Hope it helps

Regards

Mansi

8 REPLIES 8
Read only

Former Member
0 Likes
1,420

Rajan,

For each table control record fields, you must be using a work area to update or whatever action you are going to do.

I suggest you to have an extra field with a single character as a part of the above work area.

Now, loop on the table control and if any particular row is modified then modify the record and update the flag value as 'X'.

So, at the end you can track down all the records having the flag value as 'X' and update accordingly.

Hope this works out.

Read only

0 Likes
1,420

Hi babu,

My issue is

Now, loop on the table control and if any particular row is modified then modify the record and update the flag value as 'X'.

how to identify a particular row field(s) are/is modified??

Thanks,

Rajan

Read only

0 Likes
1,420

Rajan,

Mansi had provided with the code. It would be of help. Check that.

See, as you are maintaining the price list in a table control...whenever you click on particular row of the table control then flag would be updated as X.

Check SDN Forums for more help on this.

Edited by: Babu Kilari on Mar 27, 2009 6:23 AM

Read only

0 Likes
1,420

Rajan,

If you have got the solution by now. Close the thread by marking it as Answered.

Thanks,

Babu Kilari

Read only

Former Member
0 Likes
1,420

Hi,

after modifying when the user presses the enter button. then the values from the values from the dynpro enters into ur program. there u can add ur icon...


PROCESS AFTER INPUT.
  LOOP AT it_tab.
    MODULE get_tab.
  ENDLOOP.

MODULE get_tab INPUT.
  DATA: wa_tab LIKE LINE OF it_tab.
  READ TABLE it_tab
             INTO wa_tab
             INDEX tab1-current_line.
*-----------------------------------Updating Internal table from Screen*
  IF sy-subrc = 0.
    it_tab-icon = <icon>.
    MODIFY it_tab INDEX tab1-current_line.
  ELSE.
    it_tab-icon = <icon>.
    APPEND it_tab.
  ENDIF.
*----------------------------------------------------------------------*
  CLEAR: it_tab.
ENDMODULE.                 " GET_TAB  INPUT

when performing save, just clear those icons....

Read only

0 Likes
1,420

Problem solved

Thanks

Rajan

Read only

Former Member
0 Likes
1,421

Hi,

The flow logic of your table control screen will be like:


PROCESS BEFORE OUTPUT.
  MODULE STATUS_8001.

  LOOP WITH CONTROL MOVIE.  "movie is your table control name
    MODULE PASS_DATA.            "This module reads the data from the internal 
                                                   "table into the table control 
  ENDLOOP.

PROCESS AFTER INPUT.
  MODULE USER_COMMAND_8001.

  LOOP WITH CONTROL MOVIE.
    MODULE DISPLAY_DATA.           "This module will modify the table control
                                                       "changes back into the internal table

  ENDLOOP.

  
******SCREEN 8001***READING DATA FROM MOVIE_TAB TO TABLE CONTROL********
MODULE PASS_DATA OUTPUT.

  SORT MOVIE_TAB.
  READ TABLE MOVIE_TAB INDEX MOVIE-CURRENT_LINE.

ENDMODULE.                 " GET_DATA  OUTPUT.



******SCREEN 8001****MODIFYING INTERNAL TABLE FROM TABLE CONTROL********
MODULE DISPLAY_DATA INPUT.

*  IF MOVIE_TAB-FLAG = 'X'.

  MODIFY MOVIE_TAB INDEX MOVIE-CURRENT_LINE.

*  ENDIF.

ENDMODULE.                 " DISPLAY_DATA  INPUT


Hope it helps

Regards

Mansi

Read only

0 Likes
1,420

Hi all,

to modify a particular line item, I am not selecting the line by pressing push button beside the table control.

so, my point is that when I change the value of any particular field in the line, I need to set a flag in the corresponding row.

Regards,

Rajan