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

table control

Former Member
0 Likes
395

i had got a table control with 3 cols ie item material quantity

now i when i enter item number 10 , material 2000 , quantity 10000

it is working fine

but when entering another record with item number 10 it should give me message that the item number exist

thiis is the code for ur reference

tables:ztest2.

controls: tctrl type tableview using screen 200.

data : it_test type standard table of ztest2,

wa_test type ztest2.

data: order type i value 1.

data : item type ztest2-posnr,

mat type mara-matnr.

case sy-ucomm.

when 'BACK'.

leave to screen 0.

when 'CREATE'.

leave to screen 0.

when 'EXIT'.

leave to screen 0.

item = ztest2-posnr mod 10.

if item ne 0.

message E000(zpawan) with 'error'.

endif.

select matnr from mara into mat where matnr = ztest2-matnr.

endselect.

if sy-subrc ne 0.

message E001(zpawan) with 'error'.

endif.

  • endselect.

******************selecting max value***************************

select max( orderno ) from ztest2 into order. .

order = order + 1.

WA_TEST-ORDERNO = order.

WA_TEST-POSNR = zTEST2-POSNR.

WA_TEST-MATNR = zTEST2-MATNR.

WA_TEST-ZMENG = zTEST2-ZMENG.

append wa_test to it_test.

insert into Ztest2 values wa_test.

endcase.

if sy-subrc eq 0.

message S002(zpawan) with 'success'.

endif.

ENDMODULE.

4 REPLIES 4
Read only

Former Member
0 Likes
364

Hi Pawan,

Check whether when u hit enter..the records are stored or not.

I think u or not checking whether the item exists or not in Ztest2.

if the item exists then it should display an error message..

U should be writing this part of the code in PBO.

hope it helps..

Thanks,

Chaitanya

Read only

Former Member
0 Likes
364

Is table ztest2 a DDIC table with item number as primary key ?

if yes then duplicate entries wont be allowed.

Read only

Former Member
0 Likes
364

Hi,

Also make Material as key field...

Read only

Former Member
0 Likes
364

Hi,

When you are entering the second give a condition to check whether the item no already exists or not in the ztest. If yes, display the error message. I think you have to include this piece of code in your program.

Sharin.