10-11-2008 1:02 AM
Hi Experts,
hi friends, am generating Flat file for that i want to add Header and Footer,this i want 2 place in application server, how to add any clue pls..
my file should be...
it contains all ICNUM from HR table.. my file foamate willbe..
<Header>
<data>
<Footer>
ex:
< Report Name>
S2334459I
S8473944Z
S7613048G
<Date:Time:no of records>
how to add Header & Footer to this file....any logic pls
thanks in Advance,
sudeer.
10-11-2008 1:39 AM
use open dataset and get data from app server file into Internal table
use append header to itab index 1. " to add header to internal table
use just append footer to itab. " for footer.
write the file to the same path back again. and check for sy-subrc to 0.
10-11-2008 1:39 AM
use open dataset and get data from app server file into Internal table
use append header to itab index 1. " to add header to internal table
use just append footer to itab. " for footer.
write the file to the same path back again. and check for sy-subrc to 0.
10-11-2008 1:57 AM
Hi Jay,
thank for ur replay,,
as u told is ok for header.
how to add footer for that...
i ve an idia just let me know its ok r not.
suppose in my flat file i ve 10 records,
get the no of records into Count.
for header i can do like
APPEND header TO itab INDEX 1.
For footer: can i do like
v1= count + 1.
APPEND footer TO itab INDEX v1.
is it ok or not..
Thanks ,
sudeer.
10-11-2008 3:34 AM
do it this way.
INSERT HEADER INTO ITAB INDEX 1. " This is your header.
APPEND FOOTER TO ITAB. " This is your Footer
10-11-2008 3:57 PM
10-11-2008 4:18 PM
Hi sudeer,
ok, let us assume your data is in itab. and suppose it contains 10 records...
so if u want to add an header, just do like
DATA: count TYPE i,
lines TYPE i,
footer(15) TYPE c VALUE ' abapabapabap'.
DESCRIBE itab LINES count. " it gives no of records of itab now count = 10
data: header(10) type c VALUES 'ABCDEFGHIJ'. then,
INSERT header INTO itab INDEX 1.
now ur itab contains 11 records i.e including header(10+1).
For Footer, create one more var like..
lines = count + 2.
INSERT footer INTO itab INDEX lines. " footer will insert at 12th row.
<removed_by_moderator>
sudharsan.
Edited by: Julius Bussche on Oct 11, 2008 7:57 PM