04-15-2008 2:15 PM
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
04-15-2008 2:27 PM
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
04-15-2008 2:17 PM
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.
04-15-2008 2:19 PM
Move-corresponding will only look for the corresponding
fields in both internal tables ..
No need that t_card & t_cash have the same structure ...
04-15-2008 2:20 PM
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..
04-15-2008 2:22 PM
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
04-15-2008 2:24 PM
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
04-15-2008 2:27 PM
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
04-15-2008 2:27 PM
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
04-15-2008 2:35 PM
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.
04-15-2008 2:39 PM
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.
04-15-2008 2:43 PM
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
04-16-2008 5:29 AM
Hi,
No need to use that t_card & t_cash have the same structure ...
Regards,
Muneesh Gitta.