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

Deactivate Single row in Table Control

Former Member
0 Likes
2,474

Hi Experts,

I have created a table control in which all the fields are editable. I have created a checkbox so that i can select only those records i which want to edit or delete. Now my requirement is that when I select a single record and click on deactivate button ( I have created buttons for Delete, Edit & Deactivate ) the entire record should be deactivated or be displayed in display mode so that the same record cannot be futher selected to Edit or Delete.

I tried searching in the forums , but could not resolve the same.

Thanks in advance

7 REPLIES 7
Read only

Former Member
0 Likes
1,468

Hi Priti ,

You are filling records from internal table to table control , In PBO of screen.

At , this place you need to write your logic to consider the checkbox value.

You need to modify screen like below code :


    LOOP AT SCREEN.
     " Check Condition to deactivate
        screen-input = '0'.   
    ENDLOOP.

You can also search sdn on this.

Hope this helps you.

Read only

0 Likes
1,468

I already tried doing this but didnt work.

Can u send a sample code.

Thnks in advace

Read only

0 Likes
1,468

Process flow will be :

PBO of screen , at this time nothing will be deactivated as checkbox is not clicked.

Then PAI , here you need to save the value of checkbox in the internal table.

And now again PBO , now this check box value will decide with record will be activated.

You missed to save the checkbox value in internal table in PAI.

Hope this helpa you.

Read only

sarath_7
Participant
0 Likes
1,468

i hope this links will help you

[;

http://wiki.sdn.sap.com/wiki/display/ABAP/ModulePoolbasics

when 'deactive'

button is clicked read the table row index into tabcon-cols.

read that line by using index and make it invisible.

sample code to invisible 3 row.

HIDING A COLUMN

To hide a column we will use the INVISIBLE field of the structure CXTABA_CONTROL and set its value to 'X'.

e.g. To hide column number 3.

DATA col LIKE LINE OF tab-con-COLS .

READ TABLE tab_con-COLS INTO col WHERE index = 3. "tab_con is the name

" of table control.

col-INVISIBLE = 3.

MODIFY tab-con-COLS FROM col INDEX 3.

DISABLING INPUT

To disable/enable fields of a column we will use the field SCREEN-INPUT of the

structure CXTAB_COLUMN and set its value to 0 or 1.

e.g. To disable input at column 3 of the table control .

DATA col LIKE LINE OF tab_con-COLS.

READ TABLE tab_con-COLS INTO col INDEX 3.

col-SCREEN-INPUT = 0 .

MODIFY tab_con-COLS FROM col INDEX 3.

Regards

sarath

Read only

Former Member
0 Likes
1,468

Hi Priti,

Its little bit difficult to get the desired output using Table Control,, These can be achived using OO ALV. If posible use OOALV in the place of TC.

Regards,

Kumar M

Read only

Former Member
0 Likes
1,468

Hi,

in PBO
 
loop at itab with control tc.
module modify_screen. " If you place your loop at screen in this module the row will be editable/changed to disabled mode
endlooop.
 
in program.
module modify_screen.
 CASE ok.
    WHEN 'MOD'.  " Your Modify OK code
 
        LOOP AT SCREEN.
      IF jtab-mark = 'X'.
          IF screen-name = 'JTAB-MATNR'. " You can use screen group for the fields you want editable
" Assign a GRP1 for all key fields and GRP2 for other fields
" if screen-group2 = 'GRP2'. " All the screens belong to GRP2 will be modified here
            screen-input = 0.
            MODIFY SCREEN.
          ENDIF.
ELSE.
IF SCREEN-NAME = 'JTAB-MATNR'.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ENDIF.
        ENDLOOP.
clear jtab-mark.
modify jtab index sy-tabix. " This clears the Table control Row selector 
" If you dont want just remove this.
  ENDCASE.
endmodule.
 
in PAI
 
loop at  itab.
module modify_tab.
" In Top include
data : begin of jtab occurs 0,
mark type c,
 matnr type matnr,
maktx type maktx,
end of jtab.
 
" dont forget to enter JTAB-MARK in screenpainter at Table control W/SelColumn
in program
 
MODULE modify_tab.
  DESCRIBE TABLE jtab LINES tc-lines.
  MODIFY jtab INDEX tc-current_line. " This will transfer the Selected line back to internal table of program
ENDMODULE. 
endloop.
" Happy new year to you ALL
" This is a tested program and working fine in my system

Cheerz

Ram

Read only

kzak
Explorer
0 Likes
1,468

You can do it using statement LOOP AT spfli_tab INTO spfli WITH CONTROL flight_tab.

example:

PROCESS BEFORE OUTPUT.
MODULE prepare_tab.
LOOP AT spfli_tab INTO spfli WITH CONTROL flight_tab.

module disable_row. " you can write your logic inside module disable_row with statements loop at screen and screen-input = 0.

ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT spfli_tab.
MODULE modify_tab.
ENDLOOP.