09-19-2007 2:15 AM
Experts!
Do you have any idea on how i can separate '#' from its right side character.
example::
<b>TEXT</b>
#SHINE (NO SPACE)
<b>TEXT</b>
SHINE (# ONE SPACE FROM SHINE)
Thanks!!!
09-19-2007 2:20 AM
You can make use of the SPLIT command.
See the F1 help of how to use it.
DATA : text(30) TYPE c.
DATA : text1(30) TYPE c,
text2(30) TYPE c.
text = '# String'.
SPLIT text AT '#' INTO text1 text2.
CONDENSE text2 NO-GAPS. " removes spaces
WRITE : text1, text2. " text2 gives you STRING
Regards
Gopi
09-19-2007 2:40 AM
Master ,
I think my question is not clear.
Again sir ,
My problem is I want to have one space from '#' character to its right side character.
I have a text field name description::
example::
description field::
color blue #house.
I want to achieve this::
color blue # house.
Did you see the difference?In the first text '#' house appears no space I want to have a space in between '#' character and in the right character like this '#' one space house.
Why I need to have this..
Because when I download the file in the excel the problem is every '#' found the right character after the '#' proceeds to the next line which is wrong so I want to have at least one space between '#' character and to its right side character to avoid this error..
I hope i made it clear..
Sorry for the inconvinience...
Many thanks..
Help me!!!
09-19-2007 2:59 AM
Please try this ...
data: begin of itab_data occurs 0 ,
matnr like mara-matnr,
maktx like makt-maktx,
cr type x value '0D', <-- add this line
end of itab_data.
start-of-selection.
itab_data-matnr = '0000000000000000098'.
itab_data-maktx = '1234567890'.
append itab_data.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\testddd.txt'
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = ' '
TRUNC_TRAILING_BLANKS = ' ' <-- set to space
TABLES
DATA_TAB = itab_data
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks
Seshu
09-19-2007 3:32 AM
Master ,
Kindly explain what is
WRITE_FIELD_SEPARATOR = ' '
TRUNC_TRAILING_BLANKS = ' '
I did follow your advise and it seems good. But I need to verify first what does these functions are for?? Before I transport in QAS.
Many thanks!!
09-19-2007 4:05 AM
Hi Salma,
try this code
data old type string value 'color blue#house'.
data new type string.
data pos like sy-fdpos.
search old for '#'.
if sy-subrc = 0.
pos = sy-fdpos + 1.
endif.
concatenate old(pos) old+pos into new separated by space.
write:/ new.
09-19-2007 4:28 AM
09-19-2007 4:38 AM
09-19-2007 4:41 AM
09-19-2007 4:57 AM
Hi Salma,
You are getting # this problem arise becasue of length problem look if you are using DAT format then also you have to maintain the length of a field, which is define in data dictionary, as you are using Excel to upload/download the it will take tab sapce(1 tab = 8 space) between the field, so to mark the end of one field to have to use some seperator which you mention as 'X' caps. try to put X in the call function hope it will resolve problem.
FILENAME = '<Drive:\><filename.etx>'
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
Reward if helpful!
Regards,
Mehfuze