01-18-2008 6:05 AM
hi gurus
i have a problem in this code yhat iam not delete and insert the data in
my table plz chk the code and give info abt it.
also tell me how to debug a report or codes by step by step.
codes:
tables: zemp.
DATA: itab like table of zemp with header line.
select-options: s_eno for zemp-eno obligatory,
s_ENAME for zemp-ENAME no intervals obligatory,
s_EADDRE for zemp-EADDRESS no intervals obligatory,
s_ESTATE for zemp-ESTATE no intervals obligatory.
parameters: p1 as checkbox,
p2 as checkbox.
start-of-SELECTION.
if p1 = 'x'.
itab-ENO = s_ENO-low.
itab-ENAME = s_ENAME-LOW.
itab-EADDRESS = s_EADDRE-LOW.
itab-ESTATE = s_ESTATE-LOW.
APPEND ITAB.
IF SY-SUBRC <> 0.
INSERT zemp from table itab.
WRITE: 'SAVED'.
endif.
ENDIF.
if p2 = 'x'.
SELECT ENO ENAME EADDRESS ESTATE FROM zemp into TABLE ITAB
WHERE ENO = s_ENO AND
ENAME = s_ENAME AND
EADDRESS = s_EADDRE AND
ESTATE = s_ESTATE.
DELETE zemp FROM itab.
IF SY-SUBRC = 0.
WRITE:/ 'DELETED'.
ENDIF.
endif.
plz rply.
01-18-2008 6:11 AM
Hi Jayant,
The code u wrote is correct.And we have to mention 'X' as capital ok.
if p1 = 'X'.
And also before inseting data into ztable we have to modify the internal table.
if p1 = 'X'.
itab-ENO = s_ENO-low.
itab-ENAME = s_ENAME-LOW.
itab-EADDRESS = s_EADDRE-LOW.
itab-ESTATE = s_ESTATE-LOW.
APPEND ITAB.
IF SY-SUBRC 0.
modify itab.
INSERT zemp from table itab.
endif.
Reward points if helpful.
Kiran Kumar.G.A
Have a Nice Day..
01-18-2008 6:24 AM
Hi,
goto program and goto test and in that debugging.
other way is after selection u want to debug then give /h in command field and then do debugging.
and in ur program use capital letters 'X'.
PLzz reward points if it helps.