11-21-2009 8:04 PM
Hello Expeters,
I want to delete the right space from field.
I am writing the fields to output file.
i am able remove left space by shift c dealiting left trailing space...
but i am not able to deltete right space using shift c deletiing right trailing space...
i searched in sdn , but most of suggestion is same..
we have any other statement where we can delete right leading space.
Thanks in advance.
Regards,
Sai
11-21-2009 8:08 PM
Hi,
probably you are using char variable and there is not possible to delete spaces on right side. Move your content into string variable and then use this string variable (spaces at right are automatically deleted)
Regards,
Karol
P.S.: Don't forget to close your question when it is answered! All your questions are still open. It can happens that next time will nobody answer you because of that ...
Edited by: Karol Seman on Nov 21, 2009 9:11 PM
11-21-2009 11:33 PM
thanks for your reply.
i tried to remove space by moving string...
it is not working for string also.
11-22-2009 1:08 AM
Hi
Try using CONDENSE to your variable.
CONDENSE l_var
Where, l_var is the variable having the value t be condensed. But be sure that you use CONDENSE just before printing it to the user as output. If you use it again foe calculatios, it will again have the trailing spaces.
Regards
Gaurav
11-22-2009 10:16 AM
No i tried to use condense but it remove left space and create space on right..
i used shift delete left/right leading /trailing space.... i want to remove total space......
we have any function module or any statement where we can delete total space.
Thanks in advace.
Best regards,
Zubera
11-22-2009 11:39 AM
HI
Try like this
data:w_string type string.
Concatenate field1 field2 into w_string separated by space.
condense w_string.
transfer w_string to ....
11-22-2009 11:45 AM
Hi Sai,
put your code here, otherwise nobody will help you. Be sure that putting char into string will remove spaces from right (all spaces which are at end of the string are automatically cutted). Therefor your code must be incorrect, my proposal works!!
try to create a simple solution:
data: l_char(30) type c.
data: l_string type string.
l_char = 'test'.
l_string = l_char.
write: / l_char, l_char.
write: / l_string, l_string.
In first line of the output you have "test" then 27 spaces and again "test", in second line you have as output "test", one space and again "test".
Regards,
Karol
11-22-2009 2:08 PM
Thanks for your reply.
my problem is that i am moviving data from final output table to file output table.
gt_data-maktx(28) type c,
gt_data-prodgroup(2),
eoutput_data-maktx(28) type c,
del(1) type c,
e_data-prodgroup(2),
del(2) type c.
concatenate '"' gt_data-maktx '"' into eoutput_data-maktx.
move : ; to del1.
concatenate '"' gt_data-pordgropu '"' into eoutput_data-prodgroup.
move: ; to del2.
condense eoutput_data.
output displaying
" KH 255/55 R16 V04L KW12 " ;
" KH 195/65 R15 T04L KW17 U ";
second record displaying corecty. but in first record space between double qoute and delimeter.
i want to know how to remove this space....
Thanks
11-22-2009 5:18 PM
Hi,
I think your code is not very clear about the problem, test with the following sample code may it will help you to solve out your problem.
TYPES: BEGIN OF ty_data,
maktx(28) TYPE c,
eoutput_data(30) TYPE c,
END OF ty_data.
DATA: it_data TYPE STANDARD TABLE OF ty_data WITH HEADER LINE.
it_data-maktx = 'KH 255/55 R16 V04L KW12'. APPEND it_data.
it_data-maktx = 'KH 195/65 R15 T04L KW17 U'. APPEND it_data.
LOOP AT it_data.
CONDENSE: it_data-maktx.
CONCATENATE: '''' it_data-maktx '''' ';' INTO it_data-eoutput_data.
CONDENSE: it_data-eoutput_data.
MODIFY it_data INDEX sy-tabix.
ENDLOOP.
LOOP AT it_data.
WRITE: / it_data-eoutput_data.
ENDLOOP.
Please Reply if any Issue about provided code
Best Regards,
Faisal
11-23-2009 4:23 AM
can you try this
data:len type i.
loop at gt_data.
clear len.
eoutput_data-maktx ='"'.
eoutput_data-maktx+1(*) = gt_data-maktx.
len = strlen( eoutput_data-maktx ).
eoutput_data-maktx+len(1) = '"'.
eoutput_data-del1+0(1) = ';'.
clear len.
eoutput_data-prodgroup = '"'.
eoutput_data-prodgroup+1(*) = gt_data-prodgroup.
len = strlen( eoutput_data-prodgroup ).
eoutput_data-prodgroup+len(1) = '"'.
eoutput_data-del2+0(1) = ';'.
append eoutput_data.
endloop.
11-22-2009 7:09 PM
Thanks faisal for your reply.
but now it is working for " KH 255/55 R16 V04L KW12 " ;
now problem is i am getting space next digit. " KH 255/55 R16 V04L KW12 " ; "".
next field i have blank with double quote. i dont want any space between delimiter and fields.
i tried to put same code for next field , but i am not able to remove space.
i tried to put condense in final output also.
please let me know if you have any other method.
i am not writing this field in output, i am writing this field in out put file.
Thanks and regards,
sai
11-29-2009 12:03 PM