‎2008 Aug 07 10:19 PM
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.
‎2008 Aug 08 1:41 AM
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
‎2008 Aug 08 3:34 AM
Is table ztest2 a DDIC table with item number as primary key ?
if yes then duplicate entries wont be allowed.
‎2008 Aug 08 4:26 AM
‎2008 Aug 08 4:27 AM
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.