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

field conversion problem

Former Member
0 Likes
1,032

Hi,

somebody has written mv45afzz program. now I am modifying that.

last week i included a field in vbap table as field1 (CHAR, 18).

num1 field has CHAR(10).

FORM USEREXIT_MOVE_FIELD_TO_VBAP.

if vbap-matnr <> *vbap-matnr.

clear vbap-field1.

select single t1~num1 into vbap-field1

from mara as t1 inner join zcust as t2

on t1num1 = t2num1

where matnr = vbap-matnr

and mtart = 'NSTK'

and delet = ''.

endif.

this user exit is related to Contracts(va41). when i am giving material number in va41, it is checking with mara table and saying that number is not valid.

for example i entered 1001 number as matnr which is exist in the mara table.

In debug mode, i added 14 zeros in field1, then it is working perfectly.

shall i need to call the field conversion function module like...

CONVERSION_EXIT_MATN1_INPUT...

anybody has idea...

Thanks in advance,

Yad.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
870

Yes, use the CONVERSION_EXIT_MATN1_INPUT function module. You could also use the function module CONVERSION_EXIT_ALPHA_INPUT.



data: num1(10) type c value '123456',
      new_num(18) type c.

call function 'CONVERSION_EXIT_MATN1_INPUT'
  exporting
    input              = num1
 IMPORTING
   OUTPUT             = new_num
 EXCEPTIONS
   LENGTH_ERROR       = 1
   OTHERS             = 2
          .

Regards,

Rich Heilman

6 REPLIES 6
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
871

Yes, use the CONVERSION_EXIT_MATN1_INPUT function module. You could also use the function module CONVERSION_EXIT_ALPHA_INPUT.



data: num1(10) type c value '123456',
      new_num(18) type c.

call function 'CONVERSION_EXIT_MATN1_INPUT'
  exporting
    input              = num1
 IMPORTING
   OUTPUT             = new_num
 EXCEPTIONS
   LENGTH_ERROR       = 1
   OTHERS             = 2
          .

Regards,

Rich Heilman

Read only

0 Likes
870

Hi,

I have written like this..still not getting...padding zeros to vbap-field1 is my solution..but how can i do that...

FORM USEREXIT_MOVE_FIELD_TO_VBAP.

Data: num1 like zcust-num1,

field1 like vbap-field1.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

EXPORTING

INPUT = num1

IMPORTING

OUTPUT = field1

if vbap-matnr <> *vbap-matnr.

clear vbap-field1.

select single t1~num1 into vbap-field1

from mara as t1 inner join zcust as t2

on t1num1 = t2num1

where matnr = vbap-matnr

and mtart = 'NSTK'

and delet = ''.

endif.

Thanks in advance,

Yad.

Read only

0 Likes
870

Shouldn't you be doing the conversion after you get the data?




Data: num1 like zcust-num1,
field1 like vbap-field1.



if vbap-matnr <> *vbap-matnr.
clear vbap-field1.
select single t1~num1 into vbap-field1
   from mara as t1 inner join zcust as t2
    on t1~num1 = t2~num1
   where matnr = vbap-matnr
        and mtart = 'NSTK'
        and delet = ''.


CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = vbap-field1
IMPORTING
OUTPUT = vbap-field1



endif.



Regards,

Rich Heilman

Read only

0 Likes
870

Hi Heilman,

thanks for the solution. I got the result...

Yad.

Read only

0 Likes
870

Hi Heilman,

thanks for the solution. I got the result...

Yad.

Read only

0 Likes
870

Please "close" this post, so others don't waste time reading resolved problems.

Thanks.

Regards,

Rich Heilman