2006 Dec 05 5:54 PM
Hi,
I have two internal tables it_acct and it_acct1 as below.
data: begin of it_acct occurs 0,
belnr like bkpf-belnr,
bldat like bkpf-bldat,
augcp like bseg-augcp,
vbeln like bseg-vbeln,
end of it_acct.
data: begin of it_acct1 occurs 0,
belnr like bkpf-belnr,
cpudt like bsad-cpudt,
vbeln like bseg-vbeln,
end of it_acct1.
select belnr cpudt vbeln into corresponding fields of table it_acct1
from bsad where cpudt in s_cpudt.
Now I want to move the data from it_acct1 to it_acct . I have no data in it_acct now.
i want to move it_acct1-belnr to it_acct-belnr,
move it_acct1-cpudt to it_acct-augcp,
move it_acct1-vbeln to it_acct-vbeln.
Can someone help me how to code to move the data from it_acct1 to it_acct.
Regards,
D
2006 Dec 05 6:00 PM
Hi,
Try this..
LOOP AT IT_ACCT1.
IT_ACCT-BELNR = IT_ACCT1-BELNR.
IT_ACCT-VBELN = IT_ACCT1-VBELN.
it_acct-augcp = it_acct1-cpudt.
APPEND IT_ACCT.
ENDLOOP.
Thanks,
Naren
Hi,
I have two internal tables it_acct and it_acct1 as below.
data: begin of it_acct occurs 0,
belnr like bkpf-belnr,
bldat like bkpf-bldat,
augcp like bseg-augcp,
vbeln like bseg-vbeln,
end of it_acct.
data: begin of it_acct1 occurs 0,
belnr like bkpf-belnr,
cpudt like bsad-cpudt,
vbeln like bseg-vbeln,
end of it_acct1.
select belnr cpudt vbeln into corresponding fields of table it_acct1
from bsad where cpudt in s_cpudt.
Now I want to move the data from it_acct1 to it_acct . I have no data in it_acct now.
i want to move it_acct1-belnr to it_acct-belnr,
move it_acct1-cpudt to it_acct-augcp,
move it_acct1-vbeln to it_acct-vbeln.
Can someone help me how to code to move the data from it_acct1 to it_acct.
Regards,
D
2006 Dec 05 6:00 PM
Hi,
Try this..
LOOP AT IT_ACCT1.
IT_ACCT-BELNR = IT_ACCT1-BELNR.
IT_ACCT-VBELN = IT_ACCT1-VBELN.
it_acct-augcp = it_acct1-cpudt.
APPEND IT_ACCT.
ENDLOOP.
Thanks,
Naren
2006 Dec 05 6:06 PM
Hi Dev Reddy,
Try with this code.
LOOP AT IT_ACCT1.
move it_acct1-belnr to it_acct-belnr.
move it_acct1-cpudt to it_acct-augcp.
move it_acct1-vbeln to it_acct-vbeln.
APPEND IT_ACCT.
ENDLOOP.
Thanks,
Vinay
2006 Dec 05 6:09 PM
Hi ,
Thanks Naren...it solved my problem!
Vinay, I already tried that and it didnt work.
it asks for index.
however thanks for replying.
Regards,
D
2006 Dec 05 6:13 PM
Hi Dev,
Just add an additional line in Naren's code to get proper results at any time.
LOOP AT IT_ACCT1.
IT_ACCT-BELNR = IT_ACCT1-BELNR.
IT_ACCT-VBELN = IT_ACCT1-VBELN.
it_acct-augcp = it_acct1-cpudt.
APPEND IT_ACCT.
<b>CLEAR IT_ACCT.</b>
ENDLOOP.
If you didnt include CLEAR statement, even if IT_ACCT1 doesnt have any values for all fields or few fields in the next record, it will take values of previous one and it may lead to improper results.So it is a good practise to have CLEAR statement after APPEND statement in LOOP...ENDLOOP.
Thanks,
Vinay
2006 Dec 06 6:28 AM
TRY THIS:
LOOP AT IT_ACCT1.
IT_ACCT-BELNR = IT_ACCT1-BELNR.
IT_ACCT-AUGCP = IT_ACCT1-CPUDT.
IT_ACCT-VBELN = IT_ACCT1-VBELN.
APPEND IT_ACCT1.
ENDLOOP.
bUT HERE THE SIZE AND TYPE OF THE VARIABLES AUGCP AND CPUDT SHULD BE SAME. OTHERWISE WONT ACCEPT.
THANX.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |