Application Development and Automation 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: 
Read only

Remove # from the number

Former Member
0 Likes
889

Hi experts,

I have a field in an internal table, in which a number is getting filled, but it comes with an initial #.

Ex: #1234

How can I remvoe this #.

I tried:

REPLACE ALL OCCURRENCES of '#' WITH ''.

SHIFT LEFT DELETING LEADING ''.

But this is not working.

Could you please help me on this?

Thanks,

Mohit.

1 ACCEPTED SOLUTION
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
856

Use offset.For example LV_BUKRS+0(1) = ''.

condense lv_bukrs.

thanks

Nabheet

Hi experts,

I have a field in an internal table, in which a number is getting filled, but it comes with an initial #.

Ex: #1234

How can I remvoe this #.

I tried:

REPLACE ALL OCCURRENCES of '#' WITH ''.

SHIFT LEFT DELETING LEADING ''.

But this is not working.

Could you please help me on this?

Thanks,

Mohit.

5 REPLIES 5
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
857

Use offset.For example LV_BUKRS+0(1) = ''.

condense lv_bukrs.

thanks

Nabheet

Read only

0 Likes
856

Hi Nabheet,

This is my piece of code:

LOOP AT gt_bp_file INTO wa_bp_file.

wa_bp_file-bpext+0(1) = ''.

CONDENSE wa_bp_file-bpext.

ENDLOOP.

It is still not correct. Could you please let me know where the issue is?

Thanks,

Mohit.

Read only

0 Likes
856

Where are you modifying the data of internakl table...?

Try this code.

LOOP AT gt_bp_file INTO wa_bp_file.

wa_bp_file-bpext+0(1) = ''.

CONDENSE wa_bp_file-bpext.

"modify gt_bp_file from wa_bp_file"

ENDLOOP.

By the way how are you getting this #..?

Nabheet

Read only

Former Member
0 Likes
856

Hi,

Write as below ...

REPLACE ALL OCCURRENCES OF REGEX '#' IN v_char WITH ' '.

Regards,

Srini.

Read only

Former Member
0 Likes
856

Hi,

Try Like this,


REPLACE ALL OCCURRENCES OF '#' IN maktx WITH '"'
            REPLACEMENT COUNT cnt .

*-reverse string
        CALL FUNCTION 'STRING_REVERSE'
         EXPORTING
          string = maktx
          lang = 'E'
         IMPORTING
          rstring = temp_str.

          REPLACE '"' IN temp_str WITH ''.
*-reverse string
        CALL FUNCTION 'STRING_REVERSE'
         EXPORTING
          string = temp_str
          lang = 'E'
         IMPORTING
          rstring = maktx.