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 row in table control

Former Member
0 Likes
1,422

Hi Experts,

before displaying the records in table control i am disabling those records.

and i have one button 'insert'.when ever i'll click that the result will be adding the new row in table control and that will be in enable mode .how to do this can any body tell me.

thanks in advance,

vidya

3 REPLIES 3
Read only

Former Member
0 Likes
557

Hi,

Refer these threads.

[;

[;

Hope these help.

Regards

Sourabh

Read only

Former Member
0 Likes
557

Hi,

try the following code.i got the output.

But u need to use the screen validations.

1.TOP-INCLUDE

DATA: ITAB1 LIKE KNA1 OCCURS 0 WITH HEADER LINE.

DATA: ITAB2 LIKE KNA1 OCCURS 0 WITH HEADER LINE.

DATA: WA LIKE KNA1.

DATA: ANT TYPE I,CUR TYPE I.

DATA: OK_CODE TYPE SY-UCOMM.

CONTROLS: TABCTRL TYPE TABLEVIEW USING SCREEN 100.

IN FLOWLOGIC

PROCESS BEFORE OUTPUT.

LOOP AT ITAB1 CURSOR CUR WITH CONTROL TABCTRL.

ENDLOOP.

PROCESS AFTER INPUT.

MODULE CLEAR_DATA.

LOOP AT ITAB1.

MODULE MOVE_DATA.

ENDLOOP.

ADD “OK_CODE” IN ELEMENT LIST. CLICK ON LAYOUT AND ADD TABLE CONTROL(name it as TABCTRL) AND PUSHBUTTONS AS FOLLOWS.

SELECT THE FIELDS FROM PROGRAM. SAVE CHECK AND ACTIVATE.

CLICK ON FLOWLOGIC EDITOR FROM APPLICATION TOOL BAR.

DOUBLE CLICK ON MODULE “CLEAR_DATA”.

write the in this module as below.

CLEAR ITAB2. REFRESH ITAB2.

DOUBLE CLICK ON MODULE “MOVE_DATA”.

write the code in this module as below.

APPEND ITAB1 TO ITAB2.

ACTIVATE PAI AND WRITE THE CODE AS BELOW.

CASE OK_CODE.

WHEN 'FETCH'.

SELECT * FROM KNA1 INTO TABLE ITAB1 UP TO 20 ROWS.

TABCTRL-LINES = SY-DBCNT.

WHEN 'ADD'.

GET CURSOR LINE CNT.

CNT = TABCTRL-TOP_LINE + CNT - 1.

CLEAR WA.

INSERT WA INTO ITAB1 INDEX CNT.

WHEN 'MODIFY'.

GET CURSOR LINE CNT.

READ TABLE ITAB2 INDEX CNT.

LOOP AT ITAB2.

MODIFY KNA1 FROM ITAB2.

ENDLOOP.

SELECT * FROM KNA1 INTO TABLE ITAB1.

WHEN 'EXIT'.

LEAVE PROGRAM.

ENDCASE.

SAVE,CHECK AND ACTIVATE ALL.

CREATE TCODE AND EXECUTE.

contact if u hv any issues regarding this code.

reward points,if it is useful.

Thanks,

Chandu.

Read only

0 Likes
557

Hi chandu,

thank you you send the useful code .my problem is solved .

thanks,

vidya.