‎2006 Nov 14 10:18 AM
hi all..
I have got a requirement. I am having an internal table which has records
AAAA CCCC DDDD. Now the requirement is i need to write records from the internal table to presentation server or application server depending upon users selection. Now my issue is they want the file to be in format
AAAA CCCCDDDD. it means they need a space only between first and second record and second and third should be continous. Can you tell me how can i do it for presentation server?
i knw i can put space or some other delimiter between all records.
Also if possible please help me with the logic on application server to do the same format.
thanks in advance
‎2006 Nov 14 10:22 AM
Reena,
try with concatenating fields into long length IT and download.
o.w. insert some field in 1st and 2nd fields with value ' ' and download directly...
-Anu.
Message was edited by:
Anupama Reddy
‎2006 Nov 14 10:22 AM
hi ,
parameters: p_file like rlgrap-filename obligatory
default '/usr/sap/upload.xls'.
types: begin of t_data,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
werks like vbap-werks,
megne like vbap-zmeng,
end of t_data.
data: it_data type standard table of t_data,
wa_data type t_data.
open dataset p_file for output in text mode encoding default.
if sy-subrc ne 0.
write:/ 'Unable to open file:', p_file.
else.
loop at it_data to wa_data.
transfer wa_data to p_file.
endloop.
endif.
close dataset p_file.
endif.rgds
anver
if hlepd pls markl points
‎2006 Nov 14 10:22 AM
Reena,
try with concatenating fields into long length IT and download.
o.w. insert some field in 1st and 2nd fields with value ' ' and download directly...
-Anu.
Message was edited by:
Anupama Reddy
‎2006 Nov 14 11:08 AM
Hi Reena ,
well u concatenate the second and the third record and put that concatenated record and the first record in an separate internal table .
for downloading the record u can use the function module GUI_DOWNLOAD to dat from the internal table to PC with your required format.
‎2006 Nov 14 11:41 AM
Hi
If you want to upload/download to Application server use
DATASET or INDX table for the same.
This will be helpful when the program is running in background.
Then download the file from application server to presentation server using function modules.
Regards,
Baburaj
‎2006 Nov 14 11:55 AM
Reena,
By record do you mean the columns of the internal table ??
If that is the case you can do the below.
OPEN DATASET l_file FOR OUTPUT IN LEGACY TEXT MODE.
Loop at it_output into is_output.
Clear lstr.
DO.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE is_output TO <F>.
IF SY-SUBRC <> 0. EXIT.
ELSE.
if sy-index = 1.
concatenate <F> '*' into lstr.
else.
concatenate lstr <F> into lstr.
endif.
ENDIF.
ENDDO.
translate lstr using '* '.
TRANSFER lstr TO l_file LENGTH 1024.
Append lstr to itab-line.
endloop.
*--> Close the opened file on server
CLOSE DATASET l_file.
Later download the file using GUI_DOWNLOAD and table itab.