‎2010 Aug 16 3:18 PM
Hi,
I have set of ten fields to be concatenated with a separator.
But only the fields which are not initial should be concatenated.
Is there any easy way available to do this or each time should I have to check all the ten fields and then concatenate?
‎2010 Aug 16 3:42 PM
Concatenate all the fields and in next step just use
condense lv_string. This will delete the spaces.
‎2010 Aug 16 3:57 PM
the separator in my case is '/'.
for example,
text1 = blank
text2 = str1
text3 = str3
concatenate text1 text2 text3 into text separated by '/'.
now the o/p is,
/str1/str3
now i don want the first '/' to be displayed.
how can this be done?
‎2010 Aug 16 3:59 PM
Hi Sharan,
Check this code snippet;
PARAMETERS:
p_text1 TYPE char10,
p_text2 TYPE char10,
p_text3 TYPE char10,
p_text4 TYPE char10,
p_text5 TYPE char10,
p_delim TYPE char1.
DATA: v_output TYPE string,
itab TYPE STANDARD TABLE OF char10,
wa TYPE char10.
CONCATENATE p_text1
p_text2
p_text3
p_text4
p_text5
INTO v_output SEPARATED BY p_delim.
WRITE: / v_output.
SPLIT v_output AT p_delim INTO TABLE itab.
CLEAR v_output.
DELETE itab WHERE table_line IS INITIAL. "delete initial recs
LOOP AT itab INTO wa.
IF sy-tabix = 1.
v_output = wa. "Without this output'll be corrupted ;-)
ELSE.
CONCATENATE v_output wa INTO v_output SEPARATED BY p_delim.
ENDIF.
ENDLOOP.
WRITE: / v_output.Hope this is of some use.
BR,
Suhas
‎2010 Aug 16 5:40 PM
thanks suhas for ur inputs..
but solved the issue by this way,
append text1 to itab.
append text2 to itab.
append text3 to itab.
delete itab where table_line is initial.
concatenate lines of itab into text seperated by '/'.
‎2019 Oct 10 2:42 PM