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

Insert a line into a table control

Former Member
0 Likes
632

Hi,

I have a table control that is in the display mode.

I have a button called insert on top of the table control .

When i click on the insert button , I should have a new row in the table control with change mode,i.e. I should be able to enter some values in the new row .

Please could anyone help me out with this.

Regards,

Sushanth H.S.

3 REPLIES 3
Read only

Former Member
0 Likes
492

Hi Sushanth Srinivas,

In your PBO, you can adjust the field properties using the usual "loop

at screen." style logic - but with a table control, you just need to do

this inside the table control loop e.g. along the lines of this (not

syntax checked):

Screen flow PBO

loop at gt_data1 into gs_data1 with control gtc_9999.
  module d9999_modify_screen_tc.
endloop.

PBO module

Module d9999_modify_screen_tc output.

if sy-ucomm eq 'INSERT'.

  loop at screen.              "for current row of TC
    if screen-name = 'XYZ'.    "for one cell
      screen-input  = 1.
    endif.
    modify screen.
  endloop.
endif.

endmodule.

Regards,

Mahi.

Read only

Former Member
0 Likes
492

Hi

To add a new row you can do

PBO

case sy-ucomm.

when 'INSERT'.

loop at screen.

if screen-name = 'TABLE_CINTROL'.

TABLE_CINTROL-count = TABLE_CINTROL-count + 1.

endif.

endloop.

endcase.

Regards

Aditya

Read only

Former Member
0 Likes
492

hi,

CASE OK_CODE.

WHEN 'INSERT'.

LOOP AT ITAB.

IF ITAB-MARK = 'X'.

INSERT INITIAL LINE INTO ITAB.

FLAG = '1'.

ENDIF.

ENDLOOP.

IF FLAG <> '1'.

APPEND INITIAL LINE TO ITAB.

ENDIF.

ENDCASE.

try this piece of code,it may be helpful.

regards,

sravanthi