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

conversion

Former Member
0 Likes
1,200

hi all

i have to convert the type matnr from one itab(say i_mara) to type obnum and put in this itab by using conversion_exit_matn1_input. how can i do this?

kindly can anyone help me?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,164

Hi,

Pass the Matnr field as Importing paramter and pass the Field similar to OBNUM as exporting paramter to the fun module after calling it in code.

Regards,

Anji

9 REPLIES 9
Read only

Former Member
0 Likes
1,165

Hi,

Pass the Matnr field as Importing paramter and pass the Field similar to OBNUM as exporting paramter to the fun module after calling it in code.

Regards,

Anji

Read only

0 Likes
1,164

hi anji

i am doing the samething and i have to use this in a select query with for all entries where i_mara -matnr = i_ausp-objnum.

but its not working.

what can i do.

kindly help me

Read only

0 Likes
1,164

SELECT matchin MATNR from database will not work because you have to use MATNR value with proper formatting

For this use TYPE MATNR field instead of i_ausp-objnum (which I guess is type OBJNUM 20 char).

So first convert i_ausp-objnum to TYPE MATNR by calling CONVERSION_EXIT_MATN1_INPUT with INPUT = i_ausp-objnum and OUTPUT = TYPE MATNR field say V_MATNR. Store V_MATNR value thus calculated in another copy of i_ausp table, say i_ausp2 table in a new field i_ausp2-matnr.

Now do the SELECT query select query with for all entries where i_mara -matnr = i_ausp-matnr.

Read only

0 Likes
1,164

data: m_objek type objnum.

hi anji

i am doing the following code and after that writing the select statements , but thats not working.

types:begin of t_matnr,

matnr type matnr,

end of t_matnr.

data: i_matnr type standard table of t_matnr,

w_matnr type t_matnr.

loop at i_matnr into w_matnr.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

EXPORTING

input = w_matnr-matnr

IMPORTING

OUTPUT = m_objek

EXCEPTIONS

LENGTH_ERROR = 1

OTHERS = 2.

at new matnr.

w_matnr-matnr = m_objek.

modify i_matnr from w_matnr.

append w_matnr to i_matnr.

clear:w_matnr.

endat.

endloop.

loop at i_material into w_material.

read table i_matnr into w_matnr with key matnr = w_material-matnr binary search.

if sy-subrc = 0.

move:w_matnr-matnr to w_material-matnr.

modify i_material from w_material.

endif.

clear:w_matnr, w_material.

endloop.

Read only

0 Likes
1,164

Where is the SELECT with FOR ALL entries? Moreover the function in your code converts a non MATNR type to MATNR formatting. So the IMPORT parameter should be MATNR type. You will see that it will be formatted in 18 char with leading zeros

Read only

0 Likes
1,164

Though you can always give a TYPE MATNR fields in both input and output. The difference would be like this -

if input = 12345678

ouput = 000000000012345678

Input can be MATNR type or not but Output should always be TYPE MATNR field

I hope I made myself clear

Read only

0 Likes
1,164

hi vishnu thank for all

i tried the o/p to be type matnr as u said but still its not working.

what can i do?

can any one suggest?

thanks in advance

data: m_matnr type matnr.

types:begin of t_matnr,

matnr type matnr,

end of t_matnr.

data: i_matnr type standard table of t_matnr,

w_matnr type t_matnr.

loop at i_matnr into w_matnr.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

EXPORTING

input = w_matnr-matnr

IMPORTING

OUTPUT = m_matnr

EXCEPTIONS

LENGTH_ERROR = 1

OTHERS = 2.

at new matnr.

w_matnr-matnr = m_matnr.

modify i_matnr from w_matnr.

append w_matnr to i_matnr.

clear:w_matnr.

endat.

endloop.

loop at i_material into w_material.

read table i_matnr into w_matnr with key matnr = w_material-matnr binary search.

if sy-subrc = 0.

move:w_matnr-matnr to w_material-matnr.

modify i_material from w_material.

endif.

clear:w_matnr, w_material.

endloop.

Read only

0 Likes
1,164

I can see a loop on an internal table, and you are appending the internal table within the loop itself? Doesn't make much sense to me.

Can you please explain in detail what you trying to do. Explain the full problem at hand. Then I can help you.

Read only

Former Member
0 Likes
1,164

Hi,

the matnr field is char type with length 18 but the objnum field is character type with length 50 . So you can concatenate spaces to that field and then move it in the corresponding field in the internal table.

Regards,

Sunmit.