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: 

Add zero

Former Member
0 Kudos

Hi Experts,

I have one field like MATNR. Its data type is char(18).

Now my problem is I wrote select querry based on matnr. if it is 100 means it didn't retrieve the data from the data base.

So I used to unpack command and adds 15 zero's to matnr and its working fine.

But if the Matnr is 'M-10' means its shows run time error. So how can I add zeros before to the parameter matnr at run time.

Thanks,

Points Assured.

1 ACCEPTED SOLUTION

harimanjesh_an
Active Participant
0 Kudos

Hi Jasmine,

Use conversion exits. It will convert ur input data into format that is stored in database.

For example, Matnr = 2340 is stored as 000000000000002340.

So use conversion exit <b>'CONVERSION_EXIT_MATN1_INTPUT'</b>

check this sample code.....

PARAMETERS : p_matnr TYPE mara-matnr.

DATA : w_matnr TYPE mara-matnr,

t_mara TYPE STANDARD TABLE OF mara.

START-OF-SELECTION.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

EXPORTING

input = p_matnr

IMPORTING

output = w_matnr.

.

SELECT * FROM mara INTO TABLE t_mara WHERE matnr = w_matnr.

IF sy-subrc = 0 .

WRITE : / sy-dbcnt.

  • process ur logic.

ENDIF.

Reward me if useful.........

Harimanjesh AN

11 REPLIES 11

Former Member
0 Kudos

overlay matnr with '000000000000000000'.

Former Member
0 Kudos

ALFA ALPHA conversion

CONVERSION_EXIT_ALPHA_INPUT Conversion exit ALPHA, external->internal

CONVERSION_EXIT_ALPHA_OUTPUT Conversion exit ALPHA, internal->external

asik_shameem
Active Contributor
0 Kudos

use the FM <b>conversion_exit_alpha_input</b>

Former Member
0 Kudos

Hi,

Use FM CONVERSION_EXIT_MATN1_INPUT & CONVERSION_EXIT_MATN1_OUTPUT on matnr field.

Reward Points if this helps,

Regards,

Satish

Former Member
0 Kudos

Hi

use this fm

CONVERSION_EXIT_ALPHA_INPUT Conversion exit ALPHA, external->internal

CONVERSION_EXIT_ALPHA_OUTPUT Conversion exit ALPHA, internal->external

hope this helps you

Reward pts if useful..

Sreenivas

Former Member
0 Kudos

Before the material is passed into the where clause of select

Use the conversion routine conversion_exit_matn1_input or

conversion_exit_matn1_output .

This u can see in the domain of the matnr field type .

apply this .

Regards,

Vijay.

Former Member
0 Kudos

Hello

Please do this

DATA : L_MATNR(18).

write 'M-10' to L_MATNR right-justified.

overlay L_MATNR with '000000000000000000'. "18 zeros.

L_MATNR will now have data as per your format.

<b>Reward points if useful</b>

Regards

Saket Sharma

harimanjesh_an
Active Participant
0 Kudos

Hi Jasmine,

Use conversion exits. It will convert ur input data into format that is stored in database.

For example, Matnr = 2340 is stored as 000000000000002340.

So use conversion exit <b>'CONVERSION_EXIT_MATN1_INTPUT'</b>

check this sample code.....

PARAMETERS : p_matnr TYPE mara-matnr.

DATA : w_matnr TYPE mara-matnr,

t_mara TYPE STANDARD TABLE OF mara.

START-OF-SELECTION.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

EXPORTING

input = p_matnr

IMPORTING

output = w_matnr.

.

SELECT * FROM mara INTO TABLE t_mara WHERE matnr = w_matnr.

IF sy-subrc = 0 .

WRITE : / sy-dbcnt.

  • process ur logic.

ENDIF.

Reward me if useful.........

Harimanjesh AN

Former Member
0 Kudos

Hi Jasmine,

Either u can use FM CONVERSION_EXIT_MATN1_INPUT

CONVERSION_EXIT_MATN1_OUTPUT to convert data in your required format.

or u use

ovelay l_matnr with '000000000000000000'.

write: l_matnr.

If it is usefull pls reward pts.

Regards

Srimanta

Former Member
0 Kudos

I already checked with CONVERSION_EXIT_ALPHA_INPUT.

But its not working when the material number is m-10 (character means).

Any way thanks for the Effort.

0 Kudos

I have a similar issue. Have you got any solution to this?