01-08-2008 6:42 AM
hi all,
i am uploading tab deli file from app server using
open dataset g_file for input in text mode encoding default.
do.
read dataset g_file into wa_string.
if sy-subrc <> 0.
exit.
endif.
split wa_string at '#' into wa_tribs-doc_date
wa_tribs-doc_type
wa_tribs-doc_no
wa_tribs-curr_code
wa_tribs-curr_rate
wa_tribs-ledger
wa_tribs-dr_cr
wa_tribs-ac_code
wa_tribs-ac_name
wa_tribs-sp_gl
wa_tribs-curr_amt
wa_tribs-curr_amt_lcl
wa_tribs-gross_up
wa_tribs-loc
wa_tribs-division
wa_tribs-reference
wa_tribs-ref_doc_typ
wa_tribs-ref_doc_no
wa_tribs-product
wa_tribs-sub_prod
wa_tribs-remarks
wa_tribs-ref_led
wa_tribs-ref_ac_code
wa_tribs-ref_ac_name
wa_tribs-ref_div_code
wa_tribs-user_name.
append wa_tribs to it_tribs.
enddo.
close dataset g_file.
wa_string is of 316 char lengh.
but the data is not going into the respective fields except 1st field wa_tribs-doc_date.
at split command sy-subrc set to 4
any solution for this one.
regards
Praveen
01-08-2008 7:15 AM
hi praveen,
first check that the string is g_file is seperated by '#' or not.
and u used that sy-subrc 0 exit. why u r using it, if it is 0 then it will process else u can use exit.
Also check that text file will have the same structure as ur internal table and write
split wa_string at '#' into wa_tribs-doc_date ........in byte/character mode.
i hope it may helpful,
regards
sirisha reddy
01-08-2008 7:01 AM
u r code is correct only
u just check whether the delimiter separator is correct or not
they ar using '#' or not u just check
Madhavi
01-08-2008 7:10 AM
01-08-2008 7:15 AM
hi praveen,
first check that the string is g_file is seperated by '#' or not.
and u used that sy-subrc 0 exit. why u r using it, if it is 0 then it will process else u can use exit.
Also check that text file will have the same structure as ur internal table and write
split wa_string at '#' into wa_tribs-doc_date ........in byte/character mode.
i hope it may helpful,
regards
sirisha reddy
01-08-2008 7:36 AM
Hi sirisha,
it is sy-subrc<> 0.
that is ok.
the file tab delimited, wa_string contains # in debugging so that i am splitting the string at #
i tried with in character mode
no result
thanks for ur reply
hope the needful
01-08-2008 9:01 AM
hi praveen,
Call this class and replace this l_tab at '#'.
DATA : l_tab(1) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
SPLIT wa_string AT l_tab INTO name1 name2 ......... IN CHARACTER MODE.
I think it may work.
regards,
sirisha reddy
01-08-2008 9:19 AM
Hi sirisha,
Thank you very much
problem is solved
Regards
praveen Reddy