Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

add-corresponding

Former Member
0 Kudos

Hi guys,

how does add-corresponding works/

thanks a lot!

rgds,

mark

1 ACCEPTED SOLUTION

Former Member
0 Kudos

well add-corresponding is now obselete

still the use is like this

ADD-CORRESPONDING rec1 TO rec2.

Effect

Interprets rec1 and rec2 as field strings. If, for example, rec1 and rec2 are tables, executes the statement for their header lines.

Searches for all sub-fields which occur both in rec1 and rec2 and then, for all relevant field pairs corresponding to the sub-fields ni , generates statements of the form

ADD rec1-ni TO rec2-ni.

The other fields remain unchanged.

I suggest you shld use control break statements

Hope it helps

4 REPLIES 4

Former Member
0 Kudos

well add-corresponding is now obselete

still the use is like this

ADD-CORRESPONDING rec1 TO rec2.

Effect

Interprets rec1 and rec2 as field strings. If, for example, rec1 and rec2 are tables, executes the statement for their header lines.

Searches for all sub-fields which occur both in rec1 and rec2 and then, for all relevant field pairs corresponding to the sub-fields ni , generates statements of the form

ADD rec1-ni TO rec2-ni.

The other fields remain unchanged.

I suggest you shld use control break statements

Hope it helps

JozsefSzikszai
Active Contributor
0 Kudos

type in ADD-CORRESPONDING in SE38, click on it and press F1! you'll be surprised...

Former Member
0 Kudos

Hi Frd

Interprets rec1 and rec2 as field strings. If, for example, rec1 and rec2 are tables, executes the statement for their header lines.

Searches for all sub-fields which occur both in rec1 and rec2 and then, for all relevant field pairs corresponding to the sub-fields ni , generates statements of the form

ADD rec1-ni TO rec2-ni.

The other fields remain unchanged.

With complex structures, the complete names of the corresponding field

pairs must be textually identical.

Reward Me Points

By

Pari

Former Member
0 Kudos

Hi Mark!!

Avoid using this statement as its obsolete these days.

if u want to have syntax of any keyword,type that keyword in se38 and do F1,u will get details about the same with solved example to explain it.

ADD-CORRESPONDING

Syntax

ADD-CORRESPONDING struc1 TO struc2.

Effect

This statement, which is not allowed in classes, adds structures by component. You must specify structures for struc1 and struc2. All components of the same name in struc1 and struct2 are added in pairs and the result is assigned to the respective component of struct2.

The name comparison is executed in the same way as for the MOVE-CORRESPONDING statement. For each component pair with the same name comp, internally the statement

ADD struc1-comp TO struc2-comp.

is executed and, if necessary, the required conversions are performed.

Note

This statement is not allowed in classes. It is error-prone, because - especially in complex structures - it cannot be guaranteed in a simple manner that the components of the same name actually have the data types and contents required for a numeric operation.

Example

The components x and y exist in both structures and are added. After adding, the results are stored in struc2-x and struc2-y.

DATA: BEGIN OF struc1,

x TYPE i,

y TYPE i,

z TYPE i,

END OF struc1,

BEGIN OF struc2,

a TYPE i,

b TYPE i,

x TYPE p LENGTH 8 DECIMALS 0,

y TYPE p LENGTH 8 DECIMALS 0,

END OF struc2.

...

ADD-CORRESPONDING struc1 TO struc2.

Exceptions

Catchable Exceptions

CX_SY_ARITHMETIC_OVERFLOW

Cause: Overflow while adding, type I in the additions UNTIL or FROM ... TO

Runtime Error: ADDF_INT_OVERFLOW (catchable)

Cause: Overflow during arithmetic operation (type P)

Runtime Error: BCD_OVERFLOW (catchable)

Cause: Integer overflow while adding

Runtime Error: COMPUTE_INT_PLUS_OVERFLOW (catchable)

CX_SY_CONVERSION_OVERFLOW

Cause: Overflow during arithmetic operation (type P, with specified length)

Runtime Error: BCD_FIELD_OVERFLOW (catchable)

Non-Catchable Exceptions

Cause: Access to data outside the area specified in the RANGE addition

Runtime Error: ADD_FIELDS_NOT_IN_RANGE

Cause: Unallowed access to tables, strings, field or object references within the area specified in the RANGE addition.

Runtime Error: ADD_FIELDS_ILLEGAL_ACCESS

Cause: P field does not contain a correct BCD format

Runtime Error: BCD_BADDATA

reward points if helpful.

Edited by: Deepika Singh on Jun 6, 2008 9:44 AM