*&---------------------------------------------------------------------*
*& Report ZSAMPLE1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZSAMPLE1.
types: begin of ty_t001,
bukrs(4) type c,
butxt type butxt,
ort01 type ort01,
land1 type land1,
WAERS type WAERS,
spras type spras,
end of ty_t001.
data: it_t001 type table of ty_t001,
wa_t001 type ty_t001.
data: it_t0012 type table of ty_t001.
data: it_t0013 type table of ty_t001.
data: it_t0014 type table of ty_t001.
select bukrs
butxt
ort01
land1
WAERS
spras
into TABLE it_t001 from t001.
APPEND LINES OF it_t001 from 1 to 5 to it_t0012.
insert LINES OF it_t001 from 1 to 5 INTO it_t0013 INDEX 01.
it_t0014 = it_t001.
data v_lines type integer.
DESCRIBE TABLE it_t001 LINES v_lines.
BREAK-POINT.
*Sorting the itab Ascending/Decending, Ascending is default
sort it_t001 ASCENDING by bukrs.
*Delete a perticulat record from internal table
delete it_t001 where bukrs = '0007'.
*Delete ADJACENT DUPLICATES record from internal table
*Make sure that the itab is sorted with all the fields of comparing
delete adjacent duplicates from it_t001 comparing ort01.
*Reading Single record from an itab, read always reads a single record.
read TABLE it_t001 into wa_t001 INDEX 2.
clear wa_t001.
BREAK-POINT.
loop at it_t001 into wa_t001 from 1 to 20.
write: / wa_t001-bukrs,
wa_t001-butxt,
wa_t001-ort01,
wa_t001-land1,
wa_t001-WAERS,
wa_t001-spras.
CLEAR wa_t001.
ENDLOOP.
*FREE it_t001.
BREAK-POINT.
*& Report ZSAMPLE1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZSAMPLE1.
types: begin of ty_t001,
bukrs(4) type c,
butxt type butxt,
ort01 type ort01,
land1 type land1,
WAERS type WAERS,
spras type spras,
end of ty_t001.
data: it_t001 type table of ty_t001,
wa_t001 type ty_t001.
data: it_t0012 type table of ty_t001.
data: it_t0013 type table of ty_t001.
data: it_t0014 type table of ty_t001.
select bukrs
butxt
ort01
land1
WAERS
spras
into TABLE it_t001 from t001.
APPEND LINES OF it_t001 from 1 to 5 to it_t0012.
insert LINES OF it_t001 from 1 to 5 INTO it_t0013 INDEX 01.
it_t0014 = it_t001.
data v_lines type integer.
DESCRIBE TABLE it_t001 LINES v_lines.
BREAK-POINT.
*Sorting the itab Ascending/Decending, Ascending is default
sort it_t001 ASCENDING by bukrs.
*Delete a perticulat record from internal table
delete it_t001 where bukrs = '0007'.
*Delete ADJACENT DUPLICATES record from internal table
*Make sure that the itab is sorted with all the fields of comparing
delete adjacent duplicates from it_t001 comparing ort01.
*Reading Single record from an itab, read always reads a single record.
read TABLE it_t001 into wa_t001 INDEX 2.
clear wa_t001.
BREAK-POINT.
loop at it_t001 into wa_t001 from 1 to 20.
write: / wa_t001-bukrs,
wa_t001-butxt,
wa_t001-ort01,
wa_t001-land1,
wa_t001-WAERS,
wa_t001-spras.
CLEAR wa_t001.
ENDLOOP.
*FREE it_t001.
BREAK-POINT.
No comments:
Post a Comment