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

Regarding replace all space value to '0'

Former Member
0 Likes
3,124

Hi Experts,

I am facing problem with replace statement.

I am moving lv_matnr value to right by shift statement.

And I want to replace all space value to '0'.

following is the sample code.

lv_num = 16 - STRLEN( LV_MATNR ).

shift lv_matnr by lv_num places right.

replace ALL OCCURRENCES OF ' ' in lv_matnr with '0'

could you please help me on this.

needed very urgently

Thanks in Advance

Hi Experts,

I am facing problem with replace statement.

I am moving lv_matnr value to right by shift statement.

And I want to replace all space value to '0'.

following is the sample code.

lv_num = 16 - STRLEN( LV_MATNR ).

shift lv_matnr by lv_num places right.

replace ALL OCCURRENCES OF ' ' in lv_matnr with '0'

could you please help me on this.

needed very urgently

Thanks in Advance

8 REPLIES 8
Read only

Former Member
0 Likes
1,785

data: lv_martnr type n.

try to declare that way.

Read only

anversha_s
Active Contributor
0 Likes
1,785

hi,

use this.

converts any number into a string fill with zeroes
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = LV_MATNR
            IMPORTING
              output = lv_num 


Example:

input = 123 
output = 000000123

Rgds

Anver

Read only

Former Member
0 Likes
1,785

Use the function module CONVERSION_EXIT_ALPHA_INPUT

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = lv_matnr

IMPORTING

OUTPUT = lv_matnr.

Read only

Former Member
0 Likes
1,785

<b>data: lv_matnr type matnr.</b>

lv_num = 16-strlen(lv_matnr).

shift lv_matnr by lv_num places right.

replace all occurrences of space in lv_matnr with '0'.

****************************

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = lv_matnr

IMPORTING

OUTPUT = lv_matnr.

Message was edited by:

Ramesh Babu Chirumamilla

Read only

Former Member
0 Likes
1,785

Hi

Use the unpack command.

e.g <b>UNPACK LV_MATNR TO LV_MATNR</b> .

Regards

Arun

Read only

Former Member
0 Likes
1,785

hi,

try this.

data dummy(16) type c '0000000000000000'.

lv_num = 16 - STRLEN( LV_MATNR ).

<b>concatenate dummy(lv_num) lv_matnr into lv_matnr.</b>

i think this will help u.

Read only

Former Member
0 Likes
1,785

Hi,

Use alpha conversion exit

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,785

Hi,

data lv_matnr(18)."According to the requirement

lv_matnr = matnr_value.

unpack lv_matnr to lv_matnr.