Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with ## Symbols

Former Member
0 Kudos

Hi All,

I have the internal which contains long text with some double hashes. This loing text is maintained in Purchase order in each line. my requirement i want to send this complete text into excel file. Problem hear was the complete text is going to Excel sheet but this text is spliting from hases and dispalying in multiple rows means each line text is showing in each row.Due to this format is coming incorrect. Complete text should be dispaly in one row not multiple rows.

Ex : Text maintained in PO as below.

seqential PO'S

Carenal Date

Material Date

order information

and the internal table text appearing as seqential PO'S## Carenal Date##Material Date##order information

Expected Output: seqential PO'SCarenal DateMaterial Dateorder information

Current Output in Excel: seqential PO'S

Carenal Date

Material Date

order information

Please help us to remove the hashes from the long text.

8 REPLIES 8

Former Member
0 Kudos

hi,

data: a type string value 'POS## Carenal Date##Material Date##order'.

REPLACE ALL OCCURRENCES OF '#' in: a with ''.

write: a.

I hope this will resolve your problem.

if helpful please reward points.

Former Member
0 Kudos

Hi,

I tried with Replace all occurenace and it is not working as Those hases are tab spaces and it will come dynamically into our internal table.

First thing how to check the codingiton Whether it contians any hashes or not. if yes we need to remove those and should display the complete text in excel output.

See how we did below.

DATA: V_TEX TYPE STRING.

V_TEXT = 'DATA##DELIVRYUDATE##CONFIRMED##'.

if V_tEXT CA '##'.

REPLACE ALL OCCURENACES OF '##' in v_text with ' '.

endif.

But is not working and also condition is not satisfied.

0 Kudos

hi,

you can use.

Find all occurrences statement

if sy-subrc eq 0.

then your code.

endif.

0 Kudos

hi Try this way, hope it will help,

DATA wt_string type string_table.
  DATA lv_string like line of wt_string .
   clear wt_string .
   SPLIT <WA_FIELD > AT '##' INTO TABLE wt_string.
   DELETE ADJACENT DUPLICATES FROM wt_string .
   CLEAR <WA_FIELD > .
   LOOP AT wt_string INTO lv_string.
      CHECK lv_string IS NOT INITIAL .
      CONCATENATE <WA_FIELD > lv_string INTO <WA_FIELD > SEPARATED BY '##'.
      clear lv_string.
   ENDLOOP.
   REPLACE FIRST OCCURRENCE OF '##' IN <WA_FIELD > WITH space.

0 Kudos

Hi,

Split is not working for HASHES.

Same date is coming to the internal table.

0 Kudos

hi ,

use translate keyword.


DATA: V_TEX TYPE STRING.

V_TEX = 'DATA##DELIVRYUDATE##CONFIRMED##'.

if V_tEX CA '##'.

TRANSLATE v_tex using '# '.
endif.

write v_tex.

Regards,

Dhina..

0 Kudos

As you have mentioned - the '#''s are horizontal tabs or line feeds, you have to replace the horizontal tabs with space. If you are still getting tabs after the below statement, try also replacing CL_ABAP_CHAR_UTILITIES=>CR_LF with space. ( Do not try below code on a variable assigned with ## text as you mentioned in your example, instead try with variable having the value from long text. )

REPLACE ALL OCCURENACES OF CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB in v_text with space.

0 Kudos

Hi,

try also replacing CL_ABAP_CHAR_UTILITIES=>CR_LF with space

Yep, +1 here... looks like there's also a carriage return hidden somewhere...

Kr,

Manu.