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: 

Problem in Table control wizard

0 Kudos
376

Hi All,

I am using table control with wizrd on screen and i want to update ztable.

the problem is while i am entering multiple line in table control it will only store last record in ztable.

e.g

1. 401 10 8091401 02.02.2009

2. 401 20 8091402 02.02.2009

In ztable it stores second line

Thanks

Vijay

1 ACCEPTED SOLUTION

Former Member
0 Kudos
112

How have u designed the table control with wizard ?

Did you assign an internal table and a workarea declared in your program top include ?

Did you keep one field for the marking of the records in the table control ?

Have you ticked the multiple line selection tick box ?

12 REPLIES 12

Former Member
0 Kudos
113

How have u designed the table control with wizard ?

Did you assign an internal table and a workarea declared in your program top include ?

Did you keep one field for the marking of the records in the table control ?

Have you ticked the multiple line selection tick box ?

0 Kudos
112

No

I am using Dictonary table (Same table i want to update ).

In that multiple line selection tick box disable.

Thanks

Vijay

0 Kudos
112

Is your table control data table and the internal table from which you are populating the table control is in sync after you have input those two records ?

If yes then are you looping on that table while updating the ztable ?

0 Kudos
112

I am using following syntax for updating ztable.

case ok_code.

when 'ENTR'.

modify ztable from g_wa. (Using wa which is generated after creating wizard)

endcase.

thanks

0 Kudos
112

g_wa is just a work area which will contain the latest record in it. As in your case it contains the second record.

You will have to loop through that internal table containing the data and update each record. Or simply use

Update ZTABLE (your database table) from table it_data (your internal table).

In this case all your records in the internal table will be updated to the database table.

Edited by: Ganesh Venkatakrishnan on Sep 24, 2009 9:49 AM

0 Kudos
112

>

> I am using following syntax for updating ztable.

>

case ok_code.
> when 'ENTR'.
> modify ztable from g_wa.  (Using wa which is generated after creating wizard)
> endcase.

> thanks

Hi Suhas,

if the module, in which this code exist, is inside the loop then only it can update all the records. else just imagine the scenario, you are updating the ztable only from workarea. work area holds only single value.

what i suggest you is there are two options as you have designed it with wizard:

1st. put this code inside the module which comes in the

loop at z_tablecntrl. 
chain.
 ...
 module1. 
 module2.  " put the same code what you wrote in this module2.
endchain. 
endloop.

2nd. put this code in the module outside the loop lets say in the module: MODULE USER_COMMAND_<scrno>, but change the code to:

modify ztable from table gt_table. " gt table if you have declared your table from work area. else only modify ztable will do

hope this helps you

0 Kudos
112

Thanks for your reply

I worked on your second option and now it works fine.

I write follwing code in module USER_COMMAND_1000 input.

CASE OK_CODE.

WHEN 'ENTR'.

LOOP AT G_TEST1_ITAB.

MODIFY ZILOG FROM G_TEST1_ITAB.

ENDLOOP.

But now i face another problem.

When I enter values and press enter button it will store the values in ztable and after executing program again screen shows previous records.

Then I comment the following line in PBO

MODULE TEST1_MOVE.

After remove this line when I press ENTER for data storage the values are store in ztable but the values are not remains on screen after pressing ENTRER button.

Thanks

Vijay

0 Kudos
112

Your problem is confusing. Do you want to retain those values on the screen or you want it to be cleared once it is updated to the ZTABLE.

Write a module in PBO which fetches the latest record from ZTABLE and displays it on the screen.

0 Kudos
112

you want to keep the previous records or not?

if you want to keep:

do nothing

if not:

clear/refresh the table which is declared in the table control after the modify block.

0 Kudos
112

If i enter 2 records and press enter button then that record store in ztable. Then if I execute the program second time the previous 2 records are on screen. this time again I enter 2 new records the z table is updated correctly. Then after executing again there are 4 records on my screen.

e.g

First i enter these 2 records

1. 401 10 8091401 02.02.2009

2. 401 20 8091402 02.02.2009

ENTER

After executing second time I enterfollowing 2 records

1. 402 10 8091403 02.02.2009

2. 402 20 8091404 02.02.2009

ENTER

Now after executing 3 time there are 4 previos record on screen

e.g

1. 401 10 8091401 02.02.2009

2. 401 20 8091402 02.02.2009

3. 402 10 8091403 02.02.2009

4. 402 20 8091404 02.02.2009

Thanks

0 Kudos
112

SO I suppose, its good that the table is showing all the records in your ZTABLE.

Now what is your requirement ?

Former Member
0 Kudos
112

Hey Suhas,

I have a solution for u ...... why dont u create a table maintenance for the Ztable, which is provided by SAP it self. it looks simlar to table control and a module pool program.

here are the steps to create one:

u2022 Go to SE11

u2022 Open the table whose maintenance view you want to create

u2022 Go to  Utilities  Table Maintenance Generator

u2022 Enter  Authorization Group -- &NC&

 Function Group -- (any Z Function Group name for ur info keep table name n FG name same)

  • you need to create Fg separately from SE80 anf the give it here

 Package -- $TMP ( or as per ur requirement)

 Maintenance Type

One step ( choose one step only - two step will not give u table control display)

 Maint. Screen No.

Overview screen -- 7000

u2022 Then u201C SAVE u201C

How to call table maintenance view in ur program ( report )

u2022 Then using the above FM u can call it anywhere u want.

CALL FUNCTION 'VIEW_MAINTENANCE_CALL'

EXPORTING

action = 'U' " U means u can edit the table entries

view_name = 'zark_prod_comb1' u201C Name of the TM view

EXCEPTIONS

client_reference = 1

foreign_lock = 2

invalid_action = 3

no_clientindependent_auth = 4

no_database_function = 5

no_editor_function = 6

no_show_auth = 7

no_tvdir_entry = 8

no_upd_auth = 9

only_show_allowed = 10

system_failure = 11

unknown_field_in_dba_sellist = 12

view_not_found = 13

OTHERS = 14.

or if u dont want to call in program , then through Sm30 to can directly edit n maintain table entries in your Ztable same way u do in table control.

-


Close the post once u get the solution