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

Problem in modifying the existing record in table control

Former Member
0 Likes
691

Hi Experts,

I have one table control.If I enter one record and save it.Then If I am modifying the same record a duplicate record is going to exist.In table control contains key fields,if I modify the key fields a duplicate is going to exists.how to resolve it.

Hi Experts,

I have one table control.If I enter one record and save it.Then If I am modifying the same record a duplicate record is going to exist.In table control contains key fields,if I modify the key fields a duplicate is going to exists.how to resolve it.

3 REPLIES 3
Read only

madhu_vadlamani
Active Contributor
0 Likes
648

Hi,

I do not what is the code you written. Check the sample program RSDEMO02.

[TC|;

[TC2|;

[TC3|http://learnmysap.com/sap-abab/58-create-table-control-using-abap-programming.html]

Check this and tell if the issue is not resolved.

Regards,

Madhu.

Read only

0 Likes
648

Hi Madhu Rao,

If I modify the key fields the problem will be arised.

In Flow logic.

LOOP .

MODULE tbc_modify ON CHAIN-REQUEST.

MODULE tbc_mark.

ENDLOOP.

In module.

MODULE tbc_modify INPUT.

MODIFY t_data

FROM fs_data

INDEX tbc-current_line.

IF sy-subrc NE 0.

APPEND fs_data TO t_data.

ENDIF.

ENDMODULE.

MODULE tbc_mark INPUT.

DATA: tbc_wa2 LIKE LINE OF t_data.

IF tbc-line_sel_mode = 1

AND fs_data-mark = 'X'.

LOOP AT t_data INTO tbc_wa2

WHERE mark = 'X'.

tbc_wa2-mark = ''.

MODIFY t_data

FROM tbc_wa2

TRANSPORTING mark.

ENDLOOP. .

ENDIF.

MODIFY t_data FROM fs_data

INDEX tbc-current_line

TRANSPORTING mark.

ENDMODULE.

Read only

0 Likes
648

Hai,

You cannot modify the key fields, when u try to do that Modify statement will insert a new line with the modified data. so what you can do is delete the old line and save the new one.

Best regards,

rama