Operation in the table

Read internal table

READ TABLE

READ TABLE itab { table_key
                | free_key
                | index } result.

table_key: { FROM wa }
  | { WITH TABLE KEY {comp_name1|(name1)} = dobj1
                     {comp_name2|(name2)} = dobj2

free_key: WITH KEY comp1 = dobj1 comp2 = dobj2 [BINARY SEARCH]

Behind the operator can not take the OR condition, or use other non-equal comparison operators

Result : the INTO {wa [ transport_options ]} "wa taken row contents into the workspace

| [COMPARING <F1> <F2> ... | ALL the FIELDS] " COMPARING: System respective components <k1> ... <kn> (key field) to read bank and the specified work area <wa> in accordance with compared. If the system is looking for the same specified <k1> ... <kn> find a corresponding entry, and comparing the contents of the field, then sets SY-SUBRC to 0, if the contents of the different fields compared returns value 2; if the system according to <k1> ... <kn> No entries, contains 4. If an entry is found, regardless of how the results of the comparison, are read into the wa
  | {ASSIGNING <fs> [CASTING ]} taken row stored in <fs> field symbol
  | {REFERENCE INTO dref} taken dref row is indexed
  |. {TRANSPORTING NO fIELDS} the system according to find the corresponding <key> (key field) condition entries, only the component fields <result> stored in the specified work area.

LOOP AT itab [INTO <wa>]

The AT ITAB LOOP Result (and read the same) [ cond ].  
ENDLOOP.

Cond: [the FROM idx1] [the TO idx2] the FROM ... the TO: only applies to standard tables and sorting table

[WHERE log_exp]. Applicable to all types of inner

AT – itab

 

 

LOOP AT <itab>.

AT FIRST. ... ENDAT.

AT NEW <f1>. ...... ENDAT.

AT NEW <f2>. ...... ENDAT.

<single line processing>

AT END OF <f2>.... ENDAT.

AT END OF <f1>. ... ENDAT.

AT LAST. .... ENDAT.

ENDLOOP.

<line>

meaning

FIRST

The first row in the table trigger

LAST

The last line in the table when the trigger

NEW <f>

Adjacent data in the same row <f> field is composed of a group, to trigger the beginning of the cycle when the group

END Of <f>

Adjacent data in the same row <f> field is composed of a group, to the last cycle triggered when the group

 

 

 

 

 

 

 

 

AT END OF sequential and AT NEW is the opposite of

If AT - SUM ENDAT use of the block, the system calculates the current row group all numeric fields and rows of the work area and writes the corresponding fields

Fill internal table

INSERT   INSERT line_spec INTO itab_position [result].


{wa} "single drop
| the INITIAL the LINE {}
|. JTAB. OF LINES {[the FROM the idx1] [idx2 the TO]}" bulk insert

 

{TABLE itab}
|{itab[INDEX idx]}

 

{ ASSIGNING <fs> [CASTING] }
| { REFERENCE INTO dref }.

 

L   COLLECT  COLLECT the INTO ITAB WA [ Result ]. On the digital field values in a row of the same section of the same name to an accumulated value of the record keyword, only non-key fields are summed up table in addition to the key field of the table must be all numeric field type ( I , P , F )

APPEND   APPEND line_spec TO itab [SORTED BY comp] [result].

MODIFY   MODIFY { itab_line | itab_lines }.

 

TABLE ITAB} {|} {ITAB the INDEX IDX the FROM WA
[ TRANSPORTING comp1 comp2 ...] [ Result .] "Is modified only comp1 comp2

itab FROM wa TRANSPORTING comp1 comp2 ... WHERE log_exp.

 

DELETE

 

{TABLE itab table_key}
  | {itab [INDEX idx]}.

itab [FROM idx1] [TO idx2] [WHERE log_exp]

ITAB DUPLICATES the FROM ADJACENT
[COMPARING { comp1 comp2 ...} |} {ALL the FIELDS] Note Before, when not in use COMPARING option to delete duplicate data, be sure to follow the order in the table to sort keyword statement to delete duplicate data , otherwise it will not be removed; if the cOMPARING option is specified, you need to sort (such as cOMPARING <F1> <F2> according to the specified compare field order, you need to sort by <F1> <F2> , but can not be sort by <F2> <F1> ), you can delete all the duplicate data   

 

the  SORT

The SORT ITAB [STABLE]
          {{[ASCENDING | DESCENDING]
              [the AS the TEXT]
the SET LOCALE the LANGUAGE 'E' according to the local text environment sorting.
              [BY { COMP1 [ASCENDING | DESCENDING] [the AS the TEXT]}
                  { COMP2 [ASCENDING | DESCENDING] [ the TEXT the AS]}
                  ...]}
          | {[BY (OTAB)]}}.

NOTE: APPEND / INSERT ... INDEX operating Hash table can not be used

When APPEND / INSERT ... INDEX table for sorting conditions: Additional / Key must follow the ascending additional insertion; Unique sorting table if it is, you can not attach / reattachment inserted data,

Search internal tables

The FIND [{FIRST OCCURRENCE} | {ALL OCCURRENCES occurrences}. OF] pattern
  the IN TABLE ITAB [ table_range ]
  [the IN {BYTE | the CHARACTER} the MODE]
  [{respecting is | Ignoring} the CASE]
  [the MATCH COUNT MCNT]
number of matches
  {{[MATCH LINE mlin ]
?
     [MATCH OFFSET moff]
last match starting position
     [MATCH LENGTH mlen]}
last match length
  | [result_tab the RESULTS | result_wa]}
  [SubMatches S1 ... S2].

 

REPLACE [{FIRST OCCURRENCE}|{ALL OCCURRENCES} OF] pattern
        IN TABLE itab [table_range] WITH new
        [IN {BYTE|CHARACTER} MODE]
        [{RESPECTING|IGNORING} CASE]
        [REPLACEMENT COUNT rcnt]
        { {[REPLACEMENT LINE rlin]
           [REPLACEMENT OFFSET roff]
           [REPLACEMENT LENGTH rlen]}
        | [RESULTS result_tab|result_wa] }.

Guess you like

Origin www.cnblogs.com/xj159/p/11949319.html