2006 Feb 15 3:38 PM
Hi Experts,
in a progrm,it will get the data form a file. in that file the fields are like this:
<b>name1 name2 altkn bukrs ekorg ktokk stras pfach ort01 .....</b>
and then i'm adding some more data to that and i'll have to output that data into another file.
the output file data should be like this:
<b>mandt usnam tcode lifnr bukrs ekorg ktokk anred name1 name2 name3 name4 sortl stras pfach ort01 pstlz land1 .....</b>
for that i have created two internal tables like this:
1st itab:
<b>begin of t_Data occurs 0,
name1 like lfa1-name1,
name2 like lfa1-name2,
altkn like lfb1-altkn,
bukrs like lfb1-bukrs,
ekorg like lfm1-ekorg,
ktokk like lfa1-ktokk,
stras like lfa1-stras,
pfach like lfa1-pfach,
ort01 like lfa1-ort01,
regio like lfa1-regio,
.......................
.......................
end of t_Data.</b>
2nd itab:
<b>data: begin of t_file occurs 0,
mandt like bgr00-mandt,
usnam like bgr00-usnam,
tcode like blf00-tcode,
lifnr like blf00-lifnr,
bukrs like blf00-bukrs,
ekorg like blf00-ekorg,
ktokk like blf00-ktokk,
anred like blfa1-anred,
name1 like blfa1-name1,
name2 like blfa1-name2,
name3 like blfa1-name3,
name4 like blfa1-name4,
sortl like blfa1-sortl,
stras like blfa1-stras,
pfach like blfa1-pfach,
ort01 like blfa1-ort01,
pstlz like blfa1-pstlz,
ort02 like blfa1-ort02,
pstl2 like blfa1-pstl2,
land1 like blfa1-land1,
regio like blfa1-regio,
spras like blfa1-spras,
.......................
.......................
end of t_file.</b>
the order of the fields are diffrent in the 2 files.
to out the data in that prescribed format(the order in the output file) how can i accomplish that?
please let me know.
thanx much,
Hi Experts,
in a progrm,it will get the data form a file. in that file the fields are like this:
<b>name1 name2 altkn bukrs ekorg ktokk stras pfach ort01 .....</b>
and then i'm adding some more data to that and i'll have to output that data into another file.
the output file data should be like this:
<b>mandt usnam tcode lifnr bukrs ekorg ktokk anred name1 name2 name3 name4 sortl stras pfach ort01 pstlz land1 .....</b>
for that i have created two internal tables like this:
1st itab:
<b>begin of t_Data occurs 0,
name1 like lfa1-name1,
name2 like lfa1-name2,
altkn like lfb1-altkn,
bukrs like lfb1-bukrs,
ekorg like lfm1-ekorg,
ktokk like lfa1-ktokk,
stras like lfa1-stras,
pfach like lfa1-pfach,
ort01 like lfa1-ort01,
regio like lfa1-regio,
.......................
.......................
end of t_Data.</b>
2nd itab:
<b>data: begin of t_file occurs 0,
mandt like bgr00-mandt,
usnam like bgr00-usnam,
tcode like blf00-tcode,
lifnr like blf00-lifnr,
bukrs like blf00-bukrs,
ekorg like blf00-ekorg,
ktokk like blf00-ktokk,
anred like blfa1-anred,
name1 like blfa1-name1,
name2 like blfa1-name2,
name3 like blfa1-name3,
name4 like blfa1-name4,
sortl like blfa1-sortl,
stras like blfa1-stras,
pfach like blfa1-pfach,
ort01 like blfa1-ort01,
pstlz like blfa1-pstlz,
ort02 like blfa1-ort02,
pstl2 like blfa1-pstl2,
land1 like blfa1-land1,
regio like blfa1-regio,
spras like blfa1-spras,
.......................
.......................
end of t_file.</b>
the order of the fields are diffrent in the 2 files.
to out the data in that prescribed format(the order in the output file) how can i accomplish that?
please let me know.
thanx much,
2006 Feb 15 3:44 PM
Hi Dev,
You can use like below..
MOVE CORRESPONDING T_DATA TO T_FILE.
after that update the t_file with the rest of the data & use MODIFY statement.
or you could use.
LOOP AT T_DATA.
MOVE T_DATA-NAME1 TO T_FILE-NAME1.
..............
.............
..........
T_FILE-USNAME = 'XXX'.
APPEND T_FILE.
CLEAR T_FILE.
ENDLOOP.
Message was edited by: Phani Kiran Nudurupati
2006 Feb 15 3:46 PM
Hi,
In order to get that U need to
Loop at 1st itab.
Use move corresponding fields into output table
fill other fields in the output table
append output table
endloop.
Regards,
GSR
2006 Feb 15 4:22 PM
2006 Feb 16 4:39 AM
Hi
To get the required output:
loop at first internal table,
use move corresponding fields...and move all the required fields from first internal table to the output table and then add other fields to the output table.
Then you will get the output in the required format.
Thanks
Swathi
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |