‎2006 Dec 08 11:01 AM
hi
i would like to know about append syntax
1. could any one tell me in which situation append is used.
2. could any one tell me with different synxtax i.e. with move, loop, select, read.
thanx
rocky robo
‎2006 Dec 08 11:12 AM
Hi ,
Append statement is used when you want to insert records into an internal table at the end.
The most common syntex is
append wa to itab. (wa : work area , itab:internal table.
another option is append lines of itab to itab1 (append lines of one internal table to another).
in select append can be used this way
select fields
appending table it
from table name
where condition.
A sample code is given below
-
data : begin of it_1 occurs 0 ,
matnr type matnr ,
end of it_1.
start-of-selection.
select matnr
into table it_1
up to 10 rows
from mara.
select matnr
appending table it_1
up to 10 rows
from mara.
loop at it_1.
write:/ it_1-matnr.
endloop.-
Regards
Arun
‎2006 Dec 08 11:15 AM
hi,
1) append is used to add a new value at the end of exsisting records in an internal table.
2)To move values between the components of structures, use the statement
MOVE-CORRESPONDING <struct1> TO <struct2>.
This statement moves the contents of the components of structure <struct1> to the components of <struct2> that have identical names.
When it is executed, it is broken down into a set of MOVE statements, one for each pair of fields with identical names, as follows:
MOVE STRUCT1-<ci> TO STRUCT2-<c i>.
Any necessary type conversions occur at this level. This process is different to that used when you assign a whole structure using the MOVE statement, where the conversion rules for structures apply.
DATA: BEGIN OF ADDRESS,
FIRSTNAME(20) VALUE 'Fred',
SURNAME(20) VALUE 'Flintstone',
INITIALS(4) VALUE 'FF',
STREET(20) VALUE 'Cave Avenue,
NUMBER TYPE I VALUE '11'.
POSTCODE TYPE N VALUE '98765'.
CITY(20) VALUE 'Bedrock',
END OF ADDRESS.
DATA: BEGIN OF NAME,
SURNAME(20),
FIRSTNAME(20),
INITIALS(4),
TITLE(10) VALUE 'Mister',
END OF NAME.
MOVE-CORRESPONDING ADDRESS TO NAME.
2) loop:
There are four kinds of loops in ABAP:
Unconditional loops using the DO statement.
Conditional loops using the WHILE statement.
Loops through internal tables and extract datasets using the LOOP statement.
Loops through datasets from database tables using the SELECT statement.
<a href="http://help.sap.com/saphelp_erp2005vp/helpdata/en/66/f9545ed3654bd4b55bf7a5b9953a53/frameset.htm">http://help.sap.com/saphelp_erp2005vp/helpdata/en/66/f9545ed3654bd4b55bf7a5b9953a53/frameset.htm</a>
READ
READ TABLE <itab> <key> INTO <wa> [COMPARING <f1> <f 2> ...
|ALL FIELDS]
[TRANSPORTING <f1> <f 2> ...
|ALL FIELDS
|NO FIELDS].
reward points if this helps you,
regards,
siva
‎2006 Dec 08 11:16 AM
If you type statement append and hit F1 key, the entire Append help will guide you through various types of append.
‎2006 Dec 08 11:25 AM
Hi
APPEND statement is used to append a line to an internal table eg itab , either from its header or from an explicit workarea.
Plz check the following syntax associated with it.
1.
Data : itab type <Ztable/standard SAP table > occurs 0 [ with heater line ].
wa_itab like line of itab.
populate fields of wa-itab .
Append wa_itab to itab. " it inserts a row in itab body
" in case the WITH HEADER LINE addition is chosen
APPEND itab. " it is same as APPEND itab TO itab. ie header to table body .
2. while selecting values from a Ztable / std SAP table.
eg .
Select f1 f2 .....fn APPENDING itab FROM <ztable / std SAP table>
[where Condition] .
" now u can loop at itab to display the records.
3. consider itab2 (with header line ) that has some fields common to itab .
the following code helps to move data from itab to itab2.
Loop at itab into wa_itab . " into wa_itab if WITH HEADER LINE addition is not
" is not given when declaring the table itab
Move corresponding wa_itab to itab2.
Append itab2.
Endloop. " this moves matching fields for all records in itab to itab2.
i hope this helps u a bit.
In case u need further info, plz revert.
Regards
Pankaj
‎2006 Dec 08 11:29 AM
hi...
Append statements are used for adding RECORDS with existing records,only at the BOTTOM.(at the end of all the existing entries)
eg:
data : it_tab type table of <table name>,
wa_tab type <table name>.
select <field names> from <table name> into it_tab where<condition>
<b>append wa_tab into it_tab.</b>
clear wa_tab.
syntax for read statement:
<b>read table<it_tab> into wa_tab from <condition></b>
syntax for move statement:
<b>move 'xxx' to wa_tab.</b>
the above code moves 'XXX' to the work area.
‎2006 Dec 08 11:55 AM
append is to send the data from field string to body.
Append syn: append [wa to] [initial line to] itab.
wa = work area
ex:
data: begin of itab occurs 0,
name(20) type c,
age type i,
end of itab.
itab-name = 'kishore'.
itab-age = 31.
append itab.
regards
kishore.