06-12-2007 5:35 PM
Hi Guys,
I ahve to download data in a text file from SAP.The format must be ' | ' or pipe delimiter. So i am using SAP_to_convert_tex_format.But this is not working for BSEG table. So i am using concatenate for all the fields and seperated by ' | '.while conatenating i am getting syntax error for the result it_bseg1.That declare it_bseg1 as character type .i declared it_bseg1 as
data : it_bseg1(4096) type c occurs 0.
can any body tell me how to solve this one.
i wrote concatenate all fields................into it_bseg1 seperated by '|'.
Thanks,
Gopi.
06-12-2007 5:50 PM
Please try this example program.
report zrich_0001 .
data: ibseg type table of bseg.
data: xbseg like line of ibseg.
data: istr type table of string,
xstr type string.
data: xtmp type string.
field-symbols: <fs>.
select * into table ibseg from bseg
up to 100 rows.
loop at ibseg into xbseg.
do.
assign component sy-index of structure xbseg to <fs>.
if sy-subrc <> 0.
exit.
endif.
xtmp = <fs>.
if sy-index = 1.
xstr = xtmp.
else.
concatenate xstr xtmp into xstr separated by '|'.
endif.
enddo.
append xstr to istr.
endloop.
call method cl_gui_frontend_services=>gui_download
exporting
filename = 'c:test.txt'
changing
data_tab = istr.
Regards,
RIch Heilman
06-12-2007 5:49 PM
hi gopi anne,
define like this,
data: it_bseg1 type string.
try to avoid this.
data : it_bseg1(4096) type c occurs 0.
reward points if helpful,
regards,
seshu.
06-12-2007 5:49 PM
You'll probably want to convert you currency fields to character first.
Rob
06-12-2007 5:50 PM
Please try this example program.
report zrich_0001 .
data: ibseg type table of bseg.
data: xbseg like line of ibseg.
data: istr type table of string,
xstr type string.
data: xtmp type string.
field-symbols: <fs>.
select * into table ibseg from bseg
up to 100 rows.
loop at ibseg into xbseg.
do.
assign component sy-index of structure xbseg to <fs>.
if sy-subrc <> 0.
exit.
endif.
xtmp = <fs>.
if sy-index = 1.
xstr = xtmp.
else.
concatenate xstr xtmp into xstr separated by '|'.
endif.
enddo.
append xstr to istr.
endloop.
call method cl_gui_frontend_services=>gui_download
exporting
filename = 'c:test.txt'
changing
data_tab = istr.
Regards,
RIch Heilman