‎2007 May 31 1:54 PM
hi,
i have a flat file with different record types in the sense
first line will be a file header
second line will be a invoice header
third line will be a invoice item
fourth will be a Invoice Item Tax Lines
and at last there will be file trailer
under second line the third and fourt line may or may not repeat
but the thing is file we have different fields for the different lines
so my question is how can we catch that flat file in the internal table
means what are the fields to be declared
can anyone pls help me.
thanks and regards
‎2007 May 31 1:59 PM
Hi
You can simply use the TCODE
<b>CG3Z</b>
for copying the contensts of your local file to Application server.
Reward points if useful
Regards
Anji
‎2007 May 31 1:59 PM
Hi
You can simply use the TCODE
<b>CG3Z</b>
for copying the contensts of your local file to Application server.
Reward points if useful
Regards
Anji
‎2007 Jun 01 5:37 AM
HI ANJI,
thank you very much for giving such a wonderful suggestion and information.
i have sent a thread again if you can please help me out in that matter
thanks and regards,
md.ibrahim
‎2007 May 31 2:04 PM
HI,
first declare a structure and an internal table in the format you expect the file to contain data.
then use
where p_logic is the path of file from selection screen
w_nom = p_flogic.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
logical_filename = w_nom
parameter_1 = w_numlot1
IMPORTING
file_name = w_fichier
EXCEPTIONS
file_not_found = 1
OTHERS = 2.
Data: wa type tt_erreur,
len type i.
OPEN DATASET w_fichier FOR input IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC = 0.
do.
READ DATASET w_fichier INTO ws_file.
IF sy-SUBRC = 0.
APPEND ws_file TO wt_file.
else.
exit.
ENDIF.
enddo.
ENDIF.
CLOSE DATASET p_flogic.
‎2007 May 31 2:06 PM
Hi Ibrahim,
when i understand you right in your flat-file are several record-type.
insert in your flat-file an ident-field.
fill this for example with 1 for for header 2 for invoce etc.
upload the flat-file in an internal table with no structure.
loop at this table and check if the ident is 1 then put it an other table
for header, if 2 put it an the internaltable for invoice etc.
hope it helps.
Regards, Dieter