Google Search - Blog...........

ABAP - Delete, Append & Modify Internal table With Header Line.

report .

data: begin of itab occurs 0,
name(10) type c,
age type i,
end of itab .
selection-screen begin of line .
parameters:p_wa(100) type c .
selection-screen end of line .
selection-screen skip 2.
selection-screen begin of line .
SELECTION-SCREEN:
PUSHBUTTON 2(10) but1 USER-COMMAND cli1,
PUSHBUTTON 15(20) but2 USER-COMMAND cli2 ,
PUSHBUTTON 40(20) but3 USER-COMMAND cli3 visible length 5 .

selection-screen end of line .

at selection-screen .

case sy-ucomm .

when 'CLI1'.
itab-name = p_wa+0(10) .
itab-age = p_wa+11(2).
append itab.

when 'CLI2'.
delete itab where name = p_wa+0(10) .

when 'CLI3'.
read table itab with key name = p_wa+0(10).
if sy-subrc = 0.

modify itab transporting name age.
else .
exit.
endif .

endcase .


start-of-selection .

loop at itab.
write:/ itab-name .
endloop.

No comments:

Post a Comment