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

Data Validation

Former Member
0 Likes
763

Hi Gurus,

I have material number 47890858250, but I have defined my material number field to be 18 characters. Moreover I need to extract 6-10 characters of that material number, so in this case it should return 04789 from the material number 0000000047890858250

but it is returning 58250, and to avoid this I have written following code but then also I am getting the same wrong number

move it_temp_item-prodid to v_prodid_hier2.

if v_prodid_hier2+0(1) = '0'.

shift v_prodid_hier2 left deleting leading 0.

move it_temp_item-prodid(18) to v_prodid_hier2.

shift v_prodid_hier2 right deleting trailing space.

overlay v_prodid_hier2 with '000000000000000000'.

it_temp_item-v_matnr = v_prodid_hier2+6(5).

else.

move it_temp_item-prodid(18) to v_prodid_hier2.

it_temp_item-v_matnr = v_prodid_hier2+6(5).

can you help me out.

Thanks

Rajeev Gupta

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
743

HI,

Pass the material number to

Conversion_exit_alpha_input

exporting

input = v_matnr

importing

output = v_matnr.

v_required = v_matnr+6(5).

Thanks

Mahesh

6 REPLIES 6
Read only

Former Member
0 Likes
743

Hi

Pass the value 47890858250 to the fun module

CONVERSION_EXIT_ALPHA_OUTPUT

you will get all 18 char field

then you can do the offsetting for the required data

v_field = matnr+6(5) will give the 04789

<b>Reward points for useful Answers</b>

Regards

Anji

Read only

0 Likes
743

Thanks for the reply but can you be more specific...I mean can you explain with an example..

Thanks

Rajeev

Read only

Former Member
0 Likes
744

HI,

Pass the material number to

Conversion_exit_alpha_input

exporting

input = v_matnr

importing

output = v_matnr.

v_required = v_matnr+6(5).

Thanks

Mahesh

Read only

0 Likes
743

Thanks for the reply,

I passed my material no. in the function module, but then also it showing me the same.

my material no. field is - v_matnr

and my material no. is 45300888550

and I want to it to be 000000045300888550

Thanks

Rajeev Gupta

Read only

0 Likes
743

Hi Rajeev,

Define

DATA v_matnr TYPE mara-matnr.

Now use

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

EXPORTING

.....= v_matnr

IMPORTING

....= v_matnr

Regards,

Atish

Read only

0 Likes
743

Check the below program :

data : v_matnr(18) type c.

data : v_required(5) type c.

start-of-selection.

v_matnr = '45300888550'.

Conversion_exit_alpha_input

exporting

input = v_matnr

importing

output = v_matnr.

v_required = v_matnr+6(5).

write:/ v_matnr,v_required.

Thanks

Seshu