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: 

Move and Move-corresponding

Former Member
0 Kudos

Hello Friends,

THis is regarding to Upgrade to ECC 6.0.

first Question.

I am a bit confused as how the move and move corresponding statements would work in ECC - 6.0.


data: begin of t_cash,      "cash transactions
         D1(08),    "Post Date
         D2(40),    "Employee Name
         *D3(40),*    "Employee Vendor Id
       end of t_cash.
data: begin of t_card,      "card transactions
         D1(08),    "Post Date
         D2(40),    "Employee Name
         *D4(25),*    "Merchant Name
       end of t_card.

Now on the above internal tables I have the below statement.

move-corresponding t_card to t_cash.

The above statement is Valid in 4.7 and below but is the above statement Valid in Ecc 6.0.

I have heard that both should have the same structure when we use a move-corresponding statement.

PLs let me know if you have any ideas.

Second Question.

for the above declaration can I use a move statement instead of move-corresponding in 4.7 and similarly in 6.0.

Any Suggestions,

THanks,

Ster

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

- Move: transfer the data from a structure to another one in according to the length of original structure;

- Move-corresponding: transfer the data from a structure to another one in according to the name of the fields, so in your case:

data: begin of t_cash,      "cash transactions
         D1(08),    "Post Date
         D2(40),    "Employee Name
         *D3(40),*    "Employee Vendor Id
       end of t_cash.
data: begin of t_card,      "card transactions
         D1(08),    "Post Date
         D2(40),    "Employee Name
         *D4(25),*    "Merchant Name
       end of t_card.

If you use MOVE, u shoudl consider T_CARD is shorter than T_CASH: the last field D4 is long 25 CHAR, but the last field D3 is long 40 char. So u'll loose the last 15 digit of T_CASH

MOVE T_CASH TO T_CARD.

is like

T_CARD = T_CASH(73).

If you use MOVE-CORRESPONDING, u'll transfer only the information of the field D1 and D2:

MOVE-CORRESPONDING T_CASH TO T_CARD.

is like

T_CARD-D1 = T_CASH-D1.
T_CARD-D2 = T_CASH-D2.

Now the problem is ECC 6.00 is unicode release, so the statament MOVE-CORRESPONDING can't be used if the original and destination variable have a different structure.

Max

11 REPLIES 11

Former Member
0 Kudos

Same structure is not required. MOVE-CORRESPONDING will move ONLY fields names that are named exactly the same.

I wouldn't think they'd change the function of this verb from one version to the next.

Former Member
0 Kudos

Move-corresponding will only look for the corresponding

fields in both internal tables ..

No need that t_card & t_cash have the same structure ...

Former Member
0 Kudos

hi,

move is used when the target structure and source structure have same fields with same names...

move corresponding in when u use different structures and movin some particular fields which are same

regards,

priya..

Former Member
0 Kudos

Hi,

move statement is used when both of the tables have same structure. But move corresponding can be useful if they are different structures. In your case fields are differnt so you have to use move corresponding only.

Thanks

Sarada

Former Member
0 Kudos

Hi,

You can MOVE instead of MOVE-CORRESPONDING.

Because MOVE is for Similar structures and

MOVE-CORREPSONDING is for non-similar structures.

Reward,if useful.

Thanks,

Chandu

Former Member
0 Kudos

In upgrade

ex :

data : ls_p1005 like p1005,

data : lt_wplog like wplog

lt_wplog = ls_p1005.

If the structures are not similar then this is prone error in UCCHECK.

MOVE source_field to Target –field .

Or

Here MOVE-CORRESPONDING works out only if field names are same in both structure.

Correct code .

a>

Move ls_p1005-f1 to lt_wplog-f1.

Move ls_p1005-f2 to lt_wplog-f2.

………………………………….

Move ls_p1005-fn to lt_wplog-fn.

Even if fields names in both structures are different.

b.>

MOVE-CORRESPONDING ls_p1005 to lt_wplog only when both field names are same.

data : ls_p1005 like p1005,

data : lt_wplog like wplog

lt_wplog = ls_p1005.

If the structures are not similar then this is prone error in UCCHECK.

MOVE source_field to Target –field .

Or

Here MOVE-CORRESPONDING works out only if field names are same in both structure.

Correct code .

a>

Move ls_p1005-f1 to lt_wplog-f1.

Move ls_p1005-f2 to lt_wplog-f2.

………………………………….

Move ls_p1005-fn to lt_wplog-fn.

Even if fields names in both structures are different.

b.>

MOVE-CORRESPONDING ls_p1005 to lt_wplog only when both field names are same. .

For ur scenario you can use Move-corresponding.

Vijay

Former Member
0 Kudos

Hi

- Move: transfer the data from a structure to another one in according to the length of original structure;

- Move-corresponding: transfer the data from a structure to another one in according to the name of the fields, so in your case:

data: begin of t_cash,      "cash transactions
         D1(08),    "Post Date
         D2(40),    "Employee Name
         *D3(40),*    "Employee Vendor Id
       end of t_cash.
data: begin of t_card,      "card transactions
         D1(08),    "Post Date
         D2(40),    "Employee Name
         *D4(25),*    "Merchant Name
       end of t_card.

If you use MOVE, u shoudl consider T_CARD is shorter than T_CASH: the last field D4 is long 25 CHAR, but the last field D3 is long 40 char. So u'll loose the last 15 digit of T_CASH

MOVE T_CASH TO T_CARD.

is like

T_CARD = T_CASH(73).

If you use MOVE-CORRESPONDING, u'll transfer only the information of the field D1 and D2:

MOVE-CORRESPONDING T_CASH TO T_CARD.

is like

T_CARD-D1 = T_CASH-D1.
T_CARD-D2 = T_CASH-D2.

Now the problem is ECC 6.00 is unicode release, so the statament MOVE-CORRESPONDING can't be used if the original and destination variable have a different structure.

Max

Former Member
0 Kudos

Hi,

I have written a test program to see if it works.

the move-corresponding fails in ECC 6.0


REPORT  z_test.

TABLES : vbak.

DATA : t_vbak LIKE vbak OCCURS 0 WITH HEADER LINE.

DATA : BEGIN OF it_vbak OCCURS 0,
        vbeln LIKE vbak-vbeln,
        erdat LIKE vbak-erdat,
        erzet LIKE vbak-erzet,
        ernam LIKE vbak-ernam,
        angdt LIKE vbak-angdt,
       END OF it_vbak.

START-OF-SELECTION.


  SELECT * FROM vbak INTO TABLE t_vbak UP TO 10 ROWS.

  move-corresponding t_vbak to it_vbak.


  WRITE : it_vbak.

in the above program t_vbak had data however after the move-corresponding statement I dont see any data in it_vbak.

0 Kudos

write as :

START-OF-SELECTION.

SELECT * FROM vbak INTO TABLE t_vbak UP TO 10 ROWS.

Loop at t_vbak.

move-corresponding t_vbak to it_vbak.

append it_vbak.

endloop.

Loop at it_vbak.

WRITE : it_vbak.

endloop.

0 Kudos

Hi,

You are missing the "loop at t_vbak" statement around the move-corresponding and write statements. Without a loop, t_vbak will contain just the header line data which, in this case, would be empty outside the loop.

Regards,

Jamie

Former Member
0 Kudos

Hi,

No need to use that t_card & t_cash have the same structure ...

Regards,

Muneesh Gitta.