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

edit in table control

Former Member
0 Likes
1,207

hi,

i created a screen, in that screen a table control is added for that table i changed table fields settings only to 'Display ' .....

now i created a button in application bar and if i click that button i must edit that table control........

plz can any help me how to get edit mode in table ..............

thanx .....

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,128

Hi

U need to manage it into the LOOP/ENDLOOP of table controls in PBO process.

It's better to create a flag to be set when the user press the button for display/edit, this flag has to be checked in order to decide which value has to be assigned to output chararcteristic of the fields of the table control:

 PROCESS PBO.
   
   LOOP AT ITAB WITH ................
       MODULE CHANGE_SCREEN.
  ENDLOOP.

PROCESS PAI.
   
   LOOP AT ITAB.
  ENDLOOP.
  
   MODULE USER_COMMAND.

MODULE CHANGE_SCREEN
    LOOP AT SCREEN.
      SCREEN-INPUT = FL:INPUT.
      MODIFY SCREEN.
   ENDLOOP.
ENDMODULE.

 MODULE USER_COMMAND.
   CASE OK_CODE.
      WHEN 'EDIT'. FL_INPUT = '1'.
      WHEN 'DISP'. FL_INPUT = '0'.
     ....................
ENDMODULE.

Define that flag in top include with a default value:

 DATA: FL_INPUT(1) TYPE C VALUE '0'. "<--- Screen not editable by default 

Max

5 REPLIES 5
Read only

Former Member
0 Likes
1,129

Hi

U need to manage it into the LOOP/ENDLOOP of table controls in PBO process.

It's better to create a flag to be set when the user press the button for display/edit, this flag has to be checked in order to decide which value has to be assigned to output chararcteristic of the fields of the table control:

 PROCESS PBO.
   
   LOOP AT ITAB WITH ................
       MODULE CHANGE_SCREEN.
  ENDLOOP.

PROCESS PAI.
   
   LOOP AT ITAB.
  ENDLOOP.
  
   MODULE USER_COMMAND.

MODULE CHANGE_SCREEN
    LOOP AT SCREEN.
      SCREEN-INPUT = FL:INPUT.
      MODIFY SCREEN.
   ENDLOOP.
ENDMODULE.

 MODULE USER_COMMAND.
   CASE OK_CODE.
      WHEN 'EDIT'. FL_INPUT = '1'.
      WHEN 'DISP'. FL_INPUT = '0'.
     ....................
ENDMODULE.

Define that flag in top include with a default value:

 DATA: FL_INPUT(1) TYPE C VALUE '0'. "<--- Screen not editable by default 

Max

Read only

0 Likes
1,128

HI,

In table control i hav take table 't_itab2' from program, am able 2 c data but am not abl 2 edit data in table......

plz can u further help me ..........

thanx 4 reply

Read only

0 Likes
1,128

For editing data in table t_itab2 you have to write code in PBO .

As an example please refer the following test code

DATA: WA_TAB TYPE CXTAB_COLUMN.

LOOP AT t_itab2-COLS INTO WA_TAB.

IF WA_TAB-SCREEN-GROUP1 = 'A1' .

WA_TAB-SCREEN-INPUT = 0.

MODIFY y_itab-COLS FROM WA_TAB.

ENDIF.

ENDLOOP.

hope it will solve your prob.

Gaurav Handa

Edited by: Gaurav Kumar on Oct 30, 2009 6:55 AM

Read only

Former Member
0 Likes
1,128

Hi Ask,

Code like this in the PAI of the screen.

table control name is flights.

data : cols like line of flights-cols.

IF sy-ucomm = 'TOGGLE'. "Assuming buttons function code is TOGGLE

LOOP AT flights-cols INTO cols.

IF cols-screen-input = '0'.

cols-screen-input = '1'.

ELSEIF cols-screen-input = '1'.

cols-screen-input = '0'.

ENDIF.

MODIFY flights-cols FROM cols INDEX sy-tabix.

ENDLOOP.

endif.

Thanks

Rohit Gaharwar

Read only

Former Member
0 Likes
1,128

hai,

If you are creating table control Without Wizard, Then Do Following Steps,

1 Suppose In table contro you are using It_disp Internal Table.

2 When you are clicking Pushbutton, There will be some Sy-ucomm is coming.

3 Inside MODULE USER_COMMAND_0101.

4 At-sy-ucomm.

Write Following Code.

Inside PBO For Making it in Display Mode, Add code like this:

if it_disp is initial and flag ne 'X'.
loop at screen.
if screen-group2 = 'X'.
  screen-input = 0.
  modify screen.
endif.
endloop.
endif.

case sy-ucomm.
 WHEN 'INSR'. 
flag = 'X'.
append initial line to it_disp. 
describe table it_disp lines idisp-lines
endcase.

Edited by: shelly Malik on Aug 14, 2009 11:42 AM

Edited by: shelly Malik on Aug 14, 2009 11:43 AM