‎2008 Jul 03 3:21 PM
How to separate the header data from the item data while reading the file from application server to internal table.
‎2008 Jul 03 3:30 PM
Hi,
Make the fields lengths so as to fit the both header and item values.
For each field the length should be maximum of header length and item value length should be taken.Note: These should be character types.
If take like that the first record will give the the header info.
This way you can do it.
Regards,
rama.
‎2008 Jul 03 3:34 PM
Hi Chaitra,
Can u be more clear on the format of data ur file contains?
eg: If u have data like below then do like this to seperate the header and item data.
H1,H2,H3,H4,I11,I12,I13,I14,I15,I21,I12,I23,I24,I25.
H1..H5 =>Header data.
I11...I15=>Item1 data
I21...I25=>Item2 data.
READ DATA SET file INTO l_string.
SPLIT l_string at ',' INTO wa_header-h1 wa_header-h2
wa_header-h3 wa_header-h4 wa_header-h5 l_item.
APPEND wa_header TI i_header.
DO.
IF NOT l_item IS INITIAL.
SPLIT l_item INTO wa_item-f1 wa_item-f2 wa_item-f3 wa_item-f4 wa_item-f5 l_item.
APPEND wa_item TO i_item.
ELSE.
EXIT.
ENDIF.
ENDDO.
l_string, i_item are variables of string type.
Thanks,
Vinod.