09-26-2006 8:40 AM
hi all,
good day,
can any one tell me,
what append corresponding fields of table does?
thanks,
kcc
09-26-2006 8:43 AM
if the fields are same then it will append those fields only
append corresponding fields of itab1 to itab2.
suppose say itab1 has matnr and maktx fields and
itab1 has matnr and vbeln.
the above append statement will append only matnr field as the fielnames are same in both tables
09-26-2006 8:43 AM
if the fields are same then it will append those fields only
append corresponding fields of itab1 to itab2.
suppose say itab1 has matnr and maktx fields and
itab1 has matnr and vbeln.
the above append statement will append only matnr field as the fielnames are same in both tables
09-26-2006 8:46 AM
Append line to Table .
1st search the corresponding field in table and than append this field of table with ur internal table same field value.
performance wise it is not advisable becoz it 1st search for same field in table..
advisable it use into table only for this just arrenge fields in interal table in same manner as u declare it in table.
09-26-2006 8:51 AM
hi chandra,
as you told,
there are no two itabs,itab1,itab2,
there is only itab1,
now,what will it do?
regards,
kcc
09-26-2006 10:20 AM
hi kishan,
thanks for your response,
SELECT budat hkont belnr shkzg wrbtr FROM bsis
INTO CORRESPONDING FIELDS OF TABLE it_temp
WHERE hkont = w_glacct "wa_cb-gl_account
AND bukrs IN (so_bukrs-low)
AND budat < so_date-low.
SELECT budat hkont belnr shkzg wrbtr FROM bsas
APPENDING CORRESPONDING FIELDS OF TABLE it_temp
WHERE hkont = w_glacct "wa_cb-gl_account
AND bukrs IN (so_bukrs-low)
AND budat < so_date-low.
please,check it out,
regards,
kcc
09-26-2006 10:42 AM
change the one in bold
SELECT budat hkont belnr shkzg wrbtr FROM bsis
INTO CORRESPONDING FIELDS OF TABLE it_temp
WHERE hkont = w_glacct "wa_cb-gl_account
<b>AND bukrs IN so_bukrs</b>
AND budat < so_date-low.
SELECT budat hkont belnr shkzg wrbtr FROM bsas
APPENDING CORRESPONDING FIELDS OF TABLE it_temp
WHERE hkont = w_glacct "wa_cb-gl_account
<b>AND bukrs IN so_bukrs</b>
AND budat < so_date-low.
09-26-2006 8:53 AM
hi,
firstly a basic knowledge.
never use CORRESPONDING .
it will result in low performance.
fetch only the records u want from from data base.
create the internal table in the same order.
then use <b>INTO TABLE</b>
<b>INTO CORRSEPONING</b> will serch for the field names in the internal table, and will insert.
so evn if the internal structure is in differnt order,it will work. but it will rslt in low performace.
rgds
anver
if hlped mark points
09-26-2006 8:59 AM
can you show ur complete code or part of the code where append statement is used
09-26-2006 10:06 AM
hi chandra,
SELECT budat hkont belnr shkzg wrbtr FROM bsas
APPENDING CORRESPONDING FIELDS OF TABLE it_temp WHERE hkont = w_glacct "wa_cb-gl_account
AND bukrs IN (so_bukrs-low)
AND budat < so_date-low.
thanks,
kcc
09-26-2006 10:07 AM
SELECT budat hkont belnr shkzg wrbtr FROM bsas
into CORRESPONDING FIELDS OF TABLE it_temp WHERE hkont = w_glacct "wa_cb-gl_account
AND bukrs IN (so_bukrs-low)
AND budat < so_date-low.
<b>when u use into table there is no need for use append statement.</b>
09-26-2006 10:11 AM
Hi,
your it_temp may contain additional fields other than that u had mentioned in select(i.e budat hkont belnr shkzg wrbtr)
so if we use corresponding , the internal table will be populated only with the fields whose names are same as mentioned in select
say ur it_temp has only budat hkont belnr , so only these 3 fields will be appended to it_temp
09-26-2006 10:20 AM
hi,
APPENDING CORRESPONDING FIELDS OF TABLE itab
Effect
Works like ... INTO CORRESPONDING FIELDS OF TABLE itab, except that the read lines are appended to the old contents of the internal table itab.
Effect
Works as with ... INTO TABLE itab.
If cursor processing is introduced with OPEN CURSOR , the sequence of FETCH statements may contain different INTO clauses - within a strict context. The following rules apply:
Variants 1, 4 and 6 can be combined with each other if the types of the target areas wa or the line types of the internal tables itab are identical.
Variants 2, 5 and 7 can be combined with each other if the types of the target areas wa or the line types of the internal tables itab are identical.
Variant 3 cannot be combined with any other variant.
Whether it is better to read data into an internal table or into a work area, depends on the type of further processing: if the data is needed only once in a program, you should read it line by line into a work area using a SELECT-ENDSELECT loop. Reading the data into an internal table requires more storage and the processing speed is not increased considerably. If the data is needed more than once in a program, however, you should read it into an internal table. The disadvantage of the increased storage requirements is made up for by the advantage of a single selection.
If the data is to be read into an internal table it is more cost-effective to read it in one single operation than to read it line by line into a work area and then appending it to the internal table using APPEND.
The variants ... INTO CORRESPONDING FIELDS OF wa, ... INTO CORRESPONDING FIELDS OF TABLE itab, and ... APPENDING CORRESPONDING FIELDS OF TABLE itab require a slightly increased runtime - which is, however, independent of the size of the solution set - as compared with the corresponding variants without CORRESPONDING FIELDS
Regards,
Laxmi.