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

Input Enabling in Table control

Former Member
0 Likes
3,328

Hi Experts,

I am fresher and I am doing a module pool program where I have one table control. I am input disabling all the fields in Table control and when I press 'ADD' button only one line(row) shoule be input enabled( Like in SM30). May I know how it is possible?

Thanks and regards,

Venkat

8 REPLIES 8
Read only

Former Member
0 Likes
1,358

1. while creation time you shold be input enable the all the columns of table control

2. in PBO, change table control attributes module write the below logic.

DESCRIBE TABLE <gt_flink> LINES tcon_ch-lines.

IF tcon_ch-lines EQ 0.

tcon_ch-lines = 1.

ENDIF.

3. In PAI, at user command module for insert/delete buttons logic is same.

may be it is helpful to solve your issue.

Read only

Former Member
0 Likes
1,358

Hi

try this...

data : v_index type sy-tabix.
when 'ADD'.
describe table itab lines v_index.
v_index = v_index + 1.
insert initial line into itab index v_index.

Read only

Former Member
0 Likes
1,358

Hi Venkat,

In the PBO of your table control you can declare lke this:



  DATA : LIN TYPE I.

  DESCRIBE TABLE ITAB LINES LIN.

  TABC-LINES = LIN + 5.


Hope this helps

Regrds

Mansi

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,358

Hi,

Follow these steps:-

it_zekpo is my internal table w/o header line,

wa_zekpo is work area.

Name of input/output fields on screen are:-

wa_zekpo-field1,

wa_zekpo-field2, and so on...

Take the group1 for all textboxes as 'ABC' in the table control

Keep all the textbox (i/o field) in table control as output only.

And when user clicks 'ADD' button, existing record are read-only and rest rows are input enabled.

Try using code:-

At screen logic:


PROCESS BEFORE OUTPUT.
*  MODULE status_8003.
 
  LOOP WITH CONTROL po_tb.
    MODULE read_data.
  ENDLOOP.
 
PROCESS AFTER INPUT.
*  MODULE user_command_8003.
 
  LOOP WITH CONTROL po_tb.
    MODULE modify_data.
  ENDLOOP.
 

In PBO


*&---------------------------------------------------------------------*
*&      Module  READ_DATA  OUTPUT
*&---------------------------------------------------------------------*
MODULE read_data OUTPUT.

  data : line_count type i.
 
  describe it_zekpo
  lines line_count.
 
  po_tb-lines = line_count + 10.
  "to increase the number of lines in table control dynamically

  READ TABLE it_zekpo INTO wa_zekpo INDEX po_tb-current_line. "po_tab is table control name
 
  CASE sy-ucomm.
    WHEN 'ADD'.  
      if sy-subrc = 0. 
        loop at screen.
          if screen-group1 = 'ABC'.
            screen-input = 0. "disable for input
          endif.
          modify screen.
        endloop.
      else.
        loop at screen.
          if screen-group1 = 'ABC'.
            screen-input = 1. "enable for input
          endif.
          modify screen.
        endloop.
      endif.
    WHEN 'SAVE'.
      loop at screen.
        if screen-group1 = 'ABC'.
          screen-input = 0. "disable for input
        endif.
        modify screen.
      endloop.
  ENDCASE.

"when user click ADD button rows with no data are enabled for input
"when user click SAVE button save data in internal table
"and then disable all rows again
ENDMODULE.                 " READ_DATA  OUTPUT

In PAI


*&---------------------------------------------------------------------*
*&      Module  MODIFY_DATA  INPUT
*&---------------------------------------------------------------------*
MODULE MODIFY_DATA INPUT.
  MODIFY IT_ZEKPO FROM WA_ZEKPO INDEX po_tb-currentline.
  "this will modify the contents of existing line
ENDMODULE.                 " MODIFY_DATA  INPUT

Hope this helps you.

Regards,

Tarun

Read only

Former Member
0 Likes
1,358

Hi Venkat,

refer to this piece of code..may be it is helpful to u


when 'ADD'.

***To insert or append an initial line into table control 
tabstripg8-activetab = 'LINE'.   "active tab in the tab strip control
loop at itabline.  "itabline is the internal table for line items
     if itabline-mark1 = 'X'.
        insert initial line into itabline.
        flag = '1'.
     endif.
endloop.
if flag '1'.
append initial line to itabline.
endif.

U can also refer to the below post for module pool sample code.

Regards,

Sravanthi Chilal.

Read only

Former Member
0 Likes
1,358

hi

just try this i'm sure u will get it.

in SE51

process before output.

module status_8000.

loop with control control.

module fill_table_control.

endloop.

process after input.

loop with control control.

module read_table_control.

endloop.

module user_command_8000.

IN SE38

module status_8000 output.

set pf-status 'XXXX'.

set titlebar 'TITLE'.

describe table i_tab lines lines.

control-lines = lines + 10.

endmodule. " STATUS_8000 OUTPUT

module fill_table_control output.

if sy-ucomm = 'ADD'.

loop at screen.

if flag is initial.

screen-input = 0.

elseif ( flag EQ 'Y' ).

if ( ( screen-name = 'I_ITAB-SNO' or

screen-name = 'I_ITAB-SNAME' or

screen-name = 'I_ITAB-SCITY' or

screen-name = 'I_ITAB-SEDU' or

screen-name = 'I_ITAB-SPERCENT' )

and control-current_line LE lines ).

screen-input = 1.

else.

endif.

endif.

modify screen.

endloop.

endif.

endmodule. " FILL_TABLE_CONTROL OUTPUT

module user_command_8000 input.

case sy-ucomm.

when 'ADD'.

flag = 'Y'.

endcase.

endmodule. " USER_COMMAND_8000 INPUT

Regards

Read only

Former Member
0 Likes
1,358

I made use of table control with wizard and it had all the required operations in that.

Read only

Former Member
0 Likes
1,358

To set input on or off in table control.

Suppose table contol u2013tabcon is made up of three fields,

ID NAME ADDRESS.

if u want to set input on or input off , of any field in the table control,

e.g after clicking u2018oku2019 button u want to set input off of address field.

Go to layout

Double click on address field in tabcon.

In its property make group1 = u2018080u2019.

Named it with three letters

On the flow screen,

After PBO

Loop at TABCON.

Module XYZ.

Endloop.

Double click on XYZ

Module XYZ output.

Case sy-ucomm.

When u2018OKu2019.

Loop at screen.

CASE screen-group1.

WHEN '080'.

IF screen-name = 'ITAB-ADDRESSu2019.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

Endloop.

Endcase.

Endcase.

Endmodule.