2008 Jul 18 1:02 PM
Hi,
I have created a tab delimited file in presentation server and I have transported it to application server,but in application server '#' is coming in place of tab,therefore I can't upload the file.
So, can anybody tell the detail code to remove the # from file in apllication server urgently.
Thanx and Regards
Ajay
2008 Jul 18 1:06 PM
Hi,
It should not be a problem. Please explain in details what exactly you want to do.
Regards,
Pankaj
2008 Jul 18 1:08 PM
Hii!
I think you have opened the file on application server by using TEXT MODE.
Use BINARY MODE to open file on application server.
Regards
Abhijeet
2008 Jul 18 1:09 PM
where are you viewing the file to determine that it is in fact a #?
when viewing it during debug, any non printable value would show as a #.
How are you reading the file?
Because it is coming from the Application server, you should be using OPEN DATASET, READ DATASET etc. You can read the entire line into one field defined larger then the field will ever be, and then use SPLIT to break it into your final destination fields.
Something like this.
*_________________________________________________ Constants
CONSTANTS:
c_tab TYPE x VALUE '09'.
*
*
*
FORM retrieve_file.
CLEAR t_error.
OPEN DATASET zfile IN TEXT MODE MESSAGE t_mesg.
IF sy-subrc NE 0.
MOVE 'X' TO t_error.
MESSAGE e100(z0) WITH 'Error opening file:' t_mesg.
EXIT.
ENDIF.
DO.
READ DATASET zfile INTO wk_rec.
IF sy-subrc NE 0.
EXIT.
ENDIF.
SPLIT wk_rec AT c_tab
INTO in_rec-recnum
in_rec-leadid
in_rec-ltype
in_rec-ltype_txt
in_rec-status
in_rec-status_txt
in_rec-statdt
in_rec-branch
in_rec-brtextextd
in_rec-fname
in_rec-mname
in_rec-lname
in_rec-street
in_rec-city
in_rec-state
in_rec-zip
in_rec-telf1
in_rec-telf2
in_rec-telf3
in_rec-telf3_ext
in_rec-email
in_rec-updhotcold
in_rec-hotcold_old
in_rec-hotcold
in_rec-hotcold_txt
in_rec-prefcont
in_rec-prefcont_txt
in_rec-ctype
in_rec-ctype_txt
in_rec-heard
in_rec-heard_txt
in_rec-heard_other_text
in_rec-email_promo
in_rec-email_promo_txt
in_rec-creside
in_rec-creside_txt
in_rec-zown
in_rec-zown_txt
in_rec-bld_tm
in_rec-bld_tm_txt
in_rec-ownland
in_rec-ownland_txt
in_rec-spnum
in_rec-create_date
in_rec-cmt1
in_rec-statseq
in_rec-actseq
in_rec-acttyp
in_rec-acttyp_txt
in_rec-actrst
in_rec-actrst_txt
in_rec-acmt
in_rec-adate
in_rec-folseq
in_rec-foltyp
in_rec-foltyp_txt
in_rec-fcmt
in_rec-fdate
in_rec-custreffer
in_rec-custreffer_old
in_rec-openhousesponser
in_rec-openhousesponser_old.
APPEND in_rec TO it_input.
ENDDO.
CLOSE DATASET zfile.
ENDFORM. " retrieve_file
2008 Jul 18 1:17 PM
That # is nothing but a TAB.
use the Horizontal tab of the utlities class.
CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
SPLIT record AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
INTO table or fields.
or else use REPLACE
REPLACE ALL OCCURENCES OF CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
in record with ''.
2008 Jul 19 10:36 AM
Hi,
I have used this concept but my internal table in which the data to be upladed from file in application server contain currency fields.So, it's showing syntax error for these fields and saying it should be of type c,n,d,,t or x.
Can u please tell me how to handle it.
2008 Jul 19 10:18 PM
Hi,
I had this problem a while ago. If you look at the file (e.g. TC AL11) you see a '#' on the screen. But depending on where you created your file (e.g. windows / linux) and how you uploaded your file to the application server ( ascii / binary) the SPLIT seems in the one case not interpreting the TAB as it should.
Therefore you could also try to transfer the file differently, instead of trying to solve the problem programmatically...
Regards,
Nico
2008 Jul 18 1:19 PM
Hi,
1) Declare the Tab as in constants stmt
CONSTANTS: stmt TYPE x VALUE 09
2) Take each record(contains all the data with tabs) into one string and Split the string into the internal table fields.
SPLIT l_tmpstr AT stmt
INTO it_p0000-infty
it_p0000-subty
it_p0000-pernr
it_p0000-begda
it_p0000-endda
it_p0000-massn
it_p0000-massg
it_p0000-werks
it_p0000-persg
it_p0000-persk
it_p0000-aedtm.
append it_p0000.
if helpful pls reward points.
Thanks & Regards,
Bhupal.
2008 Jul 18 2:20 PM
Hi,
1) Declare the Tab as in constants stmt
CONSTANTS: stmt TYPE x VALUE 09
2) Take each record(contains all the data with tabs) into one string and Split the string into the internal table fields.
SPLIT l_tmpstr AT stmt
INTO it_p0000-infty
it_p0000-subty
it_p0000-pernr
it_p0000-begda
it_p0000-endda
it_p0000-massn
it_p0000-massg
it_p0000-werks
it_p0000-persg
it_p0000-persk
it_p0000-aedtm.
append it_p0000.
Hi,
1.What should be the data type of i_tmpstr and it_p0000 .
2.stmt should be of type x or string.
2008 Jul 18 2:34 PM
Hi,
If u r uploading data from presentation server to application server, tabs and enter functionalities will be treated as hexadecimal character (09 or 0D).
For this we should open dataset in ASCII mode. Try this and u can not find # in your file.
Regards,
Subbu
2008 Jul 18 3:04 PM
Hi,
Use this FM DX_FILE_READ for read the file from application server to ITAB of the program.
FILENAME = Application server file pat name
SERVER = sever name "f More than one application server.
Fm - PC = Y.
Loop the itab.
REPLACE ALL OCCURRENCES OF '#' IN:
itab WITH ' ' .
endloop.
Use this FM to delete file from application server
DX_FILE_DELETE
After Delete Again Create file to application server or Download to presentation server.
Create file to application server ---> Use FM DX_FILE_WRITE
Download to presentation server --> Use FM GUI_DOWNLOAD.
Thanks,
Durai.V
2008 Jul 19 10:01 AM
Hi,
Thank you for the helpful answer.Can u please tell me from where shall i get the application server name and also paramter 'PC' should be 'X' or ' '.
Thanks and Regards
Ajay
2008 Jul 21 6:50 AM
Hi,
If PC = 'X' means --> upload the file from presentation server
Else Space or Others Read teh file from application server.
If u want application server name Goto SM51 t-code there u
can find the all application server names.
OR In any SAP Access click System->Status> Here u can find the server name( Host Data - Seccion).
Reward if usefull.
Thanks,
Durai.V